Mercurial Hosting > editor
changeset 55:77ee3a37475a
paste files
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 27 May 2025 22:31:32 -0600 |
parents | dcd7d082196f |
children | 6059b4e22d47 |
files | dev.sh src/luan_editor/menu.luan src/luan_editor/window.luan |
diffstat | 3 files changed, 24 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/dev.sh Sun May 25 15:09:49 2025 -0600 +++ b/dev.sh Tue May 27 22:31:32 2025 -0600 @@ -10,4 +10,6 @@ mkdir -p ~/.luan_editor -java -Dport=56588 -Xdock:name="Luan Editor" -classpath $CLASSPATH luan.Luan classpath:luan_editor/editor.luan "$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' | tee err +set +m + +java -Dport=56588 -Xdock:name="Luan Editor" -classpath $CLASSPATH luan.Luan classpath:luan_editor/editor.luan "$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' | tee err
--- a/src/luan_editor/menu.luan Sun May 25 15:09:49 2025 -0600 +++ b/src/luan_editor/menu.luan Tue May 27 22:31:32 2025 -0600 @@ -97,6 +97,14 @@ action_listener = action_listener(text_area.print) } revert + new_menu_item{ + text = "Paste File(s)" + action_listener = function(_) + if not window.paste_files() then + show_message_dialog(nil,"No files to paste") + end + end + } --[[ new_menu_item{ text = "Test"
--- a/src/luan_editor/window.luan Sun May 25 15:09:49 2025 -0600 +++ b/src/luan_editor/window.luan Tue May 27 22:31:32 2025 -0600 @@ -1,6 +1,7 @@ local Luan = require "luan:Luan.luan" local error = Luan.error local stringify = Luan.stringify or error() +local ipairs = Luan.ipairs or error() local Parsers = require "luan:Parsers.luan" local json_string = Parsers.json_string or error() local json_parse = Parsers.json_parse or error() @@ -32,6 +33,7 @@ local choose_file = File_chooser.awt_choose_file or error() local Option_pane = require "luan:swing/Option_pane.luan" local show_message_dialog = Option_pane.show_message_dialog or error() +local Clipboard = require "luan:swing/Clipboard.luan" local Java = require "classpath:luan_editor/Java.luan" local Logging = require "luan:logging/Logging.luan" local logger = Logging.logger "editor/window" @@ -344,6 +346,17 @@ new.text_area.set_selection( text_area.get_selection() ) end window.show_list_window = show_list_window + function window.paste_files() + --logger.info("paste_files "..stringify(Clipboard.get_files())) + local files = Clipboard.get_files() + if files == nil then + return false + end + for _, file in ipairs(files) do + new_window(file) + end + return true + end add_menu_bar(window) frame.pack() local location = config.location