From 4c6e5af484fec29920e8e09c1b7934112e052308 Mon Sep 17 00:00:00 2001 From: dail8859 Date: Sat, 2 Apr 2016 10:26:27 -0400 Subject: [PATCH] Safely convert EOLs Prevent eol conversion frrom readonly file. Closes #1702, Closes #1701, Closes #1581, Closes #1371 --- PowerEditor/src/NppCommands.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 12e84d3fa..e7cc8d03f 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -1815,8 +1815,14 @@ void Notepad_plus::command(int id) : (id == IDM_FORMAT_TOUNIX) ? EolType::unix : EolType::macos; Buffer* buf = _pEditView->getCurrentBuffer(); - buf->setEolFormat(newFormat); - _pEditView->execute(SCI_CONVERTEOLS, static_cast(buf->getEolFormat())); + + if (not buf->isReadOnly()) + { + LongRunningOperation op; + buf->setEolFormat(newFormat); + _pEditView->execute(SCI_CONVERTEOLS, static_cast(buf->getEolFormat())); + } + break; }