diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkCanvText.c | 4 | ||||
-rw-r--r-- | generic/tkEntry.c | 35 | ||||
-rw-r--r-- | generic/tkTextMark.c | 16 |
3 files changed, 32 insertions, 23 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index f8d0d7b..63ed827 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvText.c,v 1.11 2002/01/17 03:35:00 dgp Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.12 2002/04/05 08:43:22 hobbs Exp $ */ #include <stdio.h> @@ -828,6 +828,8 @@ DisplayCanvText(canvas, itemPtr, display, drawable, x, y, width, height) - (textInfoPtr->insertWidth / 2)), (double) (textPtr->header.y1 + y), &drawableX, &drawableY); + Tk_SetCaretPos(Tk_CanvasTkwin(canvas), drawableX, drawableY, + height); if (textInfoPtr->cursorOn) { Tk_Fill3DRectangle(Tk_CanvasTkwin(canvas), drawable, textInfoPtr->insertBorder, diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 673817b..87a726c 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.27 2002/03/20 22:55:16 dgp Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.28 2002/04/05 08:43:22 hobbs Exp $ */ #include "tkInt.h" @@ -1894,23 +1894,26 @@ DisplayEntry(clientData) * cursor isn't on. Otherwise the selection would hide the cursor. */ - if ((entryPtr->insertPos >= entryPtr->leftIndex) - && (entryPtr->state == STATE_NORMAL) - && (entryPtr->flags & GOT_FOCUS)) { + if ((entryPtr->state == STATE_NORMAL) && (entryPtr->flags & GOT_FOCUS)) { Tk_CharBbox(entryPtr->textLayout, entryPtr->insertPos, &cursorX, NULL, NULL, NULL); - cursorX += entryPtr->layoutX; - cursorX -= (entryPtr->insertWidth)/2; - if (cursorX < xBound) { - if (entryPtr->flags & CURSOR_ON) { - Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->insertBorder, - cursorX, baseY - fm.ascent, entryPtr->insertWidth, - fm.ascent + fm.descent, entryPtr->insertBorderWidth, - TK_RELIEF_RAISED); - } else if (entryPtr->insertBorder == entryPtr->selBorder) { - Tk_Fill3DRectangle(tkwin, pixmap, border, - cursorX, baseY - fm.ascent, entryPtr->insertWidth, - fm.ascent + fm.descent, 0, TK_RELIEF_FLAT); + Tk_SetCaretPos(entryPtr->tkwin, cursorX, baseY - fm.ascent, + fm.ascent + fm.descent); + if (entryPtr->insertPos >= entryPtr->leftIndex) { + cursorX += entryPtr->layoutX; + cursorX -= (entryPtr->insertWidth)/2; + if (cursorX < xBound) { + if (entryPtr->flags & CURSOR_ON) { + Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->insertBorder, + cursorX, baseY - fm.ascent, entryPtr->insertWidth, + fm.ascent + fm.descent, + entryPtr->insertBorderWidth, + TK_RELIEF_RAISED); + } else if (entryPtr->insertBorder == entryPtr->selBorder) { + Tk_Fill3DRectangle(tkwin, pixmap, border, + cursorX, baseY - fm.ascent, entryPtr->insertWidth, + fm.ascent + fm.descent, 0, TK_RELIEF_FLAT); + } } } } diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index ff3ef44..3e97d7f 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextMark.c,v 1.4 1999/12/14 06:52:33 hobbs Exp $ + * RCS: @(#) $Id: tkTextMark.c,v 1.5 2002/04/05 08:43:22 hobbs Exp $ */ #include "tkInt.h" @@ -526,12 +526,16 @@ TkTextInsertDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY) if ((x + halfWidth) < 0) { /* - * The insertion cursor is off-screen. Just return. + * The insertion cursor is off-screen. + * Indicate caret at 0,0 and return. */ + Tk_SetCaretPos(textPtr->tkwin, 0, 0, height); return; } + Tk_SetCaretPos(textPtr->tkwin, x - halfWidth, screenY, height); + /* * As a special hack to keep the cursor visible on mono displays * (or anywhere else that the selection and insertion cursors @@ -542,12 +546,12 @@ TkTextInsertDisplayProc(chunkPtr, x, y, height, baseline, display, dst, screenY) if (textPtr->flags & INSERT_ON) { Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->insertBorder, - x - textPtr->insertWidth/2, y, textPtr->insertWidth, - height, textPtr->insertBorderWidth, TK_RELIEF_RAISED); + x - halfWidth, y, textPtr->insertWidth, height, + textPtr->insertBorderWidth, TK_RELIEF_RAISED); } else if (textPtr->selBorder == textPtr->insertBorder) { Tk_Fill3DRectangle(textPtr->tkwin, dst, textPtr->border, - x - textPtr->insertWidth/2, y, textPtr->insertWidth, - height, 0, TK_RELIEF_FLAT); + x - halfWidth, y, textPtr->insertWidth, height, + 0, TK_RELIEF_FLAT); } } |