mirror of
https://github.com/Hilbis/Hilbish
synced 2025-04-21 21:13:22 +00:00
Compare commits
3 Commits
698110717a
...
1016b6a4c8
Author | SHA1 | Date | |
---|---|---|---|
|
1016b6a4c8 | ||
0e4b95d9b9 | |||
38d036d96f |
9
main.go
9
main.go
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@ -115,7 +116,13 @@ func main() {
|
||||
|
||||
// Set $SHELL if the user wants to
|
||||
if *setshflag {
|
||||
os.Setenv("SHELL", os.Args[0])
|
||||
os.Setenv("SHELL", "hilbish")
|
||||
|
||||
path, err := exec.LookPath("hilbish")
|
||||
if err == nil {
|
||||
os.Setenv("SHELL", path)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
lr = newLineReader("", false)
|
||||
|
@ -128,15 +128,19 @@ func (rl *Instance) walkHistory(i int) {
|
||||
}
|
||||
|
||||
rl.histOffset += i
|
||||
historyLen := history.Len()
|
||||
if rl.histOffset == 0 {
|
||||
rl.line = []rune(rl.lineBuf)
|
||||
rl.pos = len(rl.lineBuf)
|
||||
} else if rl.histOffset <= -1 {
|
||||
rl.histOffset = 0
|
||||
} else if rl.histOffset > historyLen {
|
||||
// TODO: should this wrap around?s
|
||||
rl.histOffset = 0
|
||||
} else {
|
||||
dedup = true
|
||||
old = string(rl.line)
|
||||
new, err = history.GetLine(history.Len() - rl.histOffset)
|
||||
new, err = history.GetLine(historyLen - rl.histOffset)
|
||||
if err != nil {
|
||||
rl.resetHelpers()
|
||||
print("\r\n" + err.Error() + "\r\n")
|
||||
|
Loading…
x
Reference in New Issue
Block a user