Gui: [skip ci] make Save logic of text document more intuitive

This commit is contained in:
wmayer
2021-02-25 10:17:51 +01:00
parent 8be8c08b47
commit 460426c038

View File

@@ -167,7 +167,7 @@ bool TextDocumentEditorView::onMsg(const char* msg, const char**)
if (strcmp(msg,"Save") == 0) {
saveToObject();
return true;
return getGuiDocument()->save();
}
if (strcmp(msg,"Cut") == 0) {
getEditor()->cut();
@@ -204,7 +204,7 @@ bool TextDocumentEditorView::onHasMsg(const char* msg) const
return false;
if (strcmp(msg,"Save") == 0) {
return isEditorModified();
return true;
}
if (strcmp(msg,"Cut") == 0) {
return (!getEditor()->isReadOnly() &&
@@ -285,6 +285,7 @@ void TextDocumentEditorView::saveToObject()
boost::signals2::shared_connection_block textBlock {textConnection};
textDocument->Text.setValue(
getEditor()->document()->toPlainText().toUtf8());
textDocument->purgeTouched();
getEditor()->document()->setModified(false);
}