diff options
| author | Bill Spitzak <spitzak@gmail.com> | 2000-06-08 07:38:29 +0000 |
|---|---|---|
| committer | Bill Spitzak <spitzak@gmail.com> | 2000-06-08 07:38:29 +0000 |
| commit | 56347777a11be0166aa3a0641a838416ac977f49 (patch) | |
| tree | f964d3e18dafa4d74bb8b5ed8e93029a4e4d370e /src | |
| parent | aa9f41e7d8e6f1e843415fce249426fbd5eedeb3 (diff) | |
Better horizontal scrolling of Fl_Input when cursor is near end of line, restored the selection of all text when Fl_Input::value(x) is done
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1179 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Input_.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index aadbe8924..083a83bed 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input_.cxx,v 1.21.2.6 2000/06/06 18:42:08 mike Exp $" +// "$Id: Fl_Input_.cxx,v 1.21.2.7 2000/06/08 07:38:29 bill Exp $" // // Common input widget routines for the Fast Light Tool Kit (FLTK). // @@ -198,10 +198,13 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) { if (Fl::focus()==this && !was_up_down) up_down_pos = curx; cury = lines*height; int newscroll = xscroll_; - if (expandpos(p, e, buf, 0) < W-1) { - newscroll = 0; - } else if (curx > newscroll+W-20) { + if (curx > newscroll+W-20) { + // figure out scrolling so there is space after the cursor: newscroll = curx+20-W; + // figure out the furthest left we ever want to scroll: + int ex = int(expandpos(p, e, buf, 0))+2-W; + // use minimum of both amounts: + if (ex < newscroll) newscroll = ex; } else if (curx < newscroll+20) { newscroll = curx-20; } @@ -714,7 +717,7 @@ int Fl_Input_::static_value(const char* str, int len) { xscroll_ = yscroll_ = 0; minimal_update(0); } - position(0, 0); + position(0, size()); return 1; } @@ -744,5 +747,5 @@ Fl_Input_::~Fl_Input_() { } // -// End of "$Id: Fl_Input_.cxx,v 1.21.2.6 2000/06/06 18:42:08 mike Exp $". +// End of "$Id: Fl_Input_.cxx,v 1.21.2.7 2000/06/08 07:38:29 bill Exp $". // |
