summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-02-24 20:35:07 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-02-24 20:35:07 +0000
commit97b9464f59e87bc33009336b3a5b9b37ae06292e (patch)
tree58b42e5c174e967bb6eedc77e56160cd489b9483 /src
parentc2873e6c63ace3c1d873ee12d56cd7eefb2b88f7 (diff)
Fl_Multiline_Input now scrolls the full height of the widget
instead of 5 lines when the user presses PageUp or PageDown (STR #727) src/Fl_Input.cxx: - Set repeat_num to h()/textsize() instead of 5. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4049 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Input.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx
index 690ff3883..5db16f1c9 100644
--- a/src/Fl_Input.cxx
+++ b/src/Fl_Input.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Input.cxx,v 1.10.2.15.2.19 2004/04/11 04:38:57 easysw Exp $"
+// "$Id$"
//
// Input widget for the Fast Light Tool Kit (FLTK).
//
@@ -108,13 +108,15 @@ int Fl_Input::handle_key() {
case FL_Right:
ascii = ctrl('F'); break;
case FL_Page_Up:
- repeat_num=5; //temporary hack
- //TODO: find number of lines in window and use it instead 5
+ fl_font(textfont(),textsize()); //ensure current font is set to ours
+ repeat_num=h()/fl_height(); // number of lines to scroll
+ if (!repeat_num) repeat_num=1;
case FL_Up:
ascii = ctrl('P'); break;
case FL_Page_Down:
- repeat_num=5; //temporary hack
- //TODO: find number of lines in window and use it instead 5
+ fl_font(textfont(),textsize());
+ repeat_num=h()/fl_height();
+ if (!repeat_num) repeat_num=1;
case FL_Down:
ascii = ctrl('N'); break;
case FL_Home:
@@ -202,18 +204,20 @@ int Fl_Input::handle_key() {
return copy_cuts();
case ctrl('N'):
i = position();
+ if (line_end(i) >= size()) return NORMAL_INPUT_MOVE;
while (repeat_num--) {
i = line_end(i);
- if (i >= size()) return NORMAL_INPUT_MOVE;
+ if (i >= size()) break;
i++;
}
shift_up_down_position(i);
return 1;
case ctrl('P'):
i = position();
+ if (!line_start(i)) return NORMAL_INPUT_MOVE;
while(repeat_num--) {
i = line_start(i);
- if (!i) return NORMAL_INPUT_MOVE;
+ if (!i) break;
i--;
}
shift_up_down_position(line_start(i));
@@ -414,5 +418,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.15.2.19 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id$".
//