Mercurial Hosting > editor
changeset 46:1eef35fa48f3 default tip
list window config
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 19 May 2025 20:14:26 -0600 |
parents | 0c83b27bb32d |
children | |
files | src/luan_editor/window.luan |
diffstat | 1 files changed, 20 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
diff -r 0c83b27bb32d -r 1eef35fa48f3 src/luan_editor/window.luan --- a/src/luan_editor/window.luan Mon May 19 17:20:10 2025 -0600 +++ b/src/luan_editor/window.luan Mon May 19 20:14:26 2025 -0600 @@ -58,6 +58,8 @@ config.line_wrap = bool( config.line_wrap, true ) config.whitespace_visible = bool( config.whitespace_visible, false ) config.tab_size = config.tab_size or 4 +config.list_window = config.list_window or {} +config.list_window.size = config.list_window.size or { width=200, height=400 } local function save_config() config_file.write_text( stringify(config).."\n" ) @@ -71,13 +73,25 @@ view = list_view } local list_window = new_dialog{ - --preferred_size = { width=200, height=400 } - size = { width=200, height=400 } - --maximum_size = { width=200, height=400 } + size = config.list_window.size content_pane = list_scroll_pane focusable_window_state = false } +list_window.add_resize_stopped_listener( 200, function() + --logger.info(stringify(list_window.size)) + config.list_window.size = list_window.size + save_config() +end) +list_window.add_move_stopped_listener( 200, function() + --logger.info(stringify(list_window.location)) + config.list_window.location = list_window.location + save_config() +end) local function show_list_window() + local location = config.list_window.location + if location ~= nil then + list_window.location = location + end list_window.visible = true list_scroll_pane.scroll_to_right() end @@ -329,8 +343,9 @@ window.show_list_window = show_list_window add_menu_bar(window) frame.pack() - if config.location ~= nil then - frame.location = config.location + local location = config.location + if location ~= nil then + frame.location = location end frame.visible = true text_area.request_focus_in_window()