get rid of an assertion
It's easy for cursor to go off viewport, and that seems fine. Just don't let a cursor off screen receive keys.
This commit is contained in:
parent
5133d7c11f
commit
b0670b84ff
|
@ -5,7 +5,8 @@ on.keychord_press = function(chord, key)
|
||||||
update_font_settings(Current_pane.editor_state.font_height-2)
|
update_font_settings(Current_pane.editor_state.font_height-2)
|
||||||
elseif chord == 'C-0' then
|
elseif chord == 'C-0' then
|
||||||
update_font_settings(20)
|
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)
|
edit.keychord_press(Current_pane.editor_state, chord, key)
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,3 +1,5 @@
|
||||||
on.text_input = function(t)
|
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
|
end
|
|
@ -1,3 +1,5 @@
|
||||||
on.key_release = function(key, scancode)
|
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
|
end
|
1
edit.lua
1
edit.lua
|
@ -109,7 +109,6 @@ end
|
||||||
-- return y drawn until
|
-- return y drawn until
|
||||||
function edit.draw(State, fg, hide_cursor, show_line_numbers)
|
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(#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_x = nil
|
||||||
State.cursor_y = nil
|
State.cursor_y = nil
|
||||||
local y = State.top
|
local y = State.top
|
||||||
|
|
Loading…
Reference in New Issue