fix: infinite loop when navigating history without any history (#268)

fixes #252
native-modules^2
Super 2023-11-02 17:50:36 -04:00 committed by GitHub
parent 78eb657897
commit ee1ed077b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -22,10 +22,8 @@ completed.
navigation of neighboring doc files. navigation of neighboring doc files.
### Fixed ### Fixed
- Return the prefix when calling `hilbish.completions.call` - Fix infinite loop when navigating history without any history. [#252](https://github.com/Rosettea/Hilbish/issues/252)
- Return the prefix when calling `hilbish.completions.call`. [#219](https://github.com/Rosettea/Hilbish/issues/219)
[#219]: https://github.com/Rosettea/Hilbish/issues/219
### Fixed
- Replaced `sed` in-place editing with `grep` and `mv` for compatibility with BSD utils - Replaced `sed` in-place editing with `grep` and `mv` for compatibility with BSD utils
## [2.1.2] - 2022-04-10 ## [2.1.2] - 2022-04-10

View File

@ -156,8 +156,8 @@ func (rl *Instance) walkHistory(i int) {
rl.updateHelpers() rl.updateHelpers()
// In order to avoid having to type j/k twice each time for history navigation, // In order to avoid having to type j/k twice each time for history navigation,
// we walk once again. This only ever happens when we aren't out of bounds. // we walk once again. This only ever happens when we aren't out of bounds and the last history item was not a empty string.
if dedup && old == new { if new != "" && dedup && old == new {
rl.walkHistory(i) rl.walkHistory(i)
} }
} }