Mercurial Hosting > editor
comparison 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 |
comparison
equal
deleted
inserted
replaced
55:77ee3a37475a | 56:6059b4e22d47 |
---|---|
7 local Io = require "luan:Io.luan" | 7 local Io = require "luan:Io.luan" |
8 local new_file = Io.schemes.file or error() | 8 local new_file = Io.schemes.file or error() |
9 local Rpc = require "luan:Rpc.luan" | 9 local Rpc = require "luan:Rpc.luan" |
10 local Swing = require "luan:swing/Swing.luan" | 10 local Swing = require "luan:swing/Swing.luan" |
11 local swing_run = Swing.run or error() | 11 local swing_run = Swing.run or error() |
12 local to_front = Swing.to_front or error() | 12 local swing_run_later = Swing.run_later or error() |
13 local new_window = require "classpath:luan_editor/window.luan" | 13 local Window = require "classpath:luan_editor/Window.luan" |
14 local new_window = Window.new_window or error() | |
15 local open_windows = Window.open_windows or error() | |
14 local Java = require "classpath:luan_editor/Java.luan" | 16 local Java = require "classpath:luan_editor/Java.luan" |
15 local Logging = require "luan:logging/Logging.luan" | 17 local Logging = require "luan:logging/Logging.luan" |
16 local logger = Logging.logger "editor/editor" | 18 local logger = Logging.logger "editor/editor" |
17 | 19 |
18 | 20 |
32 if not contains( e.get_message(), "java.net.BindException" ) then | 34 if not contains( e.get_message(), "java.net.BindException" ) then |
33 e.throw() | 35 e.throw() |
34 end | 36 end |
35 local host = Rpc.remote("localhost",port) | 37 local host = Rpc.remote("localhost",port) |
36 local args = Luan.arg | 38 local args = Luan.arg |
39 local file_paths = {} | |
37 for _, arg in ipairs(args) do | 40 for _, arg in ipairs(args) do |
38 local file = new_file(arg) | 41 local file = new_file(arg) |
39 file = file.canonical().to_string() | 42 file = file.canonical().to_string() |
40 host.open(file) | 43 file_paths[#file_paths+1] = file |
41 end | 44 end |
42 host.to_front() | 45 host.open_windows(file_paths) |
43 host.close() | 46 host.close() |
44 return | 47 return |
45 end | 48 end |
46 function Rpc.functions.open(file_path) | |
47 swing_run(function() | |
48 local file = new_file(file_path) | |
49 new_window(file) | |
50 end) | |
51 end | |
52 function Rpc.functions.to_front() | |
53 swing_run(to_front) | |
54 end | |
55 | 49 |
50 Rpc.functions.open_windows = open_windows | |
56 | 51 |
57 swing_run(function() | 52 swing_run(function() |
58 local args = Luan.arg | 53 local args = Luan.arg |
59 if #args == 0 then | 54 if #args == 0 then |
60 new_window() | 55 new_window() |
64 new_window(file) | 59 new_window(file) |
65 end | 60 end |
66 end | 61 end |
67 end) | 62 end) |
68 | 63 |
69 Rpc.serve_socket(server_socket,nil,false) | 64 Rpc.serve_socket(server_socket,nil,function(socket,fns) |
65 swing_run_later(Rpc.new_server_fn(socket,fns)) | |
66 end) |