Page 1 of 1
FileSave does a save-as if there are lines selected?
Posted: Sat May 06, 2006 9:29 pm
by nedbatchelder
My keyboard mapping maps Ctrl+S to FileSave (natch).
If nothing is selected, and I hit Ctrl+S, the file saves. If I select a word and hit Ctrl+S, the file saves. But if I select across lines (more than one line is in the selection) and hit Ctrl+S, the Save As dialog appears.
Huh?
Posted: Sun May 07, 2006 12:13 pm
by jussij
If nothing is selected, and I hit Ctrl+S, the file saves. If I select a word and hit Ctrl+S, the file saves. But if I select across lines (more than one line is in the selection) and hit Ctrl+S, the Save As dialog appears.
The idea behind feature is to allow for a quick way to save a section of text to an alternative file. It has the same effect as if you had marked and area, copy text to clipboard, selected file new, paste the text into the document and then hit file save.
To remove this behaviour just re-bind the the key to the following Lua macro:
Code: Select all
function key_macro()
-- look for a marked area
local marked = is_marked()
if marked == 1 then
-- save the current markings
cursor_save()
-- remove the markings
MarkHide()
-- call the save function
FileSave()
-- restore the markings
cursor_restore()
else
-- let the file save handle the rest
FileSave()
end
end
key_macro() -- run the macro
Cheers Jussi
Update the doc?
Posted: Sun May 07, 2006 8:31 pm
by nedbatchelder
Thanks: perhaps this behavior could be described in the documentation for FileSave?
Posted: Tue May 09, 2006 4:07 am
by jussij
I just realised a much easier way to change disable this behavior is to use the
Options,
Editor Options menu and in the
General section uncheck the
Brief file save mode option
Cheers Jussi