From fa254e579c69d58ec92780b6fd69d968f6c6e738 Mon Sep 17 00:00:00 2001 From: briddums Date: Mon, 10 Jun 2019 12:38:10 -0700 Subject: [PATCH] Fix an issue in IDM_EDIT_CLEARREADONLY Using ^= for the readonly attribute will cause it to always change the bit. So if CLEARREADONLY is called on a file that isn't read only, the file will become read only. Fix #5768, close #5774 --- PowerEditor/src/NppCommands.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index d12f95c1..c405874c 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -1568,7 +1568,7 @@ void Notepad_plus::command(int id) Buffer * buf = _pEditView->getCurrentBuffer(); DWORD dwFileAttribs = ::GetFileAttributes(buf->getFullPathName()); - dwFileAttribs ^= FILE_ATTRIBUTE_READONLY; + dwFileAttribs &= ~FILE_ATTRIBUTE_READONLY; ::SetFileAttributes(buf->getFullPathName(), dwFileAttribs); buf->setFileReadOnly(false);