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
This commit is contained in:
Michael R Sweet
2005-02-24 20:35:07 +00:00
parent c2873e6c63
commit 97b9464f59
2 changed files with 15 additions and 8 deletions
+3
View File
@@ -1,6 +1,9 @@
CHANGES IN FLTK 1.1.7 CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #648, STR #692) - Documentation fixes (STR #648, STR #692)
- Fl_Multiline_Input now scrolls the full height of the
widget instead of 5 lines when the user presses PageUp
or PageDown (STR #727)
- CMake build fixes (STR #724) - CMake build fixes (STR #724)
- Fl_Browser::swap() didn't handle redraws properly when - Fl_Browser::swap() didn't handle redraws properly when
the swapped lines had different heights (STR #729) the swapped lines had different heights (STR #729)
+12 -8
View File
@@ -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). // Input widget for the Fast Light Tool Kit (FLTK).
// //
@@ -108,13 +108,15 @@ int Fl_Input::handle_key() {
case FL_Right: case FL_Right:
ascii = ctrl('F'); break; ascii = ctrl('F'); break;
case FL_Page_Up: case FL_Page_Up:
repeat_num=5; //temporary hack fl_font(textfont(),textsize()); //ensure current font is set to ours
//TODO: find number of lines in window and use it instead 5 repeat_num=h()/fl_height(); // number of lines to scroll
if (!repeat_num) repeat_num=1;
case FL_Up: case FL_Up:
ascii = ctrl('P'); break; ascii = ctrl('P'); break;
case FL_Page_Down: case FL_Page_Down:
repeat_num=5; //temporary hack fl_font(textfont(),textsize());
//TODO: find number of lines in window and use it instead 5 repeat_num=h()/fl_height();
if (!repeat_num) repeat_num=1;
case FL_Down: case FL_Down:
ascii = ctrl('N'); break; ascii = ctrl('N'); break;
case FL_Home: case FL_Home:
@@ -202,18 +204,20 @@ int Fl_Input::handle_key() {
return copy_cuts(); return copy_cuts();
case ctrl('N'): case ctrl('N'):
i = position(); i = position();
if (line_end(i) >= size()) return NORMAL_INPUT_MOVE;
while (repeat_num--) { while (repeat_num--) {
i = line_end(i); i = line_end(i);
if (i >= size()) return NORMAL_INPUT_MOVE; if (i >= size()) break;
i++; i++;
} }
shift_up_down_position(i); shift_up_down_position(i);
return 1; return 1;
case ctrl('P'): case ctrl('P'):
i = position(); i = position();
if (!line_start(i)) return NORMAL_INPUT_MOVE;
while(repeat_num--) { while(repeat_num--) {
i = line_start(i); i = line_start(i);
if (!i) return NORMAL_INPUT_MOVE; if (!i) break;
i--; i--;
} }
shift_up_down_position(line_start(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$".
// //