Compare commits

...

3 Commits

Author SHA1 Message Date
cathalogue 698110717a
Merge d47d23ea3e into 38d036d96f 2024-06-14 20:34:51 +01:00
leath-dub d47d23ea3e moved linux and freebsd file to a single unix file 2024-06-14 19:34:42 +01:00
sammyette 38d036d96f
fix: history navigation going out of bounds 2024-06-14 08:23:20 -04:00
3 changed files with 8 additions and 25 deletions

View File

@ -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")

View File

@ -1,21 +0,0 @@
// +build linux
package main
// String vars that are free to be changed at compile time
var (
requirePaths = commonRequirePaths + `.. ';'
.. hilbish.dataDir .. '/libs/?/init.lua;'
.. hilbish.dataDir .. '/libs/?/?.lua;'` + linuxUserPaths
linuxUserPaths = `
.. hilbish.userDir.data .. '/hilbish/libs/?/init.lua;'
.. hilbish.userDir.data .. '/hilbish/libs/?/?.lua;'
.. hilbish.userDir.data .. '/hilbish/libs/?.lua;'
.. hilbish.userDir.config .. '/hilbish/?/init.lua;'
.. hilbish.userDir.config .. '/hilbish/?/?.lua;'
.. hilbish.userDir.config .. '/hilbish/?.lua'`
dataDir = "/usr/local/share/hilbish"
preloadPath = dataDir + "/nature/init.lua"
sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
defaultConfDir = ""
)

View File

@ -1,4 +1,4 @@
// +build freebsd
// +build linux freebsd
package main
@ -6,8 +6,8 @@ package main
var (
requirePaths = commonRequirePaths + `.. ';'
.. hilbish.dataDir .. '/libs/?/init.lua;'
.. hilbish.dataDir .. '/libs/?/?.lua;'` + freebsdUserPaths
freebsdUserPaths = `
.. hilbish.dataDir .. '/libs/?/?.lua;'` + unixUserPaths
unixUserPaths = `
.. hilbish.userDir.data .. '/hilbish/libs/?/init.lua;'
.. hilbish.userDir.data .. '/hilbish/libs/?/?.lua;'
.. hilbish.userDir.data .. '/hilbish/libs/?.lua;'