SJXIMERSV47SKYWCC5TA7TFGRWNN27S5FJE2PS5D46T5HOUN3V2AC -- Cursor in the file dialog is always at end of input text.-- Cache where we start rendering the input from-- (for narrow devices)File_dialog_input_draw_suffix = ''
refresh_file_dialog_input_start = function()local len = utf8.len(File_dialog_input_text)for start=0,len dolocal s = File_dialog_input_text:sub(start)if App.width(s) < Safe_width-Menu_left-15-15 thenFile_dialog_input_draw_suffix = sreturnendendassert(false, "refresh_file_dialog_input_start isn't working right")end
refresh_file_dialog_start = function()end
-- Cursor in the file dialog is always at end of input text.-- Cache where we start rendering the input from-- (for narrow devices)File_dialog_input_start_suffix = ''
reset_file_dialog_state = function()Show_file_dialog = falseFile_dialog_callback = nilFile_dialog_input_text = ''end
File_dialog_input_text = ''
text_input_on_file_dialog = function(t)-- the file dialog input only supports appendingFile_dialog_input_text = File_dialog_input_text..trefresh_file_dialog_input_start()end
keychord_press_on_file_dialog = function(chord, key)if chord == 'escape' thenreset_file_dialog_state()elseif chord == 'return' thenFile_dialog_callback(File_dialog_input_text)reset_file_dialog_state()elseif chord == 'backspace' thenlocal len = utf8.len(File_dialog_input_text)local byte_offset = Text.offset(File_dialog_input_text, len)File_dialog_input_text = string.sub(File_dialog_input_text, 1, byte_offset-1)refresh_file_dialog_input_start()endend
draw_cursor = function(x, y, line_height)-- blink every 0.5sif math.floor(Cursor_time*2)%2 == 0 thenApp.color(Cursor_color)love.graphics.rectangle('fill', x,y, 3,line_height)endend
draw_file_dialog_input = function()-- draw a suffix to ensure the cursor is visibleApp.color(Normal_color)love.graphics.print(File_dialog_input_draw_suffix, Menu_left+15, Menu_top+5)local w = App.width(File_dialog_input_draw_suffix)draw_cursor(Menu_left+15+w, Menu_top+5, Current_pane.editor_state.line_height)end