diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2003-05-04 22:29:01 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2003-05-04 22:29:01 +0000 |
| commit | ea324d25c4932a331e59bb3ae453ba3554bd6405 (patch) | |
| tree | 98d956c613737ddc1abf31d6718965e15272b0c8 | |
| parent | e2baef33cdfd3e5f90cdce2685b6239b1979b721 (diff) | |
Fl_Text_Display and friends now look for the next
non-punctuation/space character for word boundaries (STR #26)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2977 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | CHANGES | 3 | ||||
| -rw-r--r-- | src/Fl_Text_Display.cxx | 19 |
2 files changed, 14 insertions, 8 deletions
@@ -1,5 +1,8 @@ CHANGES IN FLTK 1.1.4 + - Fl_Text_Display and friends now look for the next + non-punctuation/space character for word boundaries + (STR #26) - gl_font() didn't work properly for X11 when Xft was used (STR #12) - Fl_File_Browser incorrectly included "." on WIN32 (STR diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index ffea7716f..0f9211f88 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Text_Display.cxx,v 1.12.2.44 2003/03/26 00:47:14 easysw Exp $" +// "$Id: Fl_Text_Display.cxx,v 1.12.2.45 2003/05/04 22:29:01 easysw Exp $" // // Copyright 2001-2003 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under @@ -1120,13 +1120,16 @@ int Fl_Text_Display::rewind_lines(int startPos, int nLines) { } } +static inline int fl_isseparator(int c) { + return c != '$' && c != '_' && (isspace(c) || ispunct(c)); +} + void Fl_Text_Display::next_word() { int pos = insert_position(); - while ( pos < buffer()->length() && ( - isalnum( buffer()->character( pos ) ) || buffer()->character( pos ) == '_' ) ) { + while (pos < buffer()->length() && !fl_isseparator(buffer()->character(pos))) { pos++; } - while ( pos < buffer()->length() && !( isalnum( buffer()->character( pos ) ) || buffer()->character( pos ) == '_' ) ) { + while (pos < buffer()->length() && fl_isseparator(buffer()->character(pos))) { pos++; } @@ -1136,13 +1139,13 @@ void Fl_Text_Display::next_word() { void Fl_Text_Display::previous_word() { int pos = insert_position(); pos--; - while ( pos && !( isalnum( buffer()->character( pos ) ) || buffer()->character( pos ) == '_' ) ) { + while (pos && fl_isseparator(buffer()->character(pos))) { pos--; } - while ( pos && ( isalnum( buffer()->character( pos ) ) || buffer()->character( pos ) == '_' ) ) { + while (pos && !fl_isseparator(buffer()->character(pos))) { pos--; } - if ( !( isalnum( buffer()->character( pos ) ) || buffer()->character( pos ) == '_' ) ) pos++; + if (fl_isseparator(buffer()->character(pos))) pos++; insert_position( pos ); } @@ -3046,5 +3049,5 @@ int Fl_Text_Display::handle(int event) { // -// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.44 2003/03/26 00:47:14 easysw Exp $". +// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.45 2003/05/04 22:29:01 easysw Exp $". // |
