changeset 48:ca5ae0a36db7 default tip

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 20 May 2025 20:16:58 -0600 (4 hours ago)
parents f66f704118e3
children
files dev.sh luan_editor.sh src/luan_editor/menu.luan src/luan_editor/window.luan
diffstat 4 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dev.sh	Tue May 20 19:07:30 2025 -0600
+++ b/dev.sh	Tue May 20 20:16:58 2025 -0600
@@ -8,4 +8,4 @@
 . luan string:
 CLASSPATH=$CLASSPATH:$EDITOR_HOME/lib/jortho.jar:$EDITOR_HOME/src
 
-java -Xdock:name="Luan Editor" -classpath $CLASSPATH luan.Luan classpath:luan_editor/editor.luan "$@" 2>&1 | grep --line-buffered -v 'openAndSavePanelService' | tee err
+java -Xdock:name="Luan Editor" -classpath $CLASSPATH luan.Luan classpath:luan_editor/editor.luan "$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' | tee err
--- a/luan_editor.sh	Tue May 20 19:07:30 2025 -0600
+++ b/luan_editor.sh	Tue May 20 20:16:58 2025 -0600
@@ -9,4 +9,4 @@
 
 set +m
 
-java -Xdock:name="Luan Editor" -classpath $CLASSPATH luan.Luan classpath:luan_editor/editor.luan "$@" 2>&1 | grep --line-buffered -v 'openAndSavePanelService' &
+java -Xdock:name="Luan Editor" -classpath $CLASSPATH luan.Luan classpath:luan_editor/editor.luan "$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' &
--- a/src/luan_editor/menu.luan	Tue May 20 19:07:30 2025 -0600
+++ b/src/luan_editor/menu.luan	Tue May 20 20:16:58 2025 -0600
@@ -33,6 +33,13 @@
 		enabled = window.has_file
 		action_listener = action_listener(window.revert)
 	}
+	local view_file_path = new_menu_item{
+		text = "File Path"
+		enabled = window.has_file
+		action_listener = function(_)
+			status_bar.text = window.title()
+		end
+	}
 	local undo = new_menu_item{
 		text = "Undo"
 		accelerator = "meta Z"
@@ -81,6 +88,7 @@
 						action_listener = function(_)
 							if window.save() then
 								revert.set_enabled(true)
+								view_file_path.set_enabled(true)
 							end
 						end
 					}
@@ -224,6 +232,7 @@
 							end
 						end
 					}
+					view_file_path
 				}
 			}
 			new_menu{
--- a/src/luan_editor/window.luan	Tue May 20 19:07:30 2025 -0600
+++ b/src/luan_editor/window.luan	Tue May 20 20:16:58 2025 -0600
@@ -152,7 +152,7 @@
 	end
 	text_area.set_selection(0)
 	local list_window_item = {
-		text = title
+		--text = title
 		window = window
 	}
 	add_list_window_item(list_window_item)
@@ -214,6 +214,7 @@
 			s = s.." *"
 		end
 		frame.title = s
+		list_window_item.text = title
 		list_window_item.foreground_color = is_unedited and black or dark_blue
 		list_view.repaint(list_window_item)
 	end
@@ -221,6 +222,9 @@
 	--window.undo_listener = undo_listener  -- dont gc
 	text_area.document.add_undo_listener(undo_listener)
 	window.new = new_window
+	function window.title()
+		return title
+	end
 	function window.open()
 		local new_file = choose_file{
 			action = "load"
@@ -241,8 +245,9 @@
 				return false
 			end
 			title = file.canonical().to_string()
-			frame.title = title
 			documents[title] = text_area.document
+			window.is_unedited = nil
+			undo_listener()
 		end
 		try
 			file.write_text(text_area.text)