few more ansi sequences done

This commit is contained in:
Liam Galvin 2018-06-29 14:51:39 +01:00
parent 49e502cc0b
commit 7d0aebbfc2
3 changed files with 7 additions and 0 deletions

View File

@ -64,6 +64,8 @@ func (gui *GUI) key(w *glfw.Window, key glfw.Key, scancode int, action glfw.Acti
gui.capslock = !gui.capslock gui.capslock = !gui.capslock
case glfw.KeyEnter: case glfw.KeyEnter:
gui.terminal.Write([]byte{0x0a}) gui.terminal.Write([]byte{0x0a})
case glfw.KeyBackspace:
gui.terminal.Write([]byte{0x08})
default: default:
if key >= 0x41 && key <= 0x5a { // A-Z, normalise to lower if key >= 0x41 && key <= 0x5a { // A-Z, normalise to lower
key += 0x20 key += 0x20

BIN
raft

Binary file not shown.

View File

@ -259,6 +259,11 @@ func (terminal *Terminal) Read() error {
terminal.newLine() terminal.newLine()
case 0x0d: case 0x0d:
terminal.position.Col = 0 terminal.position.Col = 0
case 0x08:
// backspace
terminal.position.Col--
case 0x07:
// @todo ring bell
default: default:
// render character at current location // render character at current location
// fmt.Printf("%s\n", string([]byte{b})) // fmt.Printf("%s\n", string([]byte{b}))