diff options
author | 2011-08-08 23:17:43 -0400 | |
---|---|---|
committer | 2011-08-08 23:17:43 -0400 | |
commit | e94fa748ee9aeaa7bb39dede87e14344158719b8 (patch) | |
tree | 1a92a3f78be53b80f310fb8b2cff5a8e13804583 /modules | |
parent | 207e12eabb9cb13cfb88ed604ce31fe241587209 (diff) | |
download | textadept-e94fa748ee9aeaa7bb39dede87e14344158719b8.tar.gz textadept-e94fa748ee9aeaa7bb39dede87e14344158719b8.zip |
Do not autosave over explicitly loaded session; modules/textadept/session.lua
Diffstat (limited to 'modules')
-rw-r--r-- | modules/textadept/session.lua | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua index bc697f2f..463b4e49 100644 --- a/modules/textadept/session.lua +++ b/modules/textadept/session.lua @@ -83,7 +83,6 @@ function load(filename) end f:close() _VIEWS[current_view]:focus() - _SESSIONFILE = filename or DEFAULT_SESSION if #not_found > 0 then gui.dialog('msgbox', '--title', L('Session Files Not Found'), @@ -159,7 +158,7 @@ function save(filename) local size = gui.size session[#session + 1] = ("size: %d %d"):format(size[1], size[2]) -- Write the session. - local f = io.open(filename or _SESSIONFILE or DEFAULT_SESSION, 'wb') + local f = io.open(filename or DEFAULT_SESSION, 'wb') if f then f:write(table.concat(session, '\n')) f:close() @@ -169,13 +168,12 @@ 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 '', + DEFAULT_SESSION:match('.+[/\\]') or '', '--with-file', - session_file:match('[^/\\]+$') or '', + DEFAULT_SESSION:match('[^/\\]+$') or '', '--no-newline') if #utf8_filename > 0 then load(utf8_filename:iconv(_CHARSET, 'UTF-8')) end end @@ -183,13 +181,12 @@ 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 '', + DEFAULT_SESSION:match('.+[/\\]') or '', '--with-file', - session_file:match('[^/\\]+$') or '', + DEFAULT_SESSION:match('[^/\\]+$') or '', '--no-newline') if #utf8_filename > 0 then save(utf8_filename:iconv(_CHARSET, 'UTF-8')) end end |