Opened 9 years ago

Closed 8 years ago

#813 closed defect (fixed)

There is no warning for unsaved documents when closing the IDE (Cocotron

Reported by: ender2012 Owned by: gb
Priority: normal Milestone:
Component: Cocotron Version: trunk
Keywords: Cc:

Description (last modified by gb)

To reproduce:

  • open the IDE
  • Open a .lisp document
  • make a change (add some text)
  • close the document without saving
  • notice there is dialog asking you if you would like to save before you close the document

Change History (2)

comment:1 Changed 9 years ago by gb

  • Description modified (diff)
  • Owner set to gb
  • Status changed from new to assigned

Document change tracking is supposed to be the responsibility of the document's NSUndoManager. The NSUndoManager class is basically disabled on and by Cocotron because the implementation is too buggy; as a result, the document object isn't notified of changes to the underlying Hemlock buffer and the shared NSDocumentManager doesn't prompt to save modified documents on quit (or when windows containing those documents are closed.)

It's fairly simple to add #/updateChangeCount: calls at the appropriate places (roughly whenever a modification is recorded for the undo manager's sake), and doing so causes change indications to appear (an asterisk before the window's title and an asterisk at the beginning of the modeline) and attempts to close windows with modified documents prompts the user to save. Unfortunately, there doesn't seem to currently be any way out of the modal event loop that Cocotron gets stuck in when #_NSRunAlertPanel does that prompting; see ticket:818.

When ticket:818 is closed, the #/updateChangeCount: calls should be added (and eventually removed if Cocotron's NSUndoManager ever works.) Until that point, it's probably better to have to remember to save (and to not be sure whether or not saving is necessary) than it would be to hang while being prompted to save.

comment:2 Changed 8 years ago by gb

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14660]) When modifying a document's textstorage on Cocotron, explicitly call the document's #/updateChangeCount: method. (This ordinarily is the responsibility of the document's NSUndoManager, but Cocotron's NSUndoManager support is broken.) This gives visual indication of the document's modified state in the containing window's titlebar and modeline and notifies the document controller that it should prompt to save modified documents. Since NSRunAlertPanel() seems to now be usable on Cocotron (see ticket:818), this fixes ticket:813.

Note: See TracTickets for help on using tickets.