aboutsummaryrefslogtreecommitdiff
path: root/osx.patch
blob: 90bb007a1b3e96486456dbc75435bd8e6f42cf25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
diff -r 809aab656589 core/init.lua
--- a/core/init.lua	Tue Mar 04 23:06:41 2008 -0500
+++ b/core/init.lua	Tue Mar 04 20:56:03 2008 -0500
@@ -6,7 +6,6 @@ require 'iface'
 require 'iface'
 require 'events'
 require 'file_io'
-require 'lua_dialog'
 
 ---
 -- Checks if the buffer being indexed is the currently focused buffer.
@@ -31,10 +30,13 @@ end
 --   used.
 -- @return string CocoaDialog result.
 function cocoa_dialog(kind, opts)
-  local args = { kind }
+  local args = ''
   for k, v in pairs(opts) do
-    args[#args + 1] = '--'..k
-    if type(v) == 'string' then args[#args + 1] = v end
+    args = args..' --'..k
+    if type(v) == 'string' then args = args..' "'..v..'"' end
   end
-  return lua_dialog.run(args)
+  local p = io.popen('CocoaDialog '..kind..args)
+  local out = p:read('*all')
+  p:close()
+  return out
 end
diff -r 809aab656589 osx.patch
--- a/osx.patch	Tue Mar 04 23:06:41 2008 -0500
+++ b/osx.patch	Tue Mar 04 20:56:03 2008 -0500
@@ -1,231 +0,0 @@
-diff -r 8c3e7e659b6f core/events.lua
---- a/core/events.lua	Fri Nov 16 19:17:44 2007 -0500
-+++ b/core/events.lua	Sat Nov 17 23:19:41 2007 -0500
-@@ -372,11 +372,11 @@ add_handler('quit',
-       end
-     end
-     if any then
--      list = list..'\nQuit without saving?'
--      if os.execute('zenity --question --title Alert '..
--        '--text "'..list..'"') ~= 0 then
--        return false
--      end
-+      if tonumber( cocoa_dialog( 'yesno-msgbox', {
-+        title = 'Save?',
-+        text = 'Save changes before quitting?',
-+        ['informative-text'] = 'You will have to save changes manually.'
-+      } ) ) ~= 2 then return false end
-     end
-     textadept.io.save_session()
-     return true
-diff -r 8c3e7e659b6f core/ext/find.lua
---- a/core/ext/find.lua	Fri Nov 16 19:17:44 2007 -0500
-+++ b/core/ext/find.lua	Sat Nov 17 23:19:41 2007 -0500
-@@ -96,7 +96,11 @@ function find.replace(rtext)
-     function(code)
-       local ret, val = pcall( loadstring('return '..code) )
-       if not ret then
--        os.execute('zenity --error --text "'..val:gsub('"', '\\"')..'"')
-+        cocoa_dialog( 'msgbox', {
-+          title = 'Error',
-+          text = 'An error ocurred:',
-+          ['informative-text'] = val:gsub('"', '\\"')
-+        } )
-         error()
-       end
-       return val
-diff -r 8c3e7e659b6f core/file_io.lua
---- a/core/file_io.lua	Fri Nov 16 19:17:44 2007 -0500
-+++ b/core/file_io.lua	Sat Nov 17 23:19:41 2007 -0500
-@@ -44,11 +44,12 @@ end
- --   specified, the user is prompted to open files from a dialog.
- -- @usage textadept.io.open(filename)
- function open(filenames)
--  if not filenames then
--    local directory = '--filename="'..(buffer.filename or '')..'"'
--    filenames = io.popen('zenity --file-selection --multiple '..
--      directory):read('*all')
--  end
-+  filenames = filenames or cocoa_dialog( 'fileselect', {
-+    title = 'Open',
-+    text = 'Select a file(s) to open',
-+    ['select-multiple'] = true,
-+    --['with-directory'] = (buffer.filename or ''):match('.+/')
-+  } )
-   for filename in filenames:gmatch('[^|\n]+') do open_helper(filename) end
- end
- 
-@@ -100,8 +101,9 @@ function save_as(buffer, filename)
-   textadept.check_focused_buffer(buffer)
-   if not filename then
-     local directory = '--filename="'..(buffer.filename or '')..'"'
--    filename = io.popen('zenity --file-selection --save '..
--      directory..' --confirm-overwrite'):read('*all')
-+    filename = cocoa_dialog( 'filesave', {
-+      title = 'Save'
-+    } )
-   end
-   if #filename > 0 then
-     buffer.filename = filename:sub(1, -2) -- chomp
-@@ -133,10 +135,11 @@ end
- -- @usage buffer:close()
- function close(buffer)
-   textadept.check_focused_buffer(buffer)
--  if buffer.dirty and os.execute('zenity --question --title Alert '..
--    '--text "Close without saving?"') ~= 0 then
--    return false
--  end
-+  if buffer.dirty and tonumber( cocoa_dialog( 'yesno-msgbox', {
-+    title = 'Save?',
-+    text = 'Save changes before closing?',
-+    ['informative-text'] = 'You will have to save changes manually.'
-+  } ) ) ~= 2 then return false end
-   buffer:delete()
-   return true
- end
-diff -r 8c3e7e659b6f core/init.lua
---- a/core/init.lua	Fri Nov 16 19:17:44 2007 -0500
-+++ b/core/init.lua	Sat Nov 17 23:19:41 2007 -0500
-@@ -14,6 +14,23 @@ function textadept.check_focused_buffer(
-   end
- end
- 
-+---
-+-- Displays a CocoaDialog of a specified type with given arguments returning
-+-- the result.
-+-- @param kind The CocoaDialog type.
-+-- @param ... A table of key, value arguments. Each key is a --key switch with
-+--   a "value" value. If value is nil, it is omitted and just the switch is
-+--   used.
-+-- @return string CocoaDialog result.
-+function cocoa_dialog(kind, opts)
-+  local args = ''
-+  for k, v in pairs(opts) do
-+    args = args..' --'..k
-+    if type(v) == 'string' then args = args..' "'..v..'"' end
-+  end
-+  return io.popen('CocoaDialog '..kind..args):read('*all')
-+end
-+
- package.path = package.path..';'.._HOME..'/core/?.lua'
- 
- require 'iface'
-diff -r 8c3e7e659b6f modules/textadept/editing.lua
---- a/modules/textadept/editing.lua	Fri Nov 16 19:17:44 2007 -0500
-+++ b/modules/textadept/editing.lua	Sat Nov 17 23:19:41 2007 -0500
-@@ -219,9 +219,12 @@ function goto_line(line)
- function goto_line(line)
-   local buffer = buffer
-   if not line then
--    line = io.popen('zenity --entry --title "Go To" '..
--      '--text "Line Number:"'):read('*all')
--    if line == '' then return end
-+    line = cocoa_dialog( 'standard-inputbox', {
-+      title = 'Go To',
-+      text = 'Line Number:',
-+      ['no-newline'] = true
-+    } ):match('%d+$')
-+    if not line then return end
-     line = tonumber(line)
-   end
-   buffer:ensure_visible_enforce_policy(line - 1)
-diff -r 8c3e7e659b6f modules/textadept/macros.lua
---- a/modules/textadept/macros.lua	Fri Nov 16 19:17:44 2007 -0500
-+++ b/modules/textadept/macros.lua	Sat Nov 17 23:19:41 2007 -0500
-@@ -66,9 +66,12 @@ function stop_recording()
-   recording = false
-   local textadept = textadept
-   local bf, bp = textadept.buffer_functions, textadept.buffer_properties
--  local macro_name =
--    io.popen('zenity --entry --text "Macro name:"'):read('*all'):sub(1, -2)
--  if #macro_name > 0 then
-+  local macro_name = cocoa_dialog( 'standard-inputbox', {
-+    title = 'Save Macro',
-+    text = 'Macro name:',
-+    ['no-newline'] = true
-+  } )
-+  if macro_name:match('^%d') ~= '2' then
-     for _, command in ipairs(current) do
-       command.type = 'function'
-       local msg = command[1]
-@@ -82,7 +85,7 @@ function stop_recording()
-         end
-       end
-     end
--    list[macro_name] = current
-+    list[ macro_name:match('[^\n]+$') ] = current
-     save()
-     textadept.statusbar_text = 'Macro saved'
-     textadept.events.handle('macro_saved')
-@@ -104,9 +107,13 @@ function play(macro_name)
- function play(macro_name)
-   if not macro_name then
-     local macro_list = ''
--    for name in pairs(list) do macro_list = macro_list..name..' ' end
--    macro_name = io.popen('zenity --list --text "Select a Macro" '..
--      '--column Name '..macro_list):read('*all'):sub(1, -2)
-+    for name in pairs(list) do macro_list = macro_list..'"'..name..'" ' end
-+    macro_name = cocoa_dialog( 'standard-dropdown', {
-+      title = 'Select a Macro',
-+      text = 'Macro name:',
-+      items = macro_list,
-+      ['no-newline'] = true
-+    } )
-   end
-   local macro = list[macro_name]
-   if not macro then return end
-diff -r 8c3e7e659b6f src/Makefile
---- a/src/Makefile	Fri Nov 16 19:17:44 2007 -0500
-+++ b/src/Makefile	Sat Nov 17 23:19:41 2007 -0500
-@@ -2,7 +2,7 @@
- 
- .SUFFIXES: .c .o .h .a
- 
--INCLUDEDIRS=-Iscintilla-st/include
-+INCLUDEDIRS=-Iscintilla-st/include -I/opt/local/include
- ifdef DEBUG
- CXXFLAGS=-DDEBUG -g -DGTK -DSCI_LEXER -W -Wall
- else
-@@ -14,7 +14,7 @@ all: textadept
- 
- .c.o:
- 	g++ `pkg-config --cflags gtk+-2.0` $(INCLUDEDIRS) $(CXXFLAGS) -c $< -o $@
--textadept: textadept.o lua_interface.o pm.o find_replace.o $(LEXEROBJS) scintilla-st/bin/scintilla.a -llua
--	g++ `pkg-config --libs gtk+-2.0 gthread-2.0` -lstdc++ -DGTK $^ -o $@
-+textadept: textadept.o lua_interface.o pm.o find_replace.o $(LEXEROBJS) scintilla-st/bin/scintilla.a
-+	g++ `pkg-config --libs gtk+-2.0 gthread-2.0` -lstdc++ -DGTK -L/opt/local/lib -llua $^ -o $@
- clean:
- 	rm -rf textadept *.o
-diff -r 8c3e7e659b6f src/properties.h
---- a/src/properties.h	Fri Nov 16 19:17:44 2007 -0500
-+++ b/src/properties.h	Sat Nov 17 23:19:41 2007 -0500
-@@ -32,7 +32,7 @@ void set_default_editor_properties(Scint
-   SS(sci, SCI_SETFOLDFLAGS, 16);
-   SS(sci, SCI_SETMODEVENTMASK, SC_MOD_CHANGEFOLD);
- 
--  SS(sci, SCI_SETMARGINWIDTHN, 0, 4 + 2 * // line number margin
-+  SS(sci, SCI_SETMARGINWIDTHN, 0, 4 + 3 * // line number margin
-      SS(sci, SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<long>("9")));
- 
-   SS(sci, SCI_SETMARGINWIDTHN, 1, 0); // marker margin invisible
-diff -r 8c3e7e659b6f src/textadept.c
---- a/src/textadept.c	Fri Nov 16 19:17:44 2007 -0500
-+++ b/src/textadept.c	Sat Nov 17 23:19:41 2007 -0500
-@@ -29,7 +29,7 @@ int main(int argc, char **argv) {
- 
- void create_ui() {
-   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
--  gtk_window_set_default_size(GTK_WINDOW(window), 500, 400);
-+  gtk_window_set_default_size(GTK_WINDOW(window), 700, 1000);
-   signal(window, "delete_event", w_exit);
-   signal(window, "focus-in-event", w_focus);
-   signal(window, "key_press_event", w_keypress);
-@@ -106,7 +106,7 @@ void new_scintilla_buffer(ScintillaObjec
-   // Setup default styling and properties.
-   SS(sci, SCI_STYLESETFONT, 32,
-      reinterpret_cast<long>("!Bitstream Vera Sans Mono"));
--  SS(sci, SCI_STYLESETSIZE, 32, 8);
-+  SS(sci, SCI_STYLESETSIZE, 32, 11);
-   SS(sci, SCI_STYLESETFORE, 32, 0xAA | (0xAA << 8) | (0xAA << 16));
-   SS(sci, SCI_STYLESETBACK, 32, 0x33 | (0x33 << 8) | (0x33 << 16));
-   SS(sci, SCI_SETSTYLEBITS, 8, 0);
diff -r 809aab656589 src/Makefile
--- a/src/Makefile	Tue Mar 04 23:06:41 2008 -0500
+++ b/src/Makefile	Tue Mar 04 20:56:03 2008 -0500
@@ -15,12 +15,12 @@ LUAOBJS=\
 	lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o \
 	lzio.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
 	lstrlib.o loadlib.o linit.o
-EXPORTLUASYMS=-rdynamic -Wl,--retain-symbols-file -Wl,lua.sym
+EXPORTLUASYMS=-rdynamic -Wl,-exported_symbols_list -Wl,lua.sym
 
 all: textadept
 
 $(LUAOBJS): lua/*.c
-	gcc $(INCLUDEDIRS) -DLUA_USE_LINUX $(CXXFLAGS) -c lua/*.c
+	gcc $(INCLUDEDIRS) -DLUA_USE_MACOSX $(CXXFLAGS) -c lua/*.c
 .c.o:
 	g++ $(GTKFLAGS) $(INCLUDEDIRS) $(CXXFLAGS) -c $< -o $@
 textadept:\
diff -r 809aab656589 src/properties.h
--- a/src/properties.h	Tue Mar 04 23:06:41 2008 -0500
+++ b/src/properties.h	Tue Mar 04 20:56:03 2008 -0500
@@ -32,7 +32,7 @@ void set_default_editor_properties(Scint
   SS(sci, SCI_SETFOLDFLAGS, 16);
   SS(sci, SCI_SETMODEVENTMASK, SC_MOD_CHANGEFOLD);
 
-  SS(sci, SCI_SETMARGINWIDTHN, 0, 4 + 2 * // line number margin
+  SS(sci, SCI_SETMARGINWIDTHN, 0, 4 + 3 * // line number margin
      SS(sci, SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<long>("9")));
 
   SS(sci, SCI_SETMARGINWIDTHN, 1, 0); // marker margin invisible
diff -r 809aab656589 src/textadept.c
--- a/src/textadept.c	Tue Mar 04 23:06:41 2008 -0500
+++ b/src/textadept.c	Tue Mar 04 20:56:03 2008 -0500
@@ -106,7 +106,7 @@ void new_scintilla_buffer(ScintillaObjec
   // Setup default styling and properties.
   SS(sci, SCI_STYLESETFONT, 32,
      reinterpret_cast<long>("!Bitstream Vera Sans Mono"));
-  SS(sci, SCI_STYLESETSIZE, 32, 8);
+  SS(sci, SCI_STYLESETSIZE, 32, 11);
   SS(sci, SCI_STYLESETFORE, 32, 0xAA | (0xAA << 8) | (0xAA << 16));
   SS(sci, SCI_STYLESETBACK, 32, 0x33 | (0x33 << 8) | (0x33 << 16));
   SS(sci, SCI_SETSTYLEBITS, 8, 0);