diff --git a/0013-on.keychord_press b/0013-on.keychord_press index 91c6e41..e54631b 100644 --- a/0013-on.keychord_press +++ b/0013-on.keychord_press @@ -5,7 +5,8 @@ on.keychord_press = function(chord, key) update_font_settings(Current_pane.editor_state.font_height-2) elseif chord == 'C-0' then update_font_settings(20) - else + elseif Current_pane.editor_state.cursor_x then + -- send keys to editor if cursor is visible edit.keychord_press(Current_pane.editor_state, chord, key) end end \ No newline at end of file diff --git a/0014-on.text_input b/0014-on.text_input index 024a17a..db24378 100644 --- a/0014-on.text_input +++ b/0014-on.text_input @@ -1,3 +1,5 @@ on.text_input = function(t) - edit.text_input(Current_pane.editor_state, t) + if Current_pane.editor_state.cursor_x then + edit.text_input(Current_pane.editor_state, t) + end end \ No newline at end of file diff --git a/0015-on.key_release b/0015-on.key_release index c39befd..c079053 100644 --- a/0015-on.key_release +++ b/0015-on.key_release @@ -1,3 +1,5 @@ on.key_release = function(key, scancode) - edit.key_release(Current_pane.editor_state, key, scancode) + if Current_pane.editor_state.cursor_x then + edit.key_release(Current_pane.editor_state, key, scancode) + end end \ No newline at end of file diff --git a/edit.lua b/edit.lua index 3cd8e51..a6aa46a 100644 --- a/edit.lua +++ b/edit.lua @@ -109,7 +109,6 @@ end -- return y drawn until function edit.draw(State, fg, hide_cursor, show_line_numbers) assert(#State.lines == #State.line_cache, ('line_cache is out of date; %d elements when it should be %d'):format(#State.line_cache, #State.lines)) - assert(Text.le1(State.screen_top1, State.cursor1), ('screen_top (line=%d,pos=%d) is below cursor (line=%d,pos=%d)'):format(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos)) State.cursor_x = nil State.cursor_y = nil local y = State.top