git.haldean.org e / 833b8ca
make backspace work in find window haldean 1 year, 5 months ago
2 changed file(s) with 10 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
119119 method handlekey*(this: FindBuf, k: Key): bool =
120120 if k.isEscape():
121121 return false
122 let c = toChar(k)
123 if isNone(c):
124 return false
125 this.search = this.search & c.get()
122 if k.isBackspace():
123 this.search = this.search.substr(0, this.search.len - 2)
124 else:
125 let c = toChar(k)
126 if isNone(c):
127 return false
128 this.search = this.search & c.get()
126129 this.refresh()
127130 return true
1212 proc isEscape*(k: Key): bool =
1313 return illwill.Key(k) == illwill.Key.Escape
1414
15 proc isBackspace*(k: Key): bool =
16 return illwill.Key(k) == illwill.Key.Backspace
17
1518 proc toIllwill*(k: Key): illwill.Key = illwill.Key(k)