From 804c3708016e720928bca9797c69ff5a315a2d6d 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 f0ceda13..ee905de7 100644 --- a/textarea/textarea.go +++ b/textarea/textarea.go @@ -1126,7 +1126,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))