[1.14] Use the viewport-rel. cursor pos for CursorPosition #13786
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #13024, we removed
Terminal::GetCursorPosition
from TerminalCore.This has been widely regarded as a good move.
Now, you might rightly be wondering: why didn't compilation immediately
fail? Well. It turns out that there were two copies of
GetCursorPosition
. One forconst Terminal
, and one forTerminal
.This is important.
Terminal::GetCursorPosition()
returned the cursor position relative tothe viewport.
Terminal::GetCursorPosition() const
, however, returnsthe cursor position in absolute.
We removed the non-
const
one. Fortunately, thanks to the lookup rulesfor
const
-qualified members, this didn't matter. Code that calledGetCursorPosition()
still calledGetCursorPosition()
, and everythingwas fine.
Except that part about the relative coordinates. That was not fine.
The TSF control is the only consumer of
ControlCore.CursorPosition
,and that was the only consumer of relative-
GetCursorPosition()
.This commit restores equilibrium by introducing a new
GetViewportRelativeCursorPosition()
member toTerminal
and switchingover the only consumer of relative cursor position to use it.
Closes #13769.
Backport of #13785.