From 565a61047d6f769b27d70f63d32ca47b201d9f5a Mon Sep 17 00:00:00 2001 From: Nick Paul Date: Wed, 9 Aug 2017 16:17:07 -0400 Subject: [PATCH] Add help info when pressing when editing --- src/editor.jl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/editor.jl b/src/editor.jl index 2a8df1d..19496cb 100644 --- a/src/editor.jl +++ b/src/editor.jl @@ -239,7 +239,7 @@ function scroll(ed::Editor) # Horizontal scrolling if ed.csr.rx < ed.coloff+1 - ed.coloff = ed.csr.rx + ed.coloff = ed.csr.rx-1 end if ed.csr.rx >= ed.coloff+1 + ed.width ed.coloff = ed.csr.rx - ed.width @@ -394,7 +394,9 @@ end function processKeypress(ed::Editor) 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) elseif (c == ARROW_LEFT || c == ARROW_UP @@ -420,13 +422,12 @@ function processKeypress(ed::Editor) elseif c == ctrl_key('l') # Refresh screen return - elseif c == UInt32('\x1b') - return elseif iscntrl(Char(c)) && isKeyBound(Char(c)) runCommand(ed, getKeyBinding(Char(c))) elseif c == UInt32('\t') 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) end