diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 2d59e26b9..5c9f70e40 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -2759,6 +2759,26 @@ void ScintillaEditView::foldChanged(int line, int levelNow, int levelPrev) } } + +void ScintillaEditView::scrollPosToCenter(int pos) +{ + execute(SCI_GOTOPOS, pos); + int line = execute(SCI_LINEFROMPOSITION, pos); + + int firstVisibleDisplayLine = execute(SCI_GETFIRSTVISIBLELINE); + int firstVisibleDocLine = execute(SCI_DOCLINEFROMVISIBLE, firstVisibleDisplayLine); + int nbLine = execute(SCI_LINESONSCREEN, firstVisibleDisplayLine); + int lastVisibleDocLine = execute(SCI_DOCLINEFROMVISIBLE, firstVisibleDisplayLine + nbLine); + + int middleLine; + if (line - firstVisibleDocLine < lastVisibleDocLine - line) + middleLine = firstVisibleDocLine + nbLine/2; + else + middleLine = lastVisibleDocLine - nbLine/2; + int nbLines2scroll = line - middleLine; + scroll(0, nbLines2scroll); +} + void ScintillaEditView::hideLines() { //Folding can screw up hide lines badly if it unfolds a hidden section. //Adding runMarkers(hide, foldstart) directly (folding on single document) can help diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index bae92f102..ea809367b 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -199,8 +199,7 @@ struct LanguageName { class ScintillaEditView : public Window { - //friend class Notepad_plus; - friend class Finder; +friend class Finder; public: ScintillaEditView() : Window(), _pScintillaFunc(NULL),_pScintillaPtr(NULL), @@ -626,6 +625,7 @@ public: return ((_codepage == CP_CHINESE_TRADITIONAL) || (_codepage == CP_CHINESE_SIMPLIFIED) || (_codepage == CP_JAPANESE) || (_codepage == CP_KOREAN)); }; + void scrollPosToCenter(int pos); protected: static HINSTANCE _hLib; diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index 1a2e1efb5..5bcee53cc 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -270,7 +270,8 @@ bool FunctionListPanel::openSelection() int sci_line = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, pos); (*_ppEditView)->execute(SCI_ENSUREVISIBLE, sci_line); - (*_ppEditView)->execute(SCI_GOTOPOS, pos); + //(*_ppEditView)->execute(SCI_GOTOPOS, pos); + (*_ppEditView)->scrollPosToCenter(pos); return true; } diff --git a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp index 0d4929880..20304f262 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp @@ -637,6 +637,12 @@ void FunctionMixParser::parse(std::vector & foundInfos, size_t begin, classParse(foundInfos, scannedZones, commentZones, begin, end, ppEditView, classStructName); + // the second level + for (size_t i = 0; i < scannedZones.size(); i++) + { + vector< pair > temp; + classParse(foundInfos, temp, commentZones, scannedZones[i].first, scannedZones[i].second, ppEditView, classStructName); + } // invert scannedZones getInvertZones(nonScannedZones, scannedZones, begin, end);