[PR #2831] [MERGED] make filling chars (and, thus, erase line/char) unset wrap #25111

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2831
Author: @carlos-zamora
Created: 9/20/2019
Status: Merged
Merged: 10/1/2019
Merged by: @DHowett-MSFT

Base: masterHead: dev/cazamor/bugfix-conhost-copy


📝 Commits (4)

📊 Changes

9 files changed (+228 additions, -17 deletions)

View changed files

📝 src/buffer/out/Row.cpp (+10 -5)
📝 src/buffer/out/Row.hpp (+1 -1)
📝 src/buffer/out/textBuffer.cpp (+8 -5)
📝 src/buffer/out/textBuffer.hpp (+3 -2)
📝 src/host/_output.cpp (+4 -1)
📝 src/host/ft_host/API_FillOutputTests.cpp (+121 -0)
📝 src/host/screenInfo.cpp (+5 -2)
📝 src/host/screenInfo.hpp (+2 -1)
📝 src/host/ut_host/TextBufferTests.cpp (+74 -0)

📄 Description

Summary of the Pull Request

EraseInLine calls FillConsoleOutputCharacterW(). In filling the row with chars, we were setting the wrap flag. We need to specifically not do this on ANY FILL operation. Now a fill operation UNSETS the wrap flag if we fill to the end of the line.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Originally, we had a boolean setWrap that would mean...

  • true: if writing to the end of the row, SET the wrap value to true
  • false: if writing to the end of the row, DON'T CHANGE the wrap value

Now we're making this bool a std::optional to allow for a ternary state. This allows for us to handle the following cases completely. Refer to the table below:

current wrap value are we filling the last cell in the row? new wrap value COMMENTS
0 0 0
0 0 1 IMPOSSIBLE
0 1 0
0 1 1 THIS CASE WAS RIGHTFULLY HANDLED
1 0 0 THIS CASE WAS UNHANDLED
1 0 1
1 1 0 IMPOSSIBLE
1 1 1

To handle that special case (1-0-0), we need to UNSET the wrap. So now, we have setWrap wrap mean the following:

  • true: if writing to the end of the row, SET the wrap value to TRUE
  • false: if writing to the end of the row, SET the wrap value to FALSE
  • nullopt: leave the wrap value as it is

Validation Steps Performed

I feel like we should add a test for this case. But idk where or how. Help?


🔄 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/2831 **Author:** [@carlos-zamora](https://github.com/carlos-zamora) **Created:** 9/20/2019 **Status:** ✅ Merged **Merged:** 10/1/2019 **Merged by:** [@DHowett-MSFT](https://github.com/DHowett-MSFT) **Base:** `master` ← **Head:** `dev/cazamor/bugfix-conhost-copy` --- ### 📝 Commits (4) - [`8d84ec5`](https://github.com/microsoft/terminal/commit/8d84ec5d03b8b3520221b17a776cae2879e1b2f2) Filling chars (and, thus, erase line/char) should unset wrap - [`aaf936a`](https://github.com/microsoft/terminal/commit/aaf936a29fd79e9a63db671fea8b0169b318b23c) PR comments - [`e59f7d8`](https://github.com/microsoft/terminal/commit/e59f7d8b03b5a03552f0bcc417d141fe65d030f4) added testing - [`424ab72`](https://github.com/microsoft/terminal/commit/424ab72d083be1f934e4c1496ff6ed819695b9f9) make a better test ### 📊 Changes **9 files changed** (+228 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `src/buffer/out/Row.cpp` (+10 -5) 📝 `src/buffer/out/Row.hpp` (+1 -1) 📝 `src/buffer/out/textBuffer.cpp` (+8 -5) 📝 `src/buffer/out/textBuffer.hpp` (+3 -2) 📝 `src/host/_output.cpp` (+4 -1) 📝 `src/host/ft_host/API_FillOutputTests.cpp` (+121 -0) 📝 `src/host/screenInfo.cpp` (+5 -2) 📝 `src/host/screenInfo.hpp` (+2 -1) 📝 `src/host/ut_host/TextBufferTests.cpp` (+74 -0) </details> ### 📄 Description <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request EraseInLine calls `FillConsoleOutputCharacterW()`. In filling the row with chars, we were setting the wrap flag. We need to specifically not do this on ANY _FILL_ operation. Now a fill operation UNSETS the wrap flag if we fill to the end of the line. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #1126 * [x] CLA signed. * [ ] Tests added/passed * [ ] Requires documentation to be updated * [x] I am a core contributor <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments Originally, we had a boolean `setWrap` that would mean... - **true**: if writing to the end of the row, SET the wrap value to true - **false**: if writing to the end of the row, DON'T CHANGE the wrap value Now we're making this bool a std::optional to allow for a ternary state. This allows for us to handle the following cases completely. Refer to the table below: | current wrap value | are we filling the last cell in the row? | new wrap value | COMMENTS | |-- |-- |-- |-- | | 0 | 0 | 0 | | | ~0~ | ~0~ | ~1~ | IMPOSSIBLE | | 0 | 1 | 0 | | | 0 | 1 | 1 | THIS CASE WAS RIGHTFULLY HANDLED | | 1 | 0 | 0 | THIS CASE WAS UNHANDLED | | 1 | 0 | 1 | | | ~1~ | ~1~ | ~0~ | IMPOSSIBLE | | 1 | 1 | 1 | | To handle that special case (1-0-0), we need to UNSET the wrap. So now, we have ~setWrap~ `wrap` mean the following: - **true**: if writing to the end of the row, SET the wrap value to TRUE - **false**: if writing to the end of the row, SET the wrap value to FALSE - **nullopt**: leave the wrap value as it is <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed I feel like we should add a test for this case. But idk where or how. Help? --- <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:07:20 +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#25111