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=nil,
search_all_progress_indicator=nil,
search_all_pane=nil,
Display_settings.x = Display_settings.search_backup_x
Display_settings.y = Display_settings.search_backup_y
Cursor_pane = deepcopy(Display_settings.search_backup_cursor_pane)
Display_settings.x = Display_settings.state.search_backup_x
Display_settings.y = Display_settings.state.search_backup_y
Cursor_pane = deepcopy(Display_settings.state.search_backup_cursor_pane)
Display_settings.x = Display_settings.search_backup_x
Display_settings.y = Display_settings.search_backup_y
Cursor_pane = deepcopy(Display_settings.search_backup_cursor_pane)
Display_settings.x = Display_settings.state.search_backup_x
Display_settings.y = Display_settings.state.search_backup_y
Cursor_pane = deepcopy(Display_settings.state.search_backup_cursor_pane)
Display_settings.state = {id='normal'}
local len = utf8.len(Display_settings.search_term)
local byte_offset = Text.offset(Display_settings.search_term, len)
Display_settings.search_term = string.sub(Display_settings.search_term, 1, byte_offset-1)
local len = utf8.len(Display_settings.state.search_term)
local byte_offset = Text.offset(Display_settings.state.search_term, len)
Display_settings.state.search_term = string.sub(Display_settings.state.search_term, 1, byte_offset-1)
Display_settings.x = Display_settings.search_backup_x
Display_settings.y = Display_settings.search_backup_y
Cursor_pane = deepcopy(Display_settings.search_backup_cursor_pane)
Display_settings.x = Display_settings.state.search_backup_x
Display_settings.y = Display_settings.state.search_backup_y
Cursor_pane = deepcopy(Display_settings.state.search_backup_cursor_pane)
Display_settings.x = Display_settings.search_backup_x
Display_settings.y = Display_settings.search_backup_y
Cursor_pane = deepcopy(Display_settings.search_backup_cursor_pane)
Display_settings.x = Display_settings.state.search_backup_x
Display_settings.y = Display_settings.state.search_backup_y
Cursor_pane = deepcopy(Display_settings.state.search_backup_cursor_pane)
local len = utf8.len(Display_settings.search_all_query)
local byte_offset = Text.offset(Display_settings.search_all_query, len)
Display_settings.search_all_query = string.sub(Display_settings.search_all_query, 1, byte_offset-1)
--? print('backspace; search_all term is now', Display_settings.search_all_query)
local len = utf8.len(Display_settings.state.search_all_query)
local byte_offset = Text.offset(Display_settings.state.search_all_query, len)
Display_settings.state.search_all_query = string.sub(Display_settings.state.search_all_query, 1, byte_offset-1)
--? print('backspace; search_all term is now', Display_settings.state.search_all_query)
Display_settings.search_all_query = Display_settings.search_all_query..App.get_clipboard()
--? print('paste; search_all term is now', Display_settings.search_all_query)
Display_settings.state.search_all_query = Display_settings.state.search_all_query..App.get_clipboard()
--? print('paste; search_all term is now', Display_settings.state.search_all_query)
Display_settings.search_backup_x = Display_settings.x
Display_settings.search_backup_y = Display_settings.y
Display_settings.search_backup_cursor_pane = deepcopy(Cursor_pane)
-- prepare to pass Display_settings to Text.draw_search_bar
Display_settings.state = {
id='search',
search_term = '',
search_backup_x = Display_settings.x,
search_backup_y = Display_settings.y,
search_backup_cursor_pane = deepcopy(Cursor_pane),
}
-- prepare to pass Display_settings.state to Text.draw_search_bar
Display_settings.state.id = 'search'
Display_settings.search_term = ''
Display_settings.line_height = Line_height
Display_settings.state.font = Display_settings.font
Display_settings.state.line_height = Line_height
Display_settings.state.id = 'search_all'
Display_settings.search_all_pane = initialize_search_all_pane()
Display_settings.search_all_query = ''
Display_settings.search_all_progress_indicator = 'starting search...'
Display_settings.state = {
id='search_all',
search_all_pane = initialize_search_all_pane(),
search_all_query = '',
search_all_progress_indicator = 'starting search...',
}
assert(Display_settings.search_all_query:sub(#Display_settings.search_all_query) == '"', 'you can search for strings in quotes, but only one of them by itself')
Display_settings.search_all_terms = {Display_settings.search_all_query:sub(2, #Display_settings.search_all_query-1)}
assert(Display_settings.state.search_all_query:sub(#Display_settings.state.search_all_query) == '"', 'you can search for strings in quotes, but only one of them by itself')
Display_settings.state.search_all_terms = {Display_settings.state.search_all_query:sub(2, #Display_settings.state.search_all_query-1)}
local column = {name='search: '..Display_settings.search_all_query}
table.insert(column, Display_settings.search_all_pane)
local column = {name='search: '..Display_settings.state.search_all_query}
table.insert(column, Display_settings.state.search_all_pane)
if Display_settings.search_all_progress == nil then
Display_settings.search_all_progress_indicator = 'initialized top-level files'
Display_settings.search_all_progress = {
if Display_settings.state.search_all_progress == nil then
Display_settings.state.search_all_progress_indicator = 'initialized top-level files'
Display_settings.state.search_all_progress = {
elseif Display_settings.search_all_progress.top_level_file_index then
local current_filename = Display_settings.search_all_progress.top_level_files[Display_settings.search_all_progress.top_level_file_index]
Display_settings.search_all_progress_indicator = current_filename
elseif Display_settings.state.search_all_progress.top_level_file_index then
local current_filename = Display_settings.state.search_all_progress.top_level_files[Display_settings.state.search_all_progress.top_level_file_index]
Display_settings.state.search_all_progress_indicator = current_filename
Display_settings.search_all_progress.top_level_file_index = Display_settings.search_all_progress.top_level_file_index+1
if Display_settings.search_all_progress.top_level_file_index > #Display_settings.search_all_progress.top_level_files then
Display_settings.search_all_progress.top_level_file_index = nil
Display_settings.search_all_progress.top_level_files = nil
Display_settings.search_all_progress.time = os.time()
Display_settings.search_all_progress.year = os.date('%Y', Display_settings.search_all_progress.time)
Display_settings.search_all_progress.date = os.date('%Y/%m/%d/', Display_settings.search_all_progress.time)
Display_settings.state.search_all_progress.top_level_file_index = Display_settings.state.search_all_progress.top_level_file_index+1
if Display_settings.state.search_all_progress.top_level_file_index > #Display_settings.state.search_all_progress.top_level_files then
Display_settings.state.search_all_progress.top_level_file_index = nil
Display_settings.state.search_all_progress.top_level_files = nil
Display_settings.state.search_all_progress.time = os.time()
Display_settings.state.search_all_progress.year = os.date('%Y', Display_settings.state.search_all_progress.time)
Display_settings.state.search_all_progress.date = os.date('%Y/%m/%d/', Display_settings.state.search_all_progress.time)
Display_settings.search_all_progress_indicator = Display_settings.search_all_progress.date
local old_year = Display_settings.search_all_progress.year
local date_dir = Directory..Display_settings.search_all_progress.date
Display_settings.state.search_all_progress_indicator = Display_settings.state.search_all_progress.date
local old_year = Display_settings.state.search_all_progress.year
local date_dir = Directory..Display_settings.state.search_all_progress.date
Display_settings.search_all_progress.time = Display_settings.search_all_progress.time - 24*60*60
Display_settings.search_all_progress.year = os.date('%Y', Display_settings.search_all_progress.time)
Display_settings.search_all_progress.date = os.date('%Y/%m/%d/', Display_settings.search_all_progress.time)
if old_year ~= Display_settings.search_all_progress.year then
local previous_year_info = App.file_info(Directory..Display_settings.search_all_progress.year)
Display_settings.state.search_all_progress.time = Display_settings.state.search_all_progress.time - 24*60*60
Display_settings.state.search_all_progress.year = os.date('%Y', Display_settings.state.search_all_progress.time)
Display_settings.state.search_all_progress.date = os.date('%Y/%m/%d/', Display_settings.state.search_all_progress.time)
if old_year ~= Display_settings.state.search_all_progress.year then
local previous_year_info = App.file_info(Directory..Display_settings.state.search_all_progress.year)
load_from_disk(Display_settings.search_all_pane)
Text.redraw_all(Display_settings.search_all_pane)
refresh_pane_height(Display_settings.search_all_pane)
load_from_disk(Display_settings.state.search_all_pane)
Text.redraw_all(Display_settings.state.search_all_pane)
refresh_pane_height(Display_settings.state.search_all_pane)
local success, errmsg = append_to_file(outfilename, 'interrupted at '..Display_settings.search_all_progress_indicator..'\n')
local success, errmsg = append_to_file(outfilename, 'interrupted at '..Display_settings.state.search_all_progress_indicator..'\n')
load_from_disk(Display_settings.search_all_pane)
Text.redraw_all(Display_settings.search_all_pane)
load_from_disk(Display_settings.state.search_all_pane)
Text.redraw_all(Display_settings.state.search_all_pane)