mirror of
https://github.com/tjboldt/Apple2-IO-RPi.git
synced 2024-11-22 02:30:46 +00:00
Merge pull request #96 from tjboldt/fix-vi-arrows
Fixes #94 VT100 arrow keys for application mode
This commit is contained in:
commit
869eb25c11
@ -14,6 +14,7 @@ var escapeSequence string
|
||||
var operatingSystemSequence bool
|
||||
var windowTop int
|
||||
var windowBottom = 23
|
||||
var applicationMode = false
|
||||
|
||||
func sendCharacter(comm A2Io, b byte) {
|
||||
if b == 0x1b {
|
||||
@ -63,11 +64,11 @@ func sendCharacter(comm A2Io, b byte) {
|
||||
switch escapeSequence {
|
||||
// Set/clear application mode for cursor
|
||||
case "^[[?1h":
|
||||
//applicationMode = true
|
||||
applicationMode = true
|
||||
escapeSequence = ""
|
||||
return
|
||||
case "^[[?1l":
|
||||
//applicationMode = false
|
||||
applicationMode = false
|
||||
comm.WriteByte('T')
|
||||
comm.WriteByte(0x00)
|
||||
comm.WriteByte('B')
|
||||
@ -222,6 +223,20 @@ func readCharacter(comm A2Io) (string, error) {
|
||||
b, err := comm.ReadByte()
|
||||
var s = string(b)
|
||||
if err == nil {
|
||||
if applicationMode {
|
||||
switch b {
|
||||
case 0x0b: // up
|
||||
s = "\033OA"
|
||||
case 0x0a: // down
|
||||
s = "\033OB"
|
||||
case 0x15: // right
|
||||
s = "\033OC"
|
||||
case 0x08: // left
|
||||
s = "\033OD"
|
||||
case 0x0d: // return
|
||||
s = string(byte(0x0a))
|
||||
}
|
||||
} else {
|
||||
switch b {
|
||||
case 0x0b: // up
|
||||
s = "\033[A"
|
||||
@ -235,5 +250,6 @@ func readCharacter(comm A2Io) (string, error) {
|
||||
s = string(byte(0x0a))
|
||||
}
|
||||
}
|
||||
}
|
||||
return s, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user