diff options
| author | Bill Spitzak <spitzak@gmail.com> | 2000-06-20 07:56:09 +0000 |
|---|---|---|
| committer | Bill Spitzak <spitzak@gmail.com> | 2000-06-20 07:56:09 +0000 |
| commit | 823b1f8460c82110ff0cd28c94684d413d955ad7 (patch) | |
| tree | 98b5b99f6519772c84c7a7478f13a7dcc5cf2cc0 /src/Fl_Input.cxx | |
| parent | f7e4caec2575619b6578b866bb59630bb513049c (diff) | |
Fixes to WORDWRAP modification to Fl_Input based on work done by
Alexander Rabi Beels. This will not affect things much because WORDWRAP
is normally disabled. However it fixes a few bugs with word+line selection
and with up/down arrows working when there are tabs or control characters
in the text. I modified his patches so no changes are needed to the
header files to enable wordwrap and so that very long words scroll
horizontally rather than break between letters.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1223 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Input.cxx')
| -rw-r--r-- | src/Fl_Input.cxx | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index 3e6194982..89a511dd5 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input.cxx,v 1.10.2.11 2000/06/10 21:31:00 bill Exp $" +// "$Id: Fl_Input.cxx,v 1.10.2.12 2000/06/20 07:56:08 bill Exp $" // // Input widget for the Fast Light Tool Kit (FLTK). // @@ -119,11 +119,7 @@ int Fl_Input::handle_key() { int i; switch (ascii) { case ctrl('A'): - if (type() == FL_MULTILINE_INPUT) - for (i=position(); i && index(i-1)!='\n'; i--) ; - else - i = 0; - return shift_position(i) + NORMAL_INPUT_MOVE; + return shift_position(line_start(position())) + NORMAL_INPUT_MOVE; case ctrl('B'): return shift_position(position()-1) + NORMAL_INPUT_MOVE; case ctrl('C'): // copy @@ -133,11 +129,7 @@ int Fl_Input::handle_key() { if (mark() != position()) return cut(); else return cut(1); case ctrl('E'): - if (type() == FL_MULTILINE_INPUT) - for (i=position(); index(i) && index(i)!='\n'; i++) ; - else - i = size(); - return shift_position(i) + NORMAL_INPUT_MOVE; + return shift_position(line_end(position())) + NORMAL_INPUT_MOVE; case ctrl('F'): return shift_position(position()+1) + NORMAL_INPUT_MOVE; case ctrl('H'): @@ -146,26 +138,19 @@ int Fl_Input::handle_key() { return 1; case ctrl('K'): if (position()>=size()) return 0; - if (type() == FL_MULTILINE_INPUT) { - if (index(position()) == '\n') - i = position() + 1; - else - for (i=position()+1; index(i) && index(i) != '\n'; i++); - } else - i = size(); + i = line_end(position()); + if (i == position() && i < size()) i++; cut(position(), i); return copy_cuts(); case ctrl('N'): - if (type()!=FL_MULTILINE_INPUT) return 0; - for (i=position(); index(i)!='\n'; i++) - if (!index(i)) return NORMAL_INPUT_MOVE; + i = line_end(position()); + if (i >= size()) return NORMAL_INPUT_MOVE; shift_up_down_position(i+1); return 1; case ctrl('P'): - if (type()!=FL_MULTILINE_INPUT) return 0; - for (i = position(); i > 0 && index(i-1) != '\n'; i--) ; + i = line_start(position()); if (!i) return NORMAL_INPUT_MOVE; - shift_up_down_position(i-1); + shift_up_down_position(line_start(i-1)); return 1; case ctrl('U'): return cut(0, size()); @@ -208,7 +193,7 @@ int Fl_Input::handle(int event) { up_down_position(0); break; case FL_Up: - up_down_position(size()); + up_down_position(line_start(size())); break; case FL_Tab: case 0xfe20: // XK_ISO_Left_Tab @@ -259,5 +244,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l) } // -// End of "$Id: Fl_Input.cxx,v 1.10.2.11 2000/06/10 21:31:00 bill Exp $". +// End of "$Id: Fl_Input.cxx,v 1.10.2.12 2000/06/20 07:56:08 bill Exp $". // |
