basic windows compatibility
parent
288f8fd35a
commit
067482918f
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue