From 06b3e72d67334339f7dbb877e724c8ac010d1d33 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Wed, 13 Nov 2024 13:28:48 -0500 Subject: [PATCH] fix(textarea): respect double-width characters in real cursor position --- textarea/textarea.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textarea/textarea.go b/textarea/textarea.go index db717b47..a9988916 100644 --- a/textarea/textarea.go +++ b/textarea/textarea.go @@ -1191,7 +1191,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { // Ensure the real cursor is at the correct position. row := m.cursorLineNumber() lineInfo := m.LineInfo() - realCol, realRow := m.offsetX+lineInfo.ColumnOffset, m.offsetY+row-m.viewport.YOffset + realCol, realRow := m.offsetX+lineInfo.CharOffset, m.offsetY+row-m.viewport.YOffset if realCol != m.realCol || realRow != m.realRow { m.realCol, m.realRow = realCol, realRow cmds = append(cmds, tea.SetCursorPosition(realCol, realRow))