Browse Source

Fix cannot paste issue after removing read-only via menu

Syncronize Paste and Undo commands with file buffer read-only status.
Previously, after e.g. removing the read-only flag, file editing was possible immediately, but Ctrl-V was not. At least a cursor movement or switching between the N++ tabs or apps-switching was required (SCN_UPDATEUI message generated...).

Fix https://github.com/notepad-plus-plus/notepad-plus-plus/issues/13742#issuecomment-2233570312, close #15452
pull/15466/head
xomx 4 months ago committed by Don Ho
parent
commit
19ddb91a64
  1. 5
      PowerEditor/src/Notepad_plus.cpp

5
PowerEditor/src/Notepad_plus.cpp

@ -6621,6 +6621,10 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask)
if (mask & (BufferChangeReadonly))
{
checkDocState();
// enable/disable possible Undo and Paste commands according to the current R/O status
checkClipboard();
checkUndoState();
bool isSysReadOnly = buffer->getFileReadOnly();
bool isUserReadOnly = buffer->getUserReadOnly();
@ -6632,7 +6636,6 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask)
scnN.nmhdr.idFrom = (uptr_t) ((isSysReadOnly || isUserReadOnly? DOCSTATUS_READONLY : 0) | (isDirty ? DOCSTATUS_BUFFERDIRTY : 0));
scnN.nmhdr.code = NPPN_READONLYCHANGED;
_pluginsManager.notify(&scnN);
}
if (_pDocumentListPanel)

Loading…
Cancel
Save