Skip to content

Commit

Permalink
Avoid querying for cursor position unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
daxian-dbw committed Jan 7, 2025
1 parent e87a265 commit 1071070
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion PSReadLine/Render.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ public void UpdateConsoleInfo(IConsole console)
cursorLeft = console.CursorLeft;
cursorTop = console.CursorTop;
}

public void UpdateConsoleInfo(int bWidth, int bHeight, int cLeft, int cTop)
{
bufferWidth = bWidth;
bufferHeight = bHeight;
cursorLeft = cLeft;
cursorTop = cTop;
}
}

internal readonly struct RenderDataOffset
Expand Down Expand Up @@ -928,7 +936,7 @@ void UpdateColorsIfNecessary(string newColor)
_console.SetCursorPosition(point.X, point.Y);
_console.CursorVisible = true;

_previousRender.UpdateConsoleInfo(_console);
_previousRender.UpdateConsoleInfo(bufferWidth, bufferHeight, point.X, point.Y);
_previousRender.initialY = _initialY;

// TODO: set WindowTop if necessary
Expand Down

0 comments on commit 1071070

Please sign in to comment.