Compare commits

..

No commits in common. "f7e725b5b9cf50088726b411c6777f6e7b31a59f" and "1024f9344613576772e79f71455081cd31950b8f" have entirely different histories.

5 changed files with 13 additions and 12 deletions

View File

@ -163,7 +163,6 @@ will result in the files being completed.
- Fix completion search menu disappearing - Fix completion search menu disappearing
- Completion paths having duplicated characters if it's escaped - Completion paths having duplicated characters if it's escaped
- Get custom completion command properly to call from Lua - Get custom completion command properly to call from Lua
- Put proper command on the line when using up and down arrow keys to go through command history
## [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

@ -70,7 +70,6 @@ If you're new to nix you should probably read up on how to do that [here](https:
### Prerequisites ### Prerequisites
- [Go 1.17+](https://go.dev) - [Go 1.17+](https://go.dev)
- [Task](https://taskfile.dev/#/) - [Task](https://taskfile.dev/#/)
- **Do go to the link here for the installation of Task. Too much people install taskwarrior, which is the wrong program**
### Build ### Build
First, clone Hilbish. The recursive is required, as some Lua libraries First, clone Hilbish. The recursive is required, as some Lua libraries

View File

@ -123,20 +123,23 @@ func (rl *Instance) walkHistory(i int) {
// When we are exiting the current line buffer to move around // When we are exiting the current line buffer to move around
// the history, we make buffer the current line // the history, we make buffer the current line
if rl.histOffset == 0 && rl.histOffset + i == 1 { if rl.histPos == 0 && (rl.histPos+i) == 1 {
rl.lineBuf = string(rl.line) rl.lineBuf = string(rl.line)
} }
rl.histOffset += i switch rl.histPos + i {
if rl.histOffset == 0 { case 0, history.Len() + 1:
rl.histPos = 0
rl.line = []rune(rl.lineBuf) rl.line = []rune(rl.lineBuf)
rl.pos = len(rl.lineBuf) rl.pos = len(rl.lineBuf)
} else if rl.histOffset <= -1 { return
rl.histOffset = 0 case -1:
} else { rl.histPos = 0
rl.lineBuf = string(rl.line)
default:
dedup = true dedup = true
old = string(rl.line) old = string(rl.line)
new, err = history.GetLine(history.Len() - rl.histOffset) new, err = history.GetLine(history.Len() - rl.histPos - 1)
if err != nil { if err != nil {
rl.resetHelpers() rl.resetHelpers()
print("\r\n" + err.Error() + "\r\n") print("\r\n" + err.Error() + "\r\n")
@ -145,6 +148,7 @@ func (rl *Instance) walkHistory(i int) {
} }
rl.clearLine() rl.clearLine()
rl.histPos += i
rl.line = []rune(new) rl.line = []rune(new)
rl.pos = len(rl.line) rl.pos = len(rl.line)
if rl.pos > 0 { if rl.pos > 0 {

View File

@ -134,7 +134,6 @@ type Instance struct {
// history operating params // history operating params
lineBuf string lineBuf string
histPos int histPos int
histOffset int
histNavIdx int // Used for quick history navigation. histNavIdx int // Used for quick history navigation.
// //

View File

@ -49,7 +49,7 @@ func (rl *Instance) Readline() (string, error) {
// History Init // History Init
// We need this set to the last command, so that we can access it quickly // We need this set to the last command, so that we can access it quickly
rl.histOffset = 0 rl.histPos = 0
rl.viUndoHistory = []undoItem{{line: "", pos: 0}} rl.viUndoHistory = []undoItem{{line: "", pos: 0}}
// Multisplit // Multisplit