mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-05 04:36:07 +00:00
feat(textarea): auto-calculate inner X/Y cursor offset
This commit is contained in:
@@ -1443,7 +1443,9 @@ func Blink() tea.Msg {
|
||||
// false.
|
||||
func (m Model) Cursor() *tea.Cursor {
|
||||
lineInfo := m.LineInfo()
|
||||
x, y := lineInfo.CharOffset, m.cursorLineNumber()-m.viewport.YOffset
|
||||
w := lipgloss.Width
|
||||
x := lineInfo.CharOffset + w(m.promptView(0)) + w(m.lineNumberView(0, false))
|
||||
y := m.cursorLineNumber() - m.viewport.YOffset
|
||||
|
||||
c := tea.NewCursor(x, y)
|
||||
c.Blink = m.Styles.Cursor.Blink
|
||||
|
||||
Reference in New Issue
Block a user