From f12ee745efab97c9e40ccafc2b649e9c15cfda78 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Thu, 16 Jun 2022 16:55:17 -0500 Subject: [PATCH] Update the scrollbar postiton on `scrollToMark` (#13291) When I moved this into ControlCore, I forgot that UserScrollViewport is usually triggered by the scrollbar updating, so it doesn't ask the UI to update. Since this logic is in ControlCore, it's sorta in a weird place where it needs to communicate both up and down: * update the `Terminal`'s viewport position * update the `TermControl`'s scrollbar position Checklist: * [x] Closes a bug bash bug * [x] Missed in #12948 * See also #11000 --- src/cascadia/TerminalControl/ControlCore.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cascadia/TerminalControl/ControlCore.cpp b/src/cascadia/TerminalControl/ControlCore.cpp index 5635f4603d9..6a6b8a670f8 100644 --- a/src/cascadia/TerminalControl/ControlCore.cpp +++ b/src/cascadia/TerminalControl/ControlCore.cpp @@ -2017,19 +2017,27 @@ namespace winrt::Microsoft::Terminal::Control::implementation } } + const auto viewHeight = ViewHeight(); + const auto bufferSize = BufferHeight(); + + // UserScrollViewport, to update the Terminal about where the viewport should be + // then raise a _terminalScrollPositionChanged to inform the control to update the scrollbar. if (tgt.has_value()) { UserScrollViewport(tgt->start.y); + _terminalScrollPositionChanged(tgt->start.y, viewHeight, bufferSize); } else { if (direction == ScrollToMarkDirection::Last || direction == ScrollToMarkDirection::Next) { UserScrollViewport(BufferHeight()); + _terminalScrollPositionChanged(BufferHeight(), viewHeight, bufferSize); } else if (direction == ScrollToMarkDirection::First || direction == ScrollToMarkDirection::Previous) { UserScrollViewport(0); + _terminalScrollPositionChanged(0, viewHeight, bufferSize); } } }