summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2009-09-19 20:57:48 +0000
committerMatthias Melcher <fltk@matthiasm.com>2009-09-19 20:57:48 +0000
commit08dea80a5a03aa90d8f1480b918e5620b36d953a (patch)
treeebd21264979b3946ee8072ce0e4207e897d8375e
parente0103d2dd7069a95b4d387f5eaf1114aaa955f1f (diff)
Fl_Input_: improved draing and warping for large fonts
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6887 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_Input_.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index cd4de2b8c..41881c3ca 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -239,6 +239,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
// count how many lines and put the last one into the buffer:
// And figure out where the cursor is:
int height = fl_height();
+ int threshold = height/2;
int lines;
int curx, cury;
for (p=value(), curx=cury=lines=0; ;) {
@@ -248,15 +249,15 @@ 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 (curx > newscroll+W-20) {
+ if (curx > newscroll+W-threshold) {
// figure out scrolling so there is space after the cursor:
- newscroll = curx+20-W;
+ newscroll = curx+threshold-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;
+ } else if (curx < newscroll+threshold) {
+ newscroll = curx-threshold;
}
if (newscroll < 0) newscroll = 0;
if (newscroll != xscroll_) {