When the user attempts to close a file with unsaved changes, a save confirmation dialog appears. Pressing X results in the file being closed and unsaved changes are discarded. This happens because it acts as if the user pressed "No".
When a button is pressed in the dialog, first the destroy callback is fired followed by the clicked callback which sets messageBoxResult depending on the button pressed. However when X is pressed nothing else is called after destroy, leaving messageBoxResult to its default value. This can be fixed by defaulting it to MessageBoxChoice::cancel(1).
Because the enum is not accessible from outside, the callbacks and messageBoxResult were moved inside the SciTEGTK class.
With this patch, clicking X acts like pressing "Cancel".
Thanks, committed as [2f7752].
Related
Commit: [2f7752]