Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#617 Move away "Close document" item in context menu

Kirill Müller

In the context menu for files in the "Structure", the "Close document" item is on top. It is very easy to accidentally hit it when e.g. trying to set it as master document. For closing document there's Ctrl+W -- can we move this menu item more to the bottom (or even to the middle) of the menu? Or, even better, provide an "Undo close" (Ctrl+Shift+W)?


  • There is an "undo close" command in the recent files menu (open last non open recent file). You can just assign a shortcut to it

  • Kirill Müller
    Kirill Müller

    This doesn't seem to work for me, as closing a file doesn't seem to move it in the list of recent files.

  • Tim Hoffmann
    Tim Hoffmann

    Indeed, there is no undo close. One could implement this via a user script: On file-close write the filename to a file on disk, e.g. 'txs-last-closed.dat'. When the script is triggered to reopen the last closed file, load the filename from 'txs-last-closed.dat' and open that file.

    But maybe you are thinking in the wrong direction. If you are hitting it accidentially, I can only assume that you are changing it regularly and thus access the menu often quickly. There may be other approaches for this:

    • Does a shortcut for 'Define current Document as Master Document' suit your needs?
    • Does a couple of user scripts with shortcuts work, each defining a specific document as master.
    • Alternatively a user script that shows a list of all files and you can select one as master.
  • Ticket moved from /p/texstudio/bugs/861/

  • Kirill Müller
    Kirill Müller

    Tim: All fair. Still, I might accidentally right-click a file in the tree, and if I release in a wrong position on my system (Ubuntu Gnome), bam! the file is gone. Moving the menu item really should be a no-brainer, we can talk about stuff like "undo close" separately (which btw would be very nice to have, too).