changeset 42:b76918e3e77c default tip

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 18 May 2025 14:37:06 -0600
parents f7e8c1f532c8
children
files src/luan_editor/window.luan
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan_editor/window.luan	Sat May 17 22:20:57 2025 -0600
+++ b/src/luan_editor/window.luan	Sun May 18 14:37:06 2025 -0600
@@ -64,7 +64,7 @@
 
 local list_view = new_panel{
 	--layout = new_mig_layout("insets 0,wrap,fill")
-	layout = new_mig_layout("wrap","[grow]")
+	layout = new_mig_layout("wrap,debug","[grow]")
 }
 local list_scroll_pane = new_scroll_pane{
 	view = list_view
@@ -74,6 +74,7 @@
 	content_pane = list_scroll_pane
 }
 local list_group = new_button_group()
+
 local function new_list_window_item(text)
 	local rb = new_radio_button{
 		constraints = "grow"
@@ -87,6 +88,12 @@
 	list_window.pack()
 	return rb
 end
+local function remove_list_window_item(list_window_item)
+	list_view.remove(list_window_item)
+	list_group.remove(list_window_item)
+	list_window.pack()
+	list_window.repaint()
+end
 
 local function new_window(file,document)
 	local window = {}
@@ -159,6 +166,7 @@
 		if n_windows == 0 then
 			Luan.exit()
 		end
+		remove_list_window_item(window.list_window_item)
 	end)
 	frame.add_resize_stopped_listener( 200, function()
 		--logger.info(stringify(frame.size))
@@ -176,9 +184,9 @@
 			s = s.." *"
 		end
 		frame.title = s
-		new_list_window_item(title)
 	end
 	set_title()
+	window.list_window_item = new_list_window_item(title)
 	window.set_title = set_title  -- dont gc
 	text_area.document.add_undo_listener(set_title)
 	window.new = new_window