From c969f5ed155c93c55bdbc5a43c17d4876c0ac6eb Mon Sep 17 00:00:00 2001 From: sammy Date: Sun, 22 Dec 2024 08:09:57 -0800 Subject: [PATCH] feat: complete hint text on right arrow (#328) --- CHANGELOG.md | 3 +++ readline/hint.go | 7 +++++++ readline/readline.go | 3 +++ 3 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd848c5..87a7c47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # 🎀 Changelog ## Unreleased +### Added +- Forward/Right arrow key will fill in hint text (#327) + ### Fixed - Skip over file and prevent panic if info cannot be retrieved during file completion (due to permission error or anything else) diff --git a/readline/hint.go b/readline/hint.go index 6c6a67c..d0c54fe 100644 --- a/readline/hint.go +++ b/readline/hint.go @@ -56,3 +56,10 @@ func (rl *Instance) resetHintText() { //rl.hintY = 0 rl.hintText = []rune{} } + +func (rl *Instance) insertHintText() { + if len(rl.hintText) != 0 { + // fill in hint text + rl.insert(rl.hintText) + } +} diff --git a/readline/readline.go b/readline/readline.go index 627bff4..7282071 100644 --- a/readline/readline.go +++ b/readline/readline.go @@ -707,6 +707,9 @@ func (rl *Instance) escapeSeq(r []rune) { rl.renderHelpers() return } + + rl.insertHintText() + if (rl.modeViMode == VimInsert && rl.pos < len(rl.line)) || (rl.modeViMode != VimInsert && rl.pos < len(rl.line)-1) { rl.moveCursorByAdjust(1)