mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +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]
|
||||
y += (prevDesc + l.Ascent).Ceil()
|
||||
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 {
|
||||
if idx == e.rr.caret {
|
||||
break loop
|
||||
|
||||
Reference in New Issue
Block a user