comparison src/luan_editor/editor.luan @ 75:7f5b3824f4d4

add Windows
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 18 Jun 2025 18:57:34 -0600
parents 824f6d74b1d4
children
comparison
equal deleted inserted replaced
74:c3b0fba5c2bc 75:7f5b3824f4d4
4 local stringify = Luan.stringify or error() 4 local stringify = Luan.stringify or error()
5 local String = require "luan:String.luan" 5 local String = require "luan:String.luan"
6 local to_number = String.to_number or error() 6 local to_number = String.to_number or error()
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 Thread = require "luan:Thread.luan"
10 local sleep = Thread.sleep or error()
11 local Swing_runner = require "luan:swing/Swing_runner.luan"
12 local swing_run = Swing_runner.run or error()
9 local Launcher = require "luan:swing/Launcher.luan" 13 local Launcher = require "luan:swing/Launcher.luan"
10 local Java = require "classpath:luan_editor/Java.luan" 14 local Java = require "classpath:luan_editor/Java.luan"
11 local Logging = require "luan:logging/Logging.luan" 15 local Logging = require "luan:logging/Logging.luan"
12 local logger = Logging.logger "editor/editor" 16 local logger = Logging.logger "editor/editor"
13 17
14 18
15 local function open(args) 19 local function open(args)
16 local Window = require "classpath:luan_editor/Window.luan" 20 if #args == 0 then
17 local new_window = Window.new_window or error() 21 swing_run( function()
22 local Window = require "classpath:luan_editor/Window.luan"
23 local new_window = Window.new_window or error()
18 24
19 if #args == 0 then 25 new_window()
20 new_window() 26 end )
21 else 27 else
22 for _, arg in ipairs(args) do 28 for _, arg in ipairs(args) do
23 local file = new_file(arg) 29 local file = new_file(arg)
24 new_window(file) 30 swing_run( function()
31 local Window = require "classpath:luan_editor/Window.luan"
32 local new_window = Window.new_window or error()
33
34 new_window(file)
35 end )
36 sleep(100)
25 end 37 end
26 end 38 end
27 end 39 end
28 40
29 local function reopen(args) 41 local function reopen(args)
30 local Window = require "classpath:luan_editor/Window.luan" 42 if #args == 0 then
31 local open_windows = Window.open_windows or error() 43 swing_run( function()
44 local Window = require "classpath:luan_editor/Window.luan"
45 local open_window = Window.open_window or error()
32 46
33 open_windows(args) 47 open_window(nil)
48 end )
49 else
50 for _, arg in ipairs(args) do
51 swing_run( function()
52 local Window = require "classpath:luan_editor/Window.luan"
53 local open_window = Window.open_window or error()
54
55 open_window(arg)
56 end )
57 sleep(100)
58 end
59 end
34 end 60 end
35 61
36 local port = Java.port 62 local port = Java.port
37 if port ~= nil then 63 if port ~= nil then
38 Launcher.port = to_number(port) or error("bad port: "..port) 64 Launcher.port = to_number(port) or error("bad port: "..port)