summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-10-23 13:21:14 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-10-23 13:21:14 +0000
commitc300426e4cde983c42e40ff97816c77a97a9d8f1 (patch)
tree919ba12478aa3ad78ef92dcd7f21ad6fd17ecce8 /src
parent5953e69de04e4cf2a3d05af2e31eed79cbbbe902 (diff)
Fix Fl_Text_Display cursor drawing bug...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2687 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Text_Display.cxx28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index 12f92ffc8..b030b3ba5 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Text_Display.cxx,v 1.12.2.32 2002/10/23 12:23:39 easysw Exp $"
+// "$Id: Fl_Text_Display.cxx,v 1.12.2.33 2002/10/23 13:21:14 easysw Exp $"
//
// Copyright 2001-2002 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
@@ -736,13 +736,30 @@ int Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) {
char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
const char *lineStr;
+// printf("position_to_xy(pos=%d, X=%p, Y=%p)\n", pos, X, Y);
+
/* If position is not displayed, return false */
- if (pos < mFirstChar || (pos > mLastChar && !empty_vlines()))
+ if (pos < mFirstChar || (pos > mLastChar && !empty_vlines())) {
+// printf(" returning 0\n"
+// " mFirstChar=%d, mLastChar=%d, empty_vlines()=0\n",
+// mFirstChar, mLastChar);
return 0;
+ }
/* Calculate Y coordinate */
- if (!position_to_line(pos, &visLineNum)) return 0;
- if (visLineNum < 0 || visLineNum >= mNBufferLines) return 0;
+ if (!position_to_line(pos, &visLineNum)) {
+// puts(" returning 0\n"
+// " position_to_line()=0");
+ return 0;
+ }
+
+ if (visLineNum < 0 || visLineNum > mNBufferLines) {
+// printf(" returning 0\n"
+// " visLineNum=%d, mNBufferLines=%d\n",
+// visLineNum, mNBufferLines);
+ return 0;
+ }
+
fontHeight = mMaxsize;
*Y = text_area.y + visLineNum * fontHeight;
@@ -2878,6 +2895,7 @@ void Fl_Text_Display::draw(void) {
int X, Y;
if (position_to_xy(mCursorPos, &X, &Y)) draw_cursor(X, Y);
+// else puts("position_to_xy() failed - unable to draw cursor!");
//printf("drew cursor at pos: %d (%d,%d)\n", mCursorPos, X, Y);
mCursorOldY = Y;
fl_pop_clip();
@@ -3008,5 +3026,5 @@ int Fl_Text_Display::handle(int event) {
//
-// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.32 2002/10/23 12:23:39 easysw Exp $".
+// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.33 2002/10/23 13:21:14 easysw Exp $".
//