fix(textarea): respect double-width characters in real cursor position

This commit is contained in:
Ayman Bagabas
2024-11-13 13:28:48 -05:00
parent c350e79209
commit 804c370801
+1 -1
View File
@@ -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))