Fix Functions list scrolling to the top on file save

Retain Functions list scrollbar position on reload.

Fix #9659, close #10183
This commit is contained in:
Ashfaaq18 2021-07-18 18:30:35 +05:30 committed by Don HO
parent 3482673fd8
commit 46a264e2db
2 changed files with 19 additions and 0 deletions

View File

@ -315,6 +315,13 @@ bool FunctionListPanel::serialize(const generic_string & outputFilename)
void FunctionListPanel::reload()
{
bool isScrollBarOn = GetWindowLongPtr(_treeView.getHSelf(), GWL_STYLE) & WS_VSCROLL;
//get scroll position
if (isScrollBarOn)
{
GetScrollInfo(_treeView.getHSelf(), SB_VERT, &si);
}
// clean up
_findLine = -1;
_findEndLine = -1;
@ -396,6 +403,12 @@ void FunctionListPanel::reload()
// invalidate the editor rect
::InvalidateRect(_hSearchEdit, NULL, TRUE);
//set scroll position
if (isScrollBarOn)
{
SetScrollInfo(_treeView.getHSelf(), SB_VERT, &si, TRUE);
}
}
void FunctionListPanel::markEntry()
@ -498,6 +511,11 @@ void FunctionListPanel::init(HINSTANCE hInst, HWND hPere, ScintillaEditView **pp
_funcParserMgr.init(funcListDefaultXmlPath, funcListDefaultXmlPath, ppEditView);
}
}
//init scrollinfo structure
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
}
bool FunctionListPanel::openSelection(const TreeView & treeView)

View File

@ -109,6 +109,7 @@ private:
TreeView _treeView;
TreeView _treeViewSearchResult;
SCROLLINFO si;
long _findLine = -1;
long _findEndLine = -1;
HTREEITEM _findItem;