From 741d7e87d67d265fd0096b779d1e471172b2bccb Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Wed, 8 Jul 2009 21:41:01 -0400 Subject: Better session management. Can load and save from the menu now as well. --- core/ext/menu.lua | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'core/ext') diff --git a/core/ext/menu.lua b/core/ext/menu.lua index c78b36ed..6549cbfd 100644 --- a/core/ext/menu.lua +++ b/core/ext/menu.lua @@ -361,28 +361,30 @@ local actions = { [ID.LOAD_SESSION] = { function() local utf8_filename = - cocoa_dialog('fileselect', { - title = l.MENU_LOAD_SESSION_TITLE, - ['with-directory'] = (textadept.session_file or ''):match('.+[/\\]'), - ['with-file'] = (textadept.session_file or ''):match('[^/\\]+$'), - ['no-newline'] = true - }) + t.dialog('fileselect', + '--title', l.MENU_LOAD_SESSION_TITLE, + '--with-directory', + (textadept.session_file or ''):match('.+[/\\]') or '', + '--with-file', + (textadept.session_file or ''):match('[^/\\]+$') or '', + '--no-newline') if #utf8_filename > 0 then - _m.textadept.session.load(t.iconv(utf8_filename, _CHARSET, 'UTF-8')) + t.io.load_session(t.iconv(utf8_filename, _CHARSET, 'UTF-8')) end end }, [ID.SAVE_SESSION] = { function() local utf8_filename = - cocoa_dialog('filesave', { - title = l.MENU_SAVE_SESSION_TITLE, - ['with-directory'] = (textadept.session_file or ''):match('.+[/\\]'), - ['with-file'] = (textadept.session_file or ''):match('[^/\\]+$'), - ['no-newline'] = true - }) + t.dialog('filesave', + '--title', l.MENU_SAVE_SESSION_TITLE, + '--with-directory', + (textadept.session_file or ''):match('.+[/\\]') or '', + '--with-file', + (textadept.session_file or ''):match('[^/\\]+$') or '', + '--no-newline') if #utf8_filename > 0 then - _m.textadept.session.save(t.iconv(utf8_filename, _CHARSET, 'UTF-8')) + t.io.save_session(t.iconv(utf8_filename, _CHARSET, 'UTF-8')) end end }, -- cgit v1.2.3