mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
widget: use byte length when comparing with caret position
Fixes misaligned carets when the Editor text contains code points represented by multiple UTF-8 bytes. Line lengths should be measured in bytes instead of glyphs for caret positioning. Signed-off-by: tainted-bit <sourcehut@taintedbit.com>
This commit is contained in:
+1
-1
@@ -483,7 +483,7 @@ loop:
|
|||||||
l := e.lines[carLine]
|
l := e.lines[carLine]
|
||||||
y += (prevDesc + l.Ascent).Ceil()
|
y += (prevDesc + l.Ascent).Ceil()
|
||||||
prevDesc = l.Descent
|
prevDesc = l.Descent
|
||||||
if carLine == len(e.lines)-1 || idx+len(l.Layout) > e.rr.caret {
|
if carLine == len(e.lines)-1 || idx+l.Len > e.rr.caret {
|
||||||
for _, g := range l.Layout {
|
for _, g := range l.Layout {
|
||||||
if idx == e.rr.caret {
|
if idx == e.rr.caret {
|
||||||
break loop
|
break loop
|
||||||
|
|||||||
Reference in New Issue
Block a user