fix: better suggestion and overlay movement on key presses (#12)

- support history suggestions for aliases
https://github.com/versenilvis/IRIS/commit/0ae25d05ce0faf8ff2eeee9aa3fbb5889d9ad511
- merge spec and history results
(https://github.com/versenilvis/IRIS/commit/315c94f12bb689ad6b39b1f0ce5e0bdef71f38d5)
- add 25ms pty throttle and optimize ctrl+l
(https://github.com/versenilvis/IRIS/commit/1e603d74c208be00f6b2cb79a628416455711c3a)
- align suggestion menu to col 1
(https://github.com/versenilvis/IRIS/commit/e307b210849af65276e93e1cff8895f3b54937ff)
- resolve zsh ipc fd mismatch and generate autocomplete hooks
(https://github.com/versenilvis/IRIS/pull/12/commits/2199607fad8122ec441ff4b99e562ca62bd948ff)
- fix: eliminate prompt duplication and freeze UI movement during menu
navigation
https://github.com/versenilvis/IRIS/pull/12/commits/6783989a49f0a68d01bad542588983a5c7b597a2
This commit is contained in:
VERSE
2026-07-01 16:11:38 +07:00
committed by GitHub
parent 69eee40248
commit aca3d1670c
8 changed files with 619 additions and 231 deletions
+16 -2
View File
@@ -19,6 +19,16 @@ func GetAlias(name string) (string, bool) {
return val, ok
}
func GetAliasesCopy() map[string]string {
shellAliasesMu.RLock()
defer shellAliasesMu.RUnlock()
cp := make(map[string]string, len(ShellAliases))
for k, v := range ShellAliases {
cp[k] = v
}
return cp
}
// Lookup finds matching suggestions for your input by looking at how many words you typed
// it changes aliases to real commands, finds subcommands inside others, and runs generators for more suggestions
// e.g. Lookup("git che") -> suggests "git checkout"
@@ -131,6 +141,10 @@ func Lookup(input string) []Suggestion {
depth++
continue
}
// invalid subcommand word typed
if len(currentSubs) > 0 {
return nil
}
break
}
@@ -237,7 +251,7 @@ func Lookup(input string) []Suggestion {
}
}
if partial == "" || (len(partial) > 0 && partial[0] == '-') {
if len(partial) > 0 && partial[0] == '-' {
usedOpts := make(map[string]bool)
for _, t := range tokens {
if strings.HasPrefix(t, "-") {
@@ -247,7 +261,7 @@ func Lookup(input string) []Suggestion {
for _, opt := range currentOpts {
if !usedOpts[opt.Name] && (partial == "" || HasPrefix(opt.Name, partial)) {
results = append(results, Suggestion{
Cmd: prefix + " " + opt.Name, Desc: opt.Description, Icon: rootCmdName,
Cmd: linePrefix + " " + opt.Name, Desc: opt.Description, Icon: rootCmdName,
})
}
}
+3
View File
@@ -218,6 +218,9 @@ func GitPushPullGenerator(tokens []string, prefix string, partial string) []core
}
// remote is set, suggest local branches only (no duplicates with origin/xxx)
if len(pArgs) >= 2 {
return nil
}
return gitLocalBranchGenerator(tokens, prefix, partial)
}