From 267da64d3335fcf068de6c83d7e7235711ce8f54 Mon Sep 17 00:00:00 2001 From: Udo Hoffmann Date: Thu, 25 Jun 2020 13:41:45 +0200 Subject: [PATCH] Fix wrong horizontal scroll bar position after restoring Window position Fix #8466, close #8475 --- PowerEditor/src/NppBigSwitch.cpp | 4 ++++ PowerEditor/src/ScitillaComponent/ScintillaEditView.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index fd52df566..a81e1f7db 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1646,6 +1646,10 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case WM_ACTIVATE: { _pEditView->getFocus(); + auto x = _pEditView->execute(SCI_GETXOFFSET); + _pEditView->execute(SCI_SETXOFFSET, x); + x = _pNonEditView->execute(SCI_GETXOFFSET); + _pNonEditView->execute(SCI_SETXOFFSET, x); return TRUE; } diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index bf4aca824..ba374160e 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -221,13 +221,14 @@ public: { ::DestroyWindow(_hSelf); _hSelf = NULL; + _pScintillaFunc = NULL; }; virtual void init(HINSTANCE hInst, HWND hPere); LRESULT execute(UINT Msg, WPARAM wParam=0, LPARAM lParam=0) const { try { - return _pScintillaFunc(_pScintillaPtr, Msg, wParam, lParam); + return (_pScintillaFunc) ? _pScintillaFunc(_pScintillaPtr, Msg, wParam, lParam) : -1; } catch (...) {