Mercurial Hosting > editor
diff src/luan_editor/editor.luan @ 56:6059b4e22d47
almost fix to front
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 28 May 2025 16:02:27 -0600 |
parents | d5681da8ece8 |
children | 824f6d74b1d4 |
line wrap: on
line diff
--- a/src/luan_editor/editor.luan Tue May 27 22:31:32 2025 -0600 +++ b/src/luan_editor/editor.luan Wed May 28 16:02:27 2025 -0600 @@ -9,8 +9,10 @@ local Rpc = require "luan:Rpc.luan" local Swing = require "luan:swing/Swing.luan" local swing_run = Swing.run or error() -local to_front = Swing.to_front or error() -local new_window = require "classpath:luan_editor/window.luan" +local swing_run_later = Swing.run_later or error() +local Window = require "classpath:luan_editor/Window.luan" +local new_window = Window.new_window or error() +local open_windows = Window.open_windows or error() local Java = require "classpath:luan_editor/Java.luan" local Logging = require "luan:logging/Logging.luan" local logger = Logging.logger "editor/editor" @@ -34,25 +36,18 @@ end local host = Rpc.remote("localhost",port) local args = Luan.arg + local file_paths = {} for _, arg in ipairs(args) do local file = new_file(arg) file = file.canonical().to_string() - host.open(file) + file_paths[#file_paths+1] = file end - host.to_front() + host.open_windows(file_paths) host.close() return end -function Rpc.functions.open(file_path) - swing_run(function() - local file = new_file(file_path) - new_window(file) - end) -end -function Rpc.functions.to_front() - swing_run(to_front) -end +Rpc.functions.open_windows = open_windows swing_run(function() local args = Luan.arg @@ -66,4 +61,6 @@ end end) -Rpc.serve_socket(server_socket,nil,false) +Rpc.serve_socket(server_socket,nil,function(socket,fns) + swing_run_later(Rpc.new_server_fn(socket,fns)) +end)