mirror of https://github.com/Hilbis/Hilbish
Compare commits
2 Commits
83a2ce38ea
...
b65acca903
Author | SHA1 | Date |
---|---|---|
TorchedSammy | b65acca903 | |
TorchedSammy | 08e2951513 |
|
@ -65,6 +65,7 @@ will be ran on startup
|
|||
- Message of the day on startup (`hilbish.motd`), mainly intended as quick
|
||||
small news pieces for releases. It is printed by default. To disable it,
|
||||
set `hilbish.opts.motd` to false.
|
||||
- `hilbish.rawInput` hook for input from the readline library
|
||||
|
||||
### Changed
|
||||
- **Breaking Change:** Upgraded to Lua 5.4.
|
||||
|
|
4
lua.go
4
lua.go
|
@ -48,6 +48,10 @@ func luaInit() {
|
|||
}
|
||||
})
|
||||
|
||||
lr.rl.RawInputCallback = func(r []rune) {
|
||||
hooks.Em.Emit("hilbish.rawInput", string(r))
|
||||
}
|
||||
|
||||
// Add more paths that Lua can require from
|
||||
err := util.DoString(l, "package.path = package.path .. " + requirePaths)
|
||||
if err != nil {
|
||||
|
|
2
main.go
2
main.go
|
@ -116,8 +116,8 @@ func main() {
|
|||
}
|
||||
|
||||
go handleSignals()
|
||||
luaInit()
|
||||
lr = newLineReader("", false)
|
||||
luaInit()
|
||||
// If user's config doesn't exixt,
|
||||
if _, err := os.Stat(defaultConfPath); os.IsNotExist(err) && *configflag == defaultConfPath {
|
||||
// Read default from current directory
|
||||
|
|
|
@ -198,6 +198,8 @@ type Instance struct {
|
|||
|
||||
ViModeCallback func(ViMode)
|
||||
ViActionCallback func(ViAction, []string)
|
||||
|
||||
RawInputCallback func([]rune) // called on all input
|
||||
}
|
||||
|
||||
// NewInstance is used to create a readline instance and initialise it with sane defaults.
|
||||
|
|
|
@ -94,6 +94,7 @@ func (rl *Instance) Readline() (string, error) {
|
|||
|
||||
rl.skipStdinRead = false
|
||||
r := []rune(string(b))
|
||||
rl.RawInputCallback(r[:i])
|
||||
|
||||
if isMultiline(r[:i]) || len(rl.multiline) > 0 {
|
||||
rl.multiline = append(rl.multiline, b[:i]...)
|
||||
|
|
Loading…
Reference in New Issue