mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-01-12 23:11:05 +03:00
fix(textarea): better SeekInner and SeekAround
This commit is contained in:
parent
3e1a14200c
commit
715108b08b
@ -566,6 +566,11 @@ func (m *Model) findPairRange(r rune) Range {
|
|||||||
var startRune, endRune rune
|
var startRune, endRune rune
|
||||||
|
|
||||||
switch r {
|
switch r {
|
||||||
|
case 'w', 'W':
|
||||||
|
return Range{
|
||||||
|
Start: m.findWordLeft(0, r == 'W'),
|
||||||
|
End: m.findWordEndRight(1, true),
|
||||||
|
}
|
||||||
case '(', ')':
|
case '(', ')':
|
||||||
startRune, endRune = '(', ')'
|
startRune, endRune = '(', ')'
|
||||||
case '{', '}':
|
case '{', '}':
|
||||||
@ -576,6 +581,12 @@ func (m *Model) findPairRange(r rune) Range {
|
|||||||
startRune, endRune = '<', '>'
|
startRune, endRune = '<', '>'
|
||||||
case '"', '\'':
|
case '"', '\'':
|
||||||
startRune, endRune = r, r
|
startRune, endRune = r, r
|
||||||
|
default:
|
||||||
|
m.command = &NormalCommand{}
|
||||||
|
return Range{
|
||||||
|
Start: Position{m.row, m.col},
|
||||||
|
End: Position{m.row, m.col},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Range{
|
return Range{
|
||||||
@ -717,10 +728,7 @@ func (m *Model) deleteRange(r Range) {
|
|||||||
maxCol = min(maxCol+1, len(m.value[r.Start.Row]))
|
maxCol = min(maxCol+1, len(m.value[r.Start.Row]))
|
||||||
} else if m.command.IsSeekingBackward() {
|
} else if m.command.IsSeekingBackward() {
|
||||||
minCol = max(minCol-1, 0)
|
minCol = max(minCol-1, 0)
|
||||||
} else if m.command.Seeking == SeekAround {
|
} else if m.command.Seeking == SeekAround || m.command.Seeking == SeekInner {
|
||||||
maxCol = min(maxCol+1, len(m.value[r.Start.Row]))
|
|
||||||
minCol = max(minCol-1, 0)
|
|
||||||
} else if m.command.Seeking == SeekInner {
|
|
||||||
maxCol = min(maxCol+1, len(m.value[r.Start.Row]))
|
maxCol = min(maxCol+1, len(m.value[r.Start.Row]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user