finally track down the bug in estimating height of the command palette

This commit is contained in:
Kartik K. Agaram 2022-12-27 19:10:11 -08:00
parent 71c271bb35
commit e87085ee41
5 changed files with 35 additions and 1 deletions

1
0676-manifest Normal file
View File

@ -0,0 +1 @@
{"line_height":365,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"on.initialize":506,"draw_manifest_navigator":618,"vy":546,"reset_manifest_navigator":621,"A":507,"load_from_iterator":670,"get_definition_from_app":624,"B":379,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"sy":469,"text_input_on_manifest_navigator":634,"draw_cursor":639,"manifest_index":637,"manifest_navigator_candidates":638,"on.draw":565,"add_def_to_menu":640,"sx":544,"tick_spec":660,"vx":545,"update_editor_box":570,"on.key_release":552,"on.mouse_press":617,"schema1_of_y":667,"Manifest":494,"mouse_cursor":558,"on.mouse_release":554,"on.keychord_press":666,"set_mouse_cursor":562,"draw_ticks":663,"font":353,"order_of_magnitude":573,"Viewport":604,"add_thick_line":400,"approximate":579,"load_definition":674,"on_handle":547,"approximate_up":658,"parent":675,"Manifest_navigator":495,"scale":7,"box_height":345,"load_manifest":496,"compute_layout":385,"new_definition":671,"copy_shape":396,"on.code_change":306,"Definitions":503,"Ticks_font":669,"num_lines_for_manifest_navigator":676,"Menu_background_color":611,"manifest_coord":636,"on_text":539,"Surface":422,"initialize_editor":450,"Cursor_node":172,"y_of_schema1":364,"keychord_press_on_manifest_navigator":675,"on.update":561,"Mouse_cursor":559,"Page":475,"on.text_input":521,"maybe_update_key_in_definitions":529,"get_manifest":497,"on":1}

View File

@ -0,0 +1,13 @@
num_lines_for_manifest_navigator = function(candidates)
local result = 1
local x = 5
for i,def in ipairs(candidates) do
local width = App.width(to_hud_text(def))
if x + width > App.screen.width - 5 then
result = result+1
x = 5
end
x = x + width + 30
end
return result
end

View File

@ -0,0 +1,19 @@
draw_manifest_navigator = function()
App.color(Menu_command_color)
local filter_text = to_hud_text(Manifest_navigator.filter)
App.screen.draw(filter_text, 5, 5)
draw_cursor(5 + App.width(filter_text), 5)
if Manifest_navigator.num_lines == nil then
Manifest_navigator.num_lines = num_lines_for_manifest_navigator(Manifest_navigator.candidates)
end
App.color(Menu_background_color)
love.graphics.rectangle('fill', 0,Menu_bar_height, App.screen.width, Manifest_navigator.num_lines * (HUD_line_height + --[[highlight padding]]5))
local x,y = 5, Menu_bar_height
for i,definition in ipairs(Manifest_navigator.candidates) do
x,y = add_def_to_menu(x,y, definition, i == Manifest_navigator.index)
if Menu_cursor >= App.screen.width - 5 then
break
end
end
Manifest_navigator.bottom_y = y + HUD_line_height + --[[highlight padding]] 5
end

1
0677-manifest Normal file
View File

@ -0,0 +1 @@
{"line_height":365,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":641,"add_hotkey_to_menu":616,"on.initialize":506,"draw_manifest_navigator":677,"vy":546,"reset_manifest_navigator":621,"A":507,"load_from_iterator":670,"get_definition_from_app":624,"B":379,"manifest_navigator_up":628,"manifest_navigator_down":635,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"sy":469,"text_input_on_manifest_navigator":634,"draw_cursor":639,"manifest_index":637,"manifest_navigator_candidates":638,"on.draw":565,"add_def_to_menu":640,"sx":544,"tick_spec":660,"vx":545,"update_editor_box":570,"on.key_release":552,"on.mouse_press":617,"schema1_of_y":667,"Manifest":494,"mouse_cursor":558,"on.mouse_release":554,"on.keychord_press":666,"set_mouse_cursor":562,"draw_ticks":663,"font":353,"order_of_magnitude":573,"Viewport":604,"add_thick_line":400,"approximate":579,"load_definition":674,"on_handle":547,"approximate_up":658,"parent":676,"Manifest_navigator":495,"scale":7,"box_height":345,"load_manifest":496,"compute_layout":385,"new_definition":671,"copy_shape":396,"on.code_change":306,"Definitions":503,"Ticks_font":669,"num_lines_for_manifest_navigator":676,"Menu_background_color":611,"manifest_coord":636,"on_text":539,"Surface":422,"initialize_editor":450,"Cursor_node":172,"y_of_schema1":364,"keychord_press_on_manifest_navigator":675,"on.update":561,"Mouse_cursor":559,"Page":475,"on.text_input":521,"maybe_update_key_in_definitions":529,"get_manifest":497,"on":1}

2
head
View File

@ -1 +1 @@
675
677