FileSave does a save-as if there are lines selected?

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
nedbatchelder
Posts: 6
Joined: Wed May 03, 2006 1:48 am

FileSave does a save-as if there are lines selected?

Post 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?
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post 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
nedbatchelder
Posts: 6
Joined: Wed May 03, 2006 1:48 am

Update the doc?

Post by nedbatchelder »

Thanks: perhaps this behavior could be described in the documentation for FileSave?
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post 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
Post Reply