[PR #13786] [MERGED] [1.14] Use the viewport-rel. cursor pos for CursorPosition #29767

Open
opened 2026-01-31 09:36:47 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13786
Author: @DHowett
Created: 8/19/2022
Status: Merged
Merged: 8/22/2022
Merged by: @DHowett

Base: release-1.14Head: dev/duhowett/the-cursor-is-too-far-AWAY-on-1.14-too


📝 Commits (1)

  • 19c3615 [1.14] Use the viewport-relative cursor pos for CCore.CursorPosition

📊 Changes

3 files changed (+12 additions, -1 deletions)

View changed files

📝 src/cascadia/TerminalControl/ControlCore.cpp (+1 -1)
📝 src/cascadia/TerminalCore/Terminal.cpp (+9 -0)
📝 src/cascadia/TerminalCore/Terminal.hpp (+2 -0)

📄 Description

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 for const Terminal, and one for Terminal.
This is important.

Terminal::GetCursorPosition() returned the cursor position relative to
the viewport. Terminal::GetCursorPosition() const, however, returns
the cursor position in absolute.

We removed the non-const one. Fortunately, thanks to the lookup rules
for const-qualified members, this didn't matter. Code that called
GetCursorPosition() still called GetCursorPosition(), and everything
was 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 to Terminal and switching
over the only consumer of relative cursor position to use it.

Closes #13769.
Backport of #13785.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/13786 **Author:** [@DHowett](https://github.com/DHowett) **Created:** 8/19/2022 **Status:** ✅ Merged **Merged:** 8/22/2022 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `release-1.14` ← **Head:** `dev/duhowett/the-cursor-is-too-far-AWAY-on-1.14-too` --- ### 📝 Commits (1) - [`19c3615`](https://github.com/microsoft/terminal/commit/19c3615963c1ed123227321bbdc8a2e556763564) [1.14] Use the viewport-relative cursor pos for CCore.CursorPosition ### 📊 Changes **3 files changed** (+12 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+1 -1) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+9 -0) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+2 -0) </details> ### 📄 Description 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 for `const Terminal`, and one for `Terminal`. This is important. `Terminal::GetCursorPosition()` returned the cursor position relative to the viewport. `Terminal::GetCursorPosition() const`, however, returns the cursor position in absolute. We removed the non-`const` one. Fortunately, thanks to the lookup rules for `const`-qualified members, this didn't matter. Code that called `GetCursorPosition()` still called `GetCursorPosition()`, and everything was 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 to `Terminal` and switching over the only consumer of relative cursor position to use it. Closes #13769. Backport of #13785. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:36:47 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29767