From da8e48f67a6ddffb69b14d3a2bdcbde881729b1f Mon Sep 17 00:00:00 2001 From: ozone10 <positronix10@gmail.com> Date: Sat, 10 Jun 2023 18:11:32 +0200 Subject: [PATCH] Fix EOL symbol color/appearence being reset while changing encoding issue Fix #13728, close #13763 --- .../ScintillaComponent/ScintillaEditView.cpp | 9 ++++---- .../ScintillaComponent/ScintillaEditView.h | 21 ++++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index b521fc79c..ee1ab652e 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -2882,6 +2882,10 @@ void ScintillaEditView::showNpc(bool willBeShowed, bool isSearchResult) { setNpcAndCcUniEOL(); } + + // in some case npc representation is not redrawn correctly on first line + // therefore use of showEOL(isShownEol()) instead of redraw() + showEOL(isShownEol()); } else { @@ -2895,10 +2899,6 @@ void ScintillaEditView::showNpc(bool willBeShowed, bool isSearchResult) showCcUniEol(svp._ccUniEolShow); } - - // in some case npc representation is not redrawn correctly on first line - // therefore use of showEOL(isShownEol()) instead of redraw() - showEOL(isShownEol()); } void ScintillaEditView::showCcUniEol(bool willBeShowed, bool isSearchResult) @@ -2937,6 +2937,7 @@ void ScintillaEditView::showCcUniEol(bool willBeShowed, bool isSearchResult) if (svp._npcShow) { showNpc(); + return; // showEOL(isShownEol()) already in showNpc() } } diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 33a9409b2..6675d4ed9 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -497,15 +497,26 @@ public: void maintainStateForNpc() { const auto& svp = NppParameters::getInstance().getSVP(); const bool isShownNpc = svp._npcShow; - const bool isNpcIncCcUniEol = svp._npcIncludeCcUniEol; const bool isShownCcUniEol = svp._ccUniEolShow; - if (isShownNpc || isNpcIncCcUniEol) + if (isShownNpc && isShownCcUniEol) { - showNpc(isShownNpc); - } + showNpc(true); + showCcUniEol(true); - showCcUniEol(isShownCcUniEol); + if (svp._eolMode != svp.roundedRectangleText) + { + setCRLF(); + } + } + else if (!isShownNpc && isShownCcUniEol) + { + showNpc(false); + } + else + { + showCcUniEol(false); + } } void showCcUniEol(bool willBeShowed = true, bool isSearchResult = false);