[PR #6337] [MERGED] Draw the cursor underneath text, and above the background #26649

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/6337
Author: @zadjii-msft
Created: 6/3/2020
Status: ✅ Merged
Merged: 6/4/2020
Merged by: @undefined

Base: master ← Head: dev/migrie/f/psychic-cursors


📝 Commits (6)

  • 171e084 Move CursorOptions up into it's own file
  • f9aae9d Wow, this works incredibly well for a first third attempt
  • 9d30b3b Code cleanup for review
  • 9da2461 These were some minor missing comments, typos
  • 2c14d58 PR feedback - only draw the filledBox cursor beneath the character
  • c278540 Fix audit mode

📊 Changes

17 files changed (+314 additions, -144 deletions)

View changed files

📝 src/host/ut_host/VtRendererTests.cpp (+1 -1)
📝 src/interactivity/onecore/BgfxEngine.cpp (+1 -1)
📝 src/renderer/base/RenderEngineBase.cpp (+5 -0)
📝 src/renderer/base/renderer.cpp (+46 -6)
📝 src/renderer/base/renderer.hpp (+3 -0)
📝 src/renderer/dx/CustomTextRenderer.cpp (+152 -0)
📝 src/renderer/dx/CustomTextRenderer.h (+14 -0)
📝 src/renderer/dx/DxRenderer.cpp (+23 -97)
📝 src/renderer/dx/DxRenderer.hpp (+4 -3)
📝 src/renderer/gdi/paint.cpp (+1 -1)
➕ src/renderer/inc/CursorOptions.h (+50 -0)
📝 src/renderer/inc/IRenderEngine.hpp (+8 -31)
📝 src/renderer/inc/RenderEngineBase.hpp (+2 -0)
📝 src/renderer/uia/UiaRenderer.cpp (+1 -1)
📝 src/renderer/vt/XtermEngine.cpp (+1 -1)
📝 src/renderer/vt/paint.cpp (+1 -1)
📝 src/renderer/wddmcon/WddmConRenderer.cpp (+1 -1)

📄 Description

Summary of the Pull Request

textAboveCursor003

This is the plan that @miniksa suggested to me. Instead of trying to do lots of work in all the renderers to do backgrounds as one pass, and foregrounds as another, we can localize this change to basically just the DX renderer.

  1. First, we give the DX engine a "heads up" on where the cursor is going to be drawn during the frame, in PrepareRenderInfo.
  • This function is left unimplemented in the other render engines.
  1. While printing runs of text, the DX renderer will try to paint the cursor in CustomTextRenderer::DrawGlyphRun INSTEAD of DxEngine::PaintCursor. This lets us weave the cursor background between the text background and the text.

References

  • #6151 was a spec in this general area. I should probably go back and update it, and we should probably approve that first.
  • #6193 is also right up in this mess

PR Checklist

Detailed Description of the Pull Request / Additional comments

  • This is essentially "cursorTextColor": "textForeground" from #6151.
  • A follow up work item is needed to add support for the current behavior, ("cursorTextColor": null), and hooking up that setting to the renderer.

🔄 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/6337 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 6/3/2020 **Status:** ✅ Merged **Merged:** 6/4/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/migrie/f/psychic-cursors` --- ### 📝 Commits (6) - [`171e084`](https://github.com/microsoft/terminal/commit/171e0846c868b1d212d69a5386db0ec60d28560c) Move CursorOptions up into it's own file - [`f9aae9d`](https://github.com/microsoft/terminal/commit/f9aae9d5b139ea702c2c127db911d00971ba3900) Wow, this works incredibly well for a ~first~ third attempt - [`9d30b3b`](https://github.com/microsoft/terminal/commit/9d30b3b75b0c604b7a6d0b286f2506738134cde2) Code cleanup for review - [`9da2461`](https://github.com/microsoft/terminal/commit/9da246160940f15bc4352e64c32f8226f57b92c6) These were some minor missing comments, typos - [`2c14d58`](https://github.com/microsoft/terminal/commit/2c14d58cc0bd6106e7358147d5707edae6367959) PR feedback - only draw the filledBox cursor beneath the character - [`c278540`](https://github.com/microsoft/terminal/commit/c278540544826cc77779e7da1dc4bac223b8f3c7) Fix audit mode ### 📊 Changes **17 files changed** (+314 additions, -144 deletions) <details> <summary>View changed files</summary> 📝 `src/host/ut_host/VtRendererTests.cpp` (+1 -1) 📝 `src/interactivity/onecore/BgfxEngine.cpp` (+1 -1) 📝 `src/renderer/base/RenderEngineBase.cpp` (+5 -0) 📝 `src/renderer/base/renderer.cpp` (+46 -6) 📝 `src/renderer/base/renderer.hpp` (+3 -0) 📝 `src/renderer/dx/CustomTextRenderer.cpp` (+152 -0) 📝 `src/renderer/dx/CustomTextRenderer.h` (+14 -0) 📝 `src/renderer/dx/DxRenderer.cpp` (+23 -97) 📝 `src/renderer/dx/DxRenderer.hpp` (+4 -3) 📝 `src/renderer/gdi/paint.cpp` (+1 -1) ➕ `src/renderer/inc/CursorOptions.h` (+50 -0) 📝 `src/renderer/inc/IRenderEngine.hpp` (+8 -31) 📝 `src/renderer/inc/RenderEngineBase.hpp` (+2 -0) 📝 `src/renderer/uia/UiaRenderer.cpp` (+1 -1) 📝 `src/renderer/vt/XtermEngine.cpp` (+1 -1) 📝 `src/renderer/vt/paint.cpp` (+1 -1) 📝 `src/renderer/wddmcon/WddmConRenderer.cpp` (+1 -1) </details> ### 📄 Description ## Summary of the Pull Request ![textAboveCursor003](https://user-images.githubusercontent.com/18356694/83681722-67a24d00-a5a8-11ea-8d9b-2d294065e4e4.gif) This is the plan that @miniksa suggested to me. Instead of trying to do lots of work in all the renderers to do backgrounds as one pass, and foregrounds as another, we can localize this change to basically just the DX renderer. 1. First, we give the DX engine a "heads up" on where the cursor is going to be drawn during the frame, in `PrepareRenderInfo`. - This function is left unimplemented in the other render engines. 2. While printing runs of text, the DX renderer will try to paint the cursor in `CustomTextRenderer::DrawGlyphRun` INSTEAD of `DxEngine::PaintCursor`. This lets us weave the cursor background between the text background and the text. ## References * #6151 was a spec in this general area. I should probably go back and update it, and we should probably approve that first. * #6193 is also right up in this mess ## PR Checklist * [x] Closes #1203 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments * This is essentially `"cursorTextColor": "textForeground"` from #6151. * A follow up work item is needed to add support for the current behavior, (`"cursorTextColor": null`), and hooking up that setting to the renderer. --- <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:17:21 +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#26649