parent
fe4c80b27d
commit
306e751639
|
@ -1232,6 +1232,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
|||
}
|
||||
|
||||
_connection.WriteInput(stripped);
|
||||
_terminal->TrySnapOnInput();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
|
|
@ -24,6 +24,8 @@ namespace Microsoft::Terminal::Core
|
|||
virtual void UserScrollViewport(const int viewTop) = 0;
|
||||
virtual int GetScrollOffset() = 0;
|
||||
|
||||
virtual void TrySnapOnInput() = 0;
|
||||
|
||||
protected:
|
||||
ITerminalInput() = default;
|
||||
};
|
||||
|
|
|
@ -192,6 +192,24 @@ void Terminal::Write(std::wstring_view stringView)
|
|||
_stateMachine->ProcessString(stringView.data(), stringView.size());
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Attempts to snap to the bottom of the buffer, if SnapOnInput is true. Does
|
||||
// nothing if SnapOnInput is set to false, or we're already at the bottom of
|
||||
// the buffer.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void Terminal::TrySnapOnInput()
|
||||
{
|
||||
if (_snapOnInput && _scrollOffset != 0)
|
||||
{
|
||||
auto lock = LockForWriting();
|
||||
_scrollOffset = 0;
|
||||
_NotifyScrollEvent();
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Send this particular key event to the terminal. The terminal will translate
|
||||
// the key and the modifiers pressed into the appropriate VT sequence for that
|
||||
|
@ -207,12 +225,7 @@ void Terminal::Write(std::wstring_view stringView)
|
|||
// - false if we did not translate the key, and it should be processed into a character.
|
||||
bool Terminal::SendKeyEvent(const WORD vkey, const WORD scanCode, const ControlKeyStates states)
|
||||
{
|
||||
if (_snapOnInput && _scrollOffset != 0)
|
||||
{
|
||||
auto lock = LockForWriting();
|
||||
_scrollOffset = 0;
|
||||
_NotifyScrollEvent();
|
||||
}
|
||||
TrySnapOnInput();
|
||||
|
||||
// Alt key sequences _require_ the char to be in the keyevent. If alt is
|
||||
// pressed, manually get the character that's being typed, and put it in the
|
||||
|
|
|
@ -92,6 +92,8 @@ public:
|
|||
[[nodiscard]] HRESULT UserResize(const COORD viewportSize) noexcept override;
|
||||
void UserScrollViewport(const int viewTop) override;
|
||||
int GetScrollOffset() override;
|
||||
|
||||
void TrySnapOnInput() override;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region IBaseData(base to IRenderData and IUiaData)
|
||||
|
|
Loading…
Reference in a new issue