still playing around

I'm at least starting to standardize on an easy check for whether the
cursor is visible: cursor_x and cursor_y both remain nil.
This commit is contained in:
Kartik K. Agaram 2022-08-16 21:36:08 -07:00
parent 8d96db3f3e
commit 18f6d56c88
2 changed files with 3 additions and 16 deletions

View File

@ -131,6 +131,7 @@ end
function edit.draw(State)
App.color(Text_color)
assert(#State.lines == #State.line_cache)
State.cursor_x = nil
State.cursor_y = nil
local y = State.top
--? print('== draw')

View File

@ -316,7 +316,6 @@ function plan_draw(options)
body_sy = body_sy + 5+Line_height+5
end
if should_update_screen_top(column_index, pane_index, pane, options) then
if column_index == 5 then print('aa') end
if body_sy < Display_settings.y then
pane.screen_top1, y_offset = schema1_of_y(pane, Display_settings.y - body_sy)
else
@ -325,16 +324,11 @@ function plan_draw(options)
end
if column_index == 5 then print('0', body_sy, Display_settings.y, pane.top, Header_height, y_offset) end
if body_sy < Display_settings.y then
if column_index == 5 then print('a') end
pane.top = 0
else
if column_index == 5 then print('b') end
pane.top = body_sy - Display_settings.y + Margin_above
pane.top = body_sy - Display_settings.y
end
--? pane.top = math.max(0, body_sy - Display_settings.y + Margin_above)
if column_index == 5 then print('c', pane.top) end
pane.top = Header_height + pane.top - y_offset
if column_index == 5 then print('d', pane.top) end
--? print('bounds: =>', pane.top)
pane.left = sx - Display_settings.x
pane.right = pane.left + Display_settings.column_width
@ -1102,15 +1096,7 @@ end
function keychord_pressed_on_editable_pane(pane, chord, key)
-- ignore if cursor is not visible on screen
if pane.cursor_x < 0 or pane.cursor_x >= App.screen.width then
panning_keychord_pressed(chord, key)
return
end
--? if pane.cursor_y + pane.line_height > App.screen.height then
--? print('chord:', pane.cursor_y,'+',pane.line_height, '>', App.screen.height, 'stop')
--? return
--? end
if pane.cursor_y < Header_height or pane.cursor_y > App.screen.height then
if pane.cursor_x == nil or pane.cursor_y == nil then
panning_keychord_pressed(chord, key)
return
end