From ee1ed077b9157b8e91066f59e12315f3073764d6 Mon Sep 17 00:00:00 2001 From: Super <38338700+superpowers04@users.noreply.github.com> Date: Thu, 2 Nov 2023 17:50:36 -0400 Subject: [PATCH] fix: infinite loop when navigating history without any history (#268) fixes #252 --- CHANGELOG.md | 6 ++---- readline/history.go | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a5250f..d8f5cf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,10 +22,8 @@ completed. navigation of neighboring doc files. ### Fixed -- Return the prefix when calling `hilbish.completions.call` - -[#219]: https://github.com/Rosettea/Hilbish/issues/219 -### Fixed +- 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) - Replaced `sed` in-place editing with `grep` and `mv` for compatibility with BSD utils ## [2.1.2] - 2022-04-10 diff --git a/readline/history.go b/readline/history.go index f772813..e226b4d 100644 --- a/readline/history.go +++ b/readline/history.go @@ -156,8 +156,8 @@ func (rl *Instance) walkHistory(i int) { rl.updateHelpers() // 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. - if dedup && old == new { + // 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 new != "" && dedup && old == new { rl.walkHistory(i) } }