diff --git a/src/editor.jl b/src/editor.jl index 5433c36..0ccbfbb 100644 --- a/src/editor.jl +++ b/src/editor.jl @@ -314,6 +314,7 @@ function refreshScreen(ed::Editor) # Update terminal size ed.height = Base.Terminals.height(ed.term) - 2 # status + msg bar = 2 + @static is_windows() ? (ed.height -= 1) : ed.height ed.width = Base.Terminals.width(ed.term) scroll(ed) diff --git a/src/terminal.jl b/src/terminal.jl index 1c1f3c9..97a1295 100644 --- a/src/terminal.jl +++ b/src/terminal.jl @@ -1,7 +1,7 @@ import Base.== @enum(Key, - BACKSPACE = 127, + BACKSPACE = (@static is_windows() ? 8 : 127), ARROW_LEFT = 1000, ARROW_RIGHT, ARROW_UP, @@ -27,6 +27,16 @@ import Base.== ctrl_key(c::Char)::UInt32 = UInt32(c) & 0x1f +# For debugging +function printNextKey() + term = Base.Terminals.TTYTerminal(get(ENV, "TERM", @static is_windows() ? "" : "dumb"), STDIN, STDOUT, STDERR) + Base.Terminals.raw!(term, true) + c = readNextChar() + print("Code: $(UInt32(c)), Char: $(Char(c))") + Base.Terminals.raw!(term, true) + return nothing +end + readNextChar() = Char(read(STDIN,1)[1]) function readKey() ::UInt32