Compare commits

...

3 Commits

Author SHA1 Message Date
TorchedSammy 3f9b230381
chore: update changelog 2022-11-30 14:29:46 -04:00
TorchedSammy b395b70ecd
fix: escape completion prefix if completions are escaped
fixes an issue with duplicated characters when
completing escaped paths
2022-11-30 14:26:43 -04:00
TorchedSammy 06102ebdae
perf: preallocate history slice 2022-11-30 13:20:00 -04:00
3 changed files with 8 additions and 2 deletions

View File

@ -77,7 +77,9 @@ random errors introduced with the new Lua runtime (see [#197])
- `bait.release(name, catcher)` removes `handler` for the named `event` - `bait.release(name, catcher)` removes `handler` for the named `event`
- `exec`, `clear` and `cat` builtin commands - `exec`, `clear` and `cat` builtin commands
- `hilbish.cancel` hook - `hilbish.cancel` hook
- 1st item on history is now inserted when history search menu is opened ([#148])
[#148]: https://github.com/Rosettea/Hilbish/issues/148
[#197]: https://github.com/Rosettea/Hilbish/issues/197 [#197]: https://github.com/Rosettea/Hilbish/issues/197
### Changed ### Changed
@ -158,6 +160,7 @@ will result in the files being completed.
- Fixed grid menu display if cell width ends up being the width of the terminal - Fixed grid menu display if cell width ends up being the width of the terminal
- Cut off item names in grid menu if its longer than cell width - Cut off item names in grid menu if its longer than cell width
- Fix completion search menu disappearing - Fix completion search menu disappearing
- Completion paths having duplicated characters if it's escaped
## [2.0.0-rc1] - 2022-09-14 ## [2.0.0-rc1] - 2022-09-14
This is a pre-release version of Hilbish for testing. To see the changelog, This is a pre-release version of Hilbish for testing. To see the changelog,

View File

@ -161,6 +161,9 @@ func matchPath(query string) ([]string, string) {
entries = append(entries, entry) entries = append(entries, entry)
} }
} }
if !strings.HasPrefix(oldQuery, "\"") {
baseName = escapeFilename(baseName)
}
return entries, baseName return entries, baseName
} }

View File

@ -73,13 +73,13 @@ func newFileHistory(path string) *fileHistory {
} }
} }
itms := []string{""}
lines := strings.Split(string(data), "\n") lines := strings.Split(string(data), "\n")
itms := make([]string, len(lines) - 1)
for i, l := range lines { for i, l := range lines {
if i == len(lines) - 1 { if i == len(lines) - 1 {
continue continue
} }
itms = append(itms, l) itms[i] = l
} }
f, err := os.OpenFile(path, os.O_APPEND | os.O_WRONLY | os.O_CREATE, 0755) f, err := os.OpenFile(path, os.O_APPEND | os.O_WRONLY | os.O_CREATE, 0755)
if err != nil { if err != nil {