Small read-only mode fixes. Does not allow Undo/Redo/Paste when read-only.
diff --git a/TextEditor.cpp b/TextEditor.cpp index b78e831..bdeef50 100644 --- a/TextEditor.cpp +++ b/TextEditor.cpp
@@ -1852,6 +1852,9 @@ void TextEditor::Paste() { + if (IsReadOnly()) + return; + auto clipText = ImGui::GetClipboardText(); if (clipText != nullptr && strlen(clipText) > 0) { @@ -1879,12 +1882,12 @@ bool TextEditor::CanUndo() const { - return mUndoIndex > 0; + return !mReadOnly && mUndoIndex > 0; } bool TextEditor::CanRedo() const { - return mUndoIndex < (int)mUndoBuffer.size(); + return !mReadOnly && mUndoIndex < (int)mUndoBuffer.size(); } void TextEditor::Undo(int aSteps)