diff options
author | bll <brad.lanam.comp@gmail.com> | 2018-08-31 15:31:13 (GMT) |
---|---|---|
committer | bll <brad.lanam.comp@gmail.com> | 2018-08-31 15:31:13 (GMT) |
commit | 719b08aa89350bc93dea8fac0e46fa6f7f088617 (patch) | |
tree | 35b28eb756c2ecc293f62e90282a1804b2a261fb /generic/ttk | |
parent | fa8093356c913601f7a50d70a0c2d8a03cca08d7 (diff) | |
download | tk-719b08aa89350bc93dea8fac0e46fa6f7f088617.zip tk-719b08aa89350bc93dea8fac0e46fa6f7f088617.tar.gz tk-719b08aa89350bc93dea8fac0e46fa6f7f088617.tar.bz2 |
bugfix branch for: [6fcaaa6f80]
Fix position of insertion cursor for ttk entry. Patch provided by Csaba Nemethi.
Diffstat (limited to 'generic/ttk')
-rw-r--r-- | generic/ttk/ttkEntry.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 83f1a38..f476dc9 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1257,9 +1257,16 @@ static void EntryDisplay(void *clientData, Drawable d) /* @@@ should: maybe: SetCaretPos even when blinked off */ Tk_SetCaretPos(tkwin, cursorX, cursorY, cursorHeight); + cursorX -= cursorWidth/2; + if (cursorX < textarea.x) { + cursorX = textarea.x; + } else if (cursorX + cursorWidth > textarea.x + textarea.width) { + cursorX = textarea.x + textarea.width - cursorWidth; + } + gc = EntryGetGC(entryPtr, es.insertColorObj, clipRegion); XFillRectangle(Tk_Display(tkwin), d, gc, - cursorX-cursorWidth/2, cursorY, cursorWidth, cursorHeight); + cursorX, cursorY, cursorWidth, cursorHeight); XSetClipMask(Tk_Display(tkwin), gc, None); Tk_FreeGC(Tk_Display(tkwin), gc); } |