Skip to content

Commit

Permalink
fix(textarea): respect double-width characters in real cursor position
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Dec 13, 2024
1 parent e91b2f0 commit 06b3e72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion textarea/textarea.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 06b3e72

Please sign in to comment.