1
1
mirror of https://github.com/walles/moar.git synced 2024-11-22 21:50:43 +03:00

Accept ^H as backspace when searching

Fixes #226.
This commit is contained in:
Johan Walles 2024-07-30 20:05:46 +02:00
parent 64352801a8
commit eacddda29e

View File

@ -117,6 +117,16 @@ func (m PagerModeSearch) onKey(key twin.KeyCode) {
}
func (m PagerModeSearch) onRune(char rune) {
m.pager.searchString = m.pager.searchString + string(char)
if char == '\x08' {
// Backspace
if len(m.pager.searchString) == 0 {
return
}
m.pager.searchString = removeLastChar(m.pager.searchString)
} else {
m.pager.searchString = m.pager.searchString + string(char)
}
m.updateSearchPattern()
}