Add help info when pressing <Esc> when editing
parent
55eaafb7da
commit
565a61047d
|
@ -239,7 +239,7 @@ function scroll(ed::Editor)
|
||||||
|
|
||||||
# Horizontal scrolling
|
# Horizontal scrolling
|
||||||
if ed.csr.rx < ed.coloff+1
|
if ed.csr.rx < ed.coloff+1
|
||||||
ed.coloff = ed.csr.rx
|
ed.coloff = ed.csr.rx-1
|
||||||
end
|
end
|
||||||
if ed.csr.rx >= ed.coloff+1 + ed.width
|
if ed.csr.rx >= ed.coloff+1 + ed.width
|
||||||
ed.coloff = ed.csr.rx - ed.width
|
ed.coloff = ed.csr.rx - ed.width
|
||||||
|
@ -394,7 +394,9 @@ end
|
||||||
function processKeypress(ed::Editor)
|
function processKeypress(ed::Editor)
|
||||||
c = readKey();
|
c = readKey();
|
||||||
|
|
||||||
if c == ctrl_key('p')
|
if c == UInt32('\x1b') # Esc
|
||||||
|
setStatusMessage(ed, "Press ctrl-q to quit")
|
||||||
|
elseif c == ctrl_key('p')
|
||||||
runCommand(ed)
|
runCommand(ed)
|
||||||
elseif (c == ARROW_LEFT
|
elseif (c == ARROW_LEFT
|
||||||
|| c == ARROW_UP
|
|| c == ARROW_UP
|
||||||
|
@ -420,13 +422,12 @@ function processKeypress(ed::Editor)
|
||||||
elseif c == ctrl_key('l')
|
elseif c == ctrl_key('l')
|
||||||
# Refresh screen
|
# Refresh screen
|
||||||
return
|
return
|
||||||
elseif c == UInt32('\x1b')
|
|
||||||
return
|
|
||||||
elseif iscntrl(Char(c)) && isKeyBound(Char(c))
|
elseif iscntrl(Char(c)) && isKeyBound(Char(c))
|
||||||
runCommand(ed, getKeyBinding(Char(c)))
|
runCommand(ed, getKeyBinding(Char(c)))
|
||||||
elseif c == UInt32('\t')
|
elseif c == UInt32('\t')
|
||||||
editorInsertTab(ed)
|
editorInsertTab(ed)
|
||||||
elseif !iscntrl(Char(c))
|
elseif !iscntrl(Char(c)) && c < 1000
|
||||||
|
# Chars above 1000 are a ::Key, see src/terminal.jl
|
||||||
editorInsertChar(ed, c)
|
editorInsertChar(ed, c)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue