From 5560a4f0f1f5b4799a8c5162212e7ec22c601ae5 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 31 Oct 2010 22:39:40 +0000 Subject: Fixed a few pedantic warnings. Added Fl::option as discussed in STR #2368, but I am not too happy with it yet. Please see discussion in that STR. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7789 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Input.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/Fl_Input.cxx') diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index 9277c37e2..9006411bc 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -382,7 +382,8 @@ int Fl_Input::handle_key() { case ctrl('A'): // go to the beginning of the current line return shift_position(line_start(position())) + NORMAL_INPUT_MOVE; case ctrl('B'): // go one character backward - return shift_position(position()-1) + NORMAL_INPUT_MOVE; + i = shift_position(position()-1) + NORMAL_INPUT_MOVE; + return Fl::option(Fl::OPTION_ARROW_FOCUS) ? i : 1; case ctrl('C'): // copy return copy(1); case ctrl('D'): // cut the next character @@ -396,7 +397,8 @@ int Fl_Input::handle_key() { case ctrl('E'): // go to the end of the line return shift_position(line_end(position())) + NORMAL_INPUT_MOVE; case ctrl('F'): // go to the next character - return shift_position(position()+1) + NORMAL_INPUT_MOVE; + i = shift_position(position()+1) + NORMAL_INPUT_MOVE; + return Fl::option(Fl::OPTION_ARROW_FOCUS) ? i : 1; case ctrl('H'): // cut the previous character if (readonly()) { fl_beep(); @@ -417,7 +419,10 @@ int Fl_Input::handle_key() { return copy_cuts(); case ctrl('N'): // go down one line i = position(); - if (line_end(i) >= size()) return NORMAL_INPUT_MOVE; + if (line_end(i) >= size()) { + if (input_type()==FL_MULTILINE_INPUT && !Fl::option(Fl::OPTION_ARROW_FOCUS)) return 1; + return NORMAL_INPUT_MOVE; + } while (repeat_num--) { i = line_end(i); if (i >= size()) break; @@ -427,7 +432,10 @@ int Fl_Input::handle_key() { return 1; case ctrl('P'): // go up one line i = position(); - if (!line_start(i)) return NORMAL_INPUT_MOVE; + if (!line_start(i)) { + if (input_type()==FL_MULTILINE_INPUT && !Fl::option(Fl::OPTION_ARROW_FOCUS)) return 1; + return NORMAL_INPUT_MOVE; + } while(repeat_num--) { i = line_start(i); if (!i) break; -- cgit v1.2.3