Merge pull request #45 from liamg/zsh-fix

Fix for zsh
This commit is contained in:
Liam Galvin 2018-10-28 16:37:08 +00:00 committed by GitHub
commit 5ff67ddfcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 2 deletions

View File

@ -18,6 +18,7 @@ func getConfig() *config.Config {
conf := loadConfigFile() conf := loadConfigFile()
flag.StringVar(&conf.Shell, "shell", conf.Shell, "Specify the shell to use")
flag.BoolVar(&conf.DebugMode, "debug", conf.DebugMode, "Enable debug logging") flag.BoolVar(&conf.DebugMode, "debug", conf.DebugMode, "Enable debug logging")
flag.BoolVar(&conf.Slomo, "slomo", conf.Slomo, "Render in slow motion (useful for debugging)") flag.BoolVar(&conf.Slomo, "slomo", conf.Slomo, "Render in slow motion (useful for debugging)")
flag.BoolVar(&conf.Rendering.AlwaysRepaint, "always-repaint", conf.Rendering.AlwaysRepaint, "Always repaint the window, even when no changes have occurred") flag.BoolVar(&conf.Rendering.AlwaysRepaint, "always-repaint", conf.Rendering.AlwaysRepaint, "Always repaint the window, even when no changes have occurred")

View File

@ -11,6 +11,7 @@ type Config struct {
Rendering RenderingConfig `toml:"rendering"` Rendering RenderingConfig `toml:"rendering"`
Slomo bool `toml:"slomo"` Slomo bool `toml:"slomo"`
ColourScheme ColourScheme `toml:"colours"` ColourScheme ColourScheme `toml:"colours"`
Shell string `toml:"shell"`
} }
type RenderingConfig struct { type RenderingConfig struct {

View File

@ -55,6 +55,26 @@ func (gui *GUI) key(w *glfw.Window, key glfw.Key, scancode int, action glfw.Acti
gui.logger.Debugf("Sending CTRL^C") gui.logger.Debugf("Sending CTRL^C")
gui.terminal.Write([]byte{0x3}) // send EOT gui.terminal.Write([]byte{0x3}) // send EOT
return return
case glfw.KeyD:
gui.logger.Debugf("Sending CTRL^D")
gui.terminal.Write([]byte{0x4}) // send EOT
return
case glfw.KeyH:
gui.logger.Debugf("Sending CTRL^H")
gui.terminal.Write([]byte{0x08})
return
case glfw.KeyJ:
gui.logger.Debugf("Sending CTRL^J")
gui.terminal.Write([]byte{0x0a})
return
case glfw.KeyM:
gui.logger.Debugf("Sending CTRL^M")
gui.terminal.Write([]byte{0x0d})
return
case glfw.KeyX:
gui.logger.Debugf("Sending CTRL^X")
gui.terminal.Write([]byte{0x18})
return
} }
case modsPressed(mods, glfw.ModAlt, glfw.ModShift): case modsPressed(mods, glfw.ModAlt, glfw.ModShift):
modStr = "4" modStr = "4"
@ -199,6 +219,10 @@ func (gui *GUI) key(w *glfw.Window, key glfw.Key, scancode int, action glfw.Acti
}) })
} }
case glfw.KeyEnter: case glfw.KeyEnter:
gui.terminal.Write([]byte{
0x0d,
})
case glfw.KeyKPEnter:
if gui.terminal.IsApplicationCursorKeysModeEnabled() { if gui.terminal.IsApplicationCursorKeysModeEnabled() {
gui.terminal.Write([]byte{ gui.terminal.Write([]byte{
0x1b, 0x1b,
@ -206,7 +230,9 @@ func (gui *GUI) key(w *glfw.Window, key glfw.Key, scancode int, action glfw.Acti
'M', 'M',
}) })
} else { } else {
gui.terminal.Write([]byte{0x0d}) gui.terminal.Write([]byte{
0x0d,
})
} }
case glfw.KeyBackspace: case glfw.KeyBackspace:
gui.terminal.Write([]byte{0x08}) gui.terminal.Write([]byte{0x08})

View File

@ -33,6 +33,10 @@ func main() {
logger.Fatalf("Failed to ascertain your shell: %s", err) logger.Fatalf("Failed to ascertain your shell: %s", err)
} }
if conf.Shell != "" {
shellStr = conf.Shell
}
os.Setenv("TERM", "xterm-256color") // contraversial! easier than installing terminfo everywhere, but obviously going to be slightly different to xterm functionality, so we'll see... os.Setenv("TERM", "xterm-256color") // contraversial! easier than installing terminfo everywhere, but obviously going to be slightly different to xterm functionality, so we'll see...
os.Setenv("COLORTERM", "truecolor") os.Setenv("COLORTERM", "truecolor")

View File

@ -395,7 +395,7 @@ func csiEraseInDisplayHandler(params []string, intermediate string, terminal *Te
terminal.ActiveBuffer().EraseDisplayFromCursor() terminal.ActiveBuffer().EraseDisplayFromCursor()
case "1": case "1":
terminal.ActiveBuffer().EraseDisplayToCursor() terminal.ActiveBuffer().EraseDisplayToCursor()
case "2": case "2", "3":
terminal.ActiveBuffer().EraseDisplay() terminal.ActiveBuffer().EraseDisplay()
default: default:
return fmt.Errorf("Unsupported ED: CSI %s J", n) return fmt.Errorf("Unsupported ED: CSI %s J", n)