[PR #14396] [MERGED] Clean up CodepointWidthDetector #30075

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14396
Author: @lhecker
Created: 11/15/2022
Status: Merged
Merged: 12/1/2022
Merged by: @undefined

Base: mainHead: dev/lhecker/codepoint-width-refactor


📝 Commits (7)

  • 4ae9b2e Clean up CodepointWidthDetector
  • e807ef8 Fix build failure
  • 0a15499 Revert src/host/srvinit.cpp
  • ddf8430 Partially revert src/host/ut_host/CodepointWidthDetectorTests.cpp
  • bd254b5 Fix build/test
  • 3556cae Merge remote-tracking branch 'origin/main' into dev/lhecker/codepoint-width-refactor
  • 451b3bc Fix spelling

📊 Changes

14 files changed (+403 additions, -620 deletions)

View changed files

📝 src/buffer/out/OutputCellIterator.cpp (+5 -8)
📝 src/buffer/out/OutputCellIterator.hpp (+5 -11)
📝 src/cascadia/PublicTerminalCore/HwndTerminal.cpp (+1 -22)
📝 src/cascadia/PublicTerminalCore/HwndTerminal.hpp (+1 -1)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+0 -21)
📝 src/host/ut_host/CodepointWidthDetectorTests.cpp (+3 -15)
📝 src/interactivity/base/EventSynthesis.cpp (+1 -1)
📝 src/types/CodepointWidthDetector.cpp (+355 -457)
📝 src/types/GlyphWidth.cpp (+4 -4)
📝 src/types/convert.cpp (+0 -34)
📝 src/types/inc/CodepointWidthDetector.hpp (+8 -22)
📝 src/types/inc/GlyphWidth.hpp (+5 -2)
📝 src/types/inc/convert.hpp (+1 -4)
📝 tools/Generate-CodepointWidthsFromUCD.ps1 (+14 -18)

📄 Description

My long-term plan is to replace the CodepointWidth enum with a simple integer
return value that indicates the amount of columns a codepoint is wide.
This is necessary so that we can return 0 for ZWJs (zero width joiners).

This initial commit represents a cleanup effort around CodepointWidthDetector.
Since less code runs faster, this change has the nice side-effect of running
roughly 5-10% faster across the board. It also drops the binary size by ~1.2kB.

Validation Steps Performed

  • CodepointWidthDetectorTests passes
  • U+26bf ("`u{26bf}" inside pwsh) is a wide glyph
    in OpenConsole and narrow one in Windows Terminal

🔄 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/14396 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 11/15/2022 **Status:** ✅ Merged **Merged:** 12/1/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/codepoint-width-refactor` --- ### 📝 Commits (7) - [`4ae9b2e`](https://github.com/microsoft/terminal/commit/4ae9b2ebf374340cb45c30be981245014e1df242) Clean up CodepointWidthDetector - [`e807ef8`](https://github.com/microsoft/terminal/commit/e807ef8b1c85e8e385585ee356ddb9c92f2e9854) Fix build failure - [`0a15499`](https://github.com/microsoft/terminal/commit/0a15499fb16b369711c4a806e573263f2b447431) Revert src/host/srvinit.cpp - [`ddf8430`](https://github.com/microsoft/terminal/commit/ddf8430b8d4667b1648e61229873637b4ff3aead) Partially revert src/host/ut_host/CodepointWidthDetectorTests.cpp - [`bd254b5`](https://github.com/microsoft/terminal/commit/bd254b57c8dd90bbfc7bc8753a4b6795b1cbb895) Fix build/test - [`3556cae`](https://github.com/microsoft/terminal/commit/3556caecabe913cc57637061d61a99d10ece7950) Merge remote-tracking branch 'origin/main' into dev/lhecker/codepoint-width-refactor - [`451b3bc`](https://github.com/microsoft/terminal/commit/451b3bc99d3f5024f4e316c03d606c02a729dc5e) Fix spelling ### 📊 Changes **14 files changed** (+403 additions, -620 deletions) <details> <summary>View changed files</summary> 📝 `src/buffer/out/OutputCellIterator.cpp` (+5 -8) 📝 `src/buffer/out/OutputCellIterator.hpp` (+5 -11) 📝 `src/cascadia/PublicTerminalCore/HwndTerminal.cpp` (+1 -22) 📝 `src/cascadia/PublicTerminalCore/HwndTerminal.hpp` (+1 -1) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+0 -21) 📝 `src/host/ut_host/CodepointWidthDetectorTests.cpp` (+3 -15) 📝 `src/interactivity/base/EventSynthesis.cpp` (+1 -1) 📝 `src/types/CodepointWidthDetector.cpp` (+355 -457) 📝 `src/types/GlyphWidth.cpp` (+4 -4) 📝 `src/types/convert.cpp` (+0 -34) 📝 `src/types/inc/CodepointWidthDetector.hpp` (+8 -22) 📝 `src/types/inc/GlyphWidth.hpp` (+5 -2) 📝 `src/types/inc/convert.hpp` (+1 -4) 📝 `tools/Generate-CodepointWidthsFromUCD.ps1` (+14 -18) </details> ### 📄 Description My long-term plan is to replace the `CodepointWidth` enum with a simple integer return value that indicates the amount of columns a codepoint is wide. This is necessary so that we can return 0 for ZWJs (zero width joiners). This initial commit represents a cleanup effort around `CodepointWidthDetector`. Since less code runs faster, this change has the nice side-effect of running roughly 5-10% faster across the board. It also drops the binary size by ~1.2kB. ## Validation Steps Performed * `CodepointWidthDetectorTests` passes ✅ * U+26bf (``"`u{26bf}"`` inside pwsh) is a wide glyph in OpenConsole and narrow one in Windows Terminal ✅ --- <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:38:31 +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#30075