diff options
author | 2011-07-29 18:27:06 -0400 | |
---|---|---|
committer | 2011-07-29 18:27:06 -0400 | |
commit | 36675f10b0cefaee7e9451b3eec3dfd715888625 (patch) | |
tree | 5a2135ef56b3e52bdf63fb4a82d4cec8c5e41eab /modules/textadept/session.lua | |
parent | 32da7ac1a36d2285daa3a0ee280f1730415f04cf (diff) | |
download | textadept-36675f10b0cefaee7e9451b3eec3dfd715888625.tar.gz textadept-36675f10b0cefaee7e9451b3eec3dfd715888625.zip |
Eliminated the need for keys.conf and keys.osx.conf.
Thanks to Robert Gieseke for the idea and prototype code.
Diffstat (limited to 'modules/textadept/session.lua')
-rw-r--r-- | modules/textadept/session.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua index f22307d6..bc697f2f 100644 --- a/modules/textadept/session.lua +++ b/modules/textadept/session.lua @@ -166,6 +166,34 @@ function save(filename) end end +--- +-- Prompts the user for a Textadept session to load. +function prompt_load() + local session_file = _SESSIONFILE or '' + local utf8_filename = gui.dialog('fileselect', + '--title', L('Load Session'), + '--with-directory', + session_file:match('.+[/\\]') or '', + '--with-file', + session_file:match('[^/\\]+$') or '', + '--no-newline') + if #utf8_filename > 0 then load(utf8_filename:iconv(_CHARSET, 'UTF-8')) end +end + +--- +-- Prompts the user to save the current Textadept session to a file. +function prompt_save() + local session_file = _SESSIONFILE or '' + local utf8_filename = gui.dialog('filesave', + '--title', L('Save Session'), + '--with-directory', + session_file:match('.+[/\\]') or '', + '--with-file', + session_file:match('[^/\\]+$') or '', + '--no-newline') + if #utf8_filename > 0 then save(utf8_filename:iconv(_CHARSET, 'UTF-8')) end +end + events.connect(events.QUIT, function() if SAVE_ON_QUIT then save() end end, 1) local function no_session() SAVE_ON_QUIT = false end |