Improve word navigation perf in ConHost

This commit is contained in:
Carlos Zamora
2020-04-17 17:04:03 -07:00
parent 9ce884c4fb
commit 6ecc28ab07

View File

@@ -33,9 +33,12 @@ Microsoft::Console::Types::Viewport RenderData::GetViewport() noexcept
// - COORD of the end position of the text buffer
COORD RenderData::GetTextBufferEndPosition() const noexcept
{
// We use the end line of mutableViewport as the end
// of the text buffer, it always moves with the written
// text
const CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
Viewport bufferSize = gci.GetActiveOutputBuffer().GetBufferSize();
COORD endPosition{ bufferSize.Width() - 1, bufferSize.BottomInclusive() };
const auto mutableViewport = gci.GetActiveOutputBuffer().GetVirtualViewport();
COORD endPosition{ mutableViewport.Width() - 1, gsl::narrow<short>(mutableViewport.BottomInclusive()) };
return endPosition;
}