From 60776043808110b0956587e0ad5ffa016aa73058 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 25 Jul 2022 21:46:02 +0200 Subject: [PATCH] Fix erasing part of content make hanging issue Deletion of one line where there's folding didn't show the hiden lines in the old version of Scitilla. It's not anymore the case in the new (current used) version of Scintilla (which manages such situation correctly). Therefore the redundant notification for the current used version of Scintilla can be removed, and it solves hanging problem. Fix #10193, close #11946 --- PowerEditor/src/NppNotification.cpp | 10 +----- .../ScintillaComponent/ScintillaEditView.cpp | 32 ------------------- .../ScintillaComponent/ScintillaEditView.h | 1 - 3 files changed, 1 insertion(+), 42 deletions(-) diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index 97d6b3847..c090e76aa 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -64,15 +64,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) _pEditView->getCurrentBuffer()->setModifiedStatus(true); } - if (notification->modificationType & SC_MOD_CHANGEFOLD) - { - if (prevWasEdit) - { - notifyView->foldChanged(notification->line, notification->foldLevelNow, notification->foldLevelPrev); - prevWasEdit = false; - } - } - else if (!(notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT))) + if ((notification->modificationType & SC_MOD_CHANGEFOLD) || !(notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT))) { prevWasEdit = false; } diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 6b372be9c..4571df5ae 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -3373,38 +3373,6 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in } } - -void ScintillaEditView::foldChanged(size_t line, int levelNow, int levelPrev) -{ - if (levelNow & SC_FOLDLEVELHEADERFLAG) //line can be folded - { - if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) //but previously couldnt - { - // Adding a fold point. - execute(SCI_SETFOLDEXPANDED, line, 1); - expand(line, true, false, 0, levelPrev); - } - } - else if (levelPrev & SC_FOLDLEVELHEADERFLAG) - { - if (isFolded(line)) - { - // Removing the fold from one that has been contracted so should expand - // otherwise lines are left invisible with no way to make them visible - execute(SCI_SETFOLDEXPANDED, line, 1); - expand(line, true, false, 0, levelPrev); - } - } - else if (!(levelNow & SC_FOLDLEVELWHITEFLAG) && - ((levelPrev & SC_FOLDLEVELNUMBERMASK) > (levelNow & SC_FOLDLEVELNUMBERMASK))) - { - // See if should still be hidden - intptr_t parentLine = execute(SCI_GETFOLDPARENT, line); - if ((parentLine < 0) || !isFolded(parentLine && execute(SCI_GETLINEVISIBLE, parentLine))) - execute(SCI_SHOWLINES, line, line); - } -} - bool ScintillaEditView::getIndicatorRange(size_t indicatorNumber, size_t* from, size_t* to, size_t* cur) { size_t curPos = execute(SCI_GETCURRENTPOS); diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 0c42b2e84..15821f7a7 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -520,7 +520,6 @@ public: void columnReplace(ColumnModeInfos & cmi, const TCHAR *str); void columnReplace(ColumnModeInfos & cmi, int initial, int incr, int repeat, UCHAR format); - void foldChanged(size_t line, int levelNow, int levelPrev); void clearIndicator(int indicatorNumber) { size_t docStart = 0; size_t docEnd = getCurrentDocLen();