mirror of https://github.com/fltk/fltk
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
This commit is contained in:
parent
aa9f41e7d8
commit
56347777a1
|
@ -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 $".
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue