ci_edit icon indicating copy to clipboard operation
ci_edit copied to clipboard

Confirmation on quit

Open shubhodeep9 opened this issue 6 years ago • 1 comments

Note: This is a possible suggestion.

  • When user attempts to quit after unsaved changes
  • User is prompted whether to save, not save or cancel quitting
  • On keypress of either of it, it follows the command and quits right away.

Suggestion: It can wait for user to hit enter after writing the command, gives a bit more subtlety.

shubhodeep9 avatar Jan 10 '19 07:01 shubhodeep9

The way that the confirmation models are made, this isn't possible (as far as I can see):

Here's the snippet of code that strictly deals with the confirmations for closing:

class ConfirmClose(app.controller.Controller):
    """Ask about closing a file with unsaved changes."""

    def __init__(self, view):
        app.controller.Controller.__init__(self, view, 'confirmClose')

    def setTextBuffer(self, textBuffer):
        app.controller.Controller.setTextBuffer(self, textBuffer)
        commandSet = initCommandSet(self, textBuffer)
        commandSet.update({
            ord('n'): self.closeFile,
            ord('N'): self.closeFile,
            ord('y'): self.saveOrChangeToSaveAs,
            ord('Y'): self.saveOrChangeToSaveAs,
        })
        self.commandSet = commandSet
        self.commandDefault = self.confirmationPromptFinish

As you can see, it's looking for only n, N, y, or Y and this is the same for many other parts of the program, so adding a confirmation model would require a rewrite of all this, albeit still possible.

adityaxdiwakar avatar Feb 19 '19 17:02 adityaxdiwakar