Rows should remember their width (MeasureRight()) #22199

Open
opened 2026-01-31 08:06:16 +00:00 by claunia · 4 comments
Owner

Originally created by @0x152a on GitHub (Sep 1, 2024).

Windows Terminal version

1.21.2361.0

Windows build number

10.0.22631.0

Other Software

  • System Language: zh_cn
  • Console Font: Hack Nerd Font Mono
  • Font Size: 12

Steps to reproduce

  1. Print more than two lines ending with space and causing line wrap
# `120` here is my console width
for i in range(2):
    print('x' * 120 + ' ')
print('yya')
input('--')
  1. Resize the window to change the console width.

Expected Behavior

Cursor should be after -- of input('--') throughout the process

Actual Behavior

After resize, cursor is before a of print('yya')

  • Before resize: (width is 120)
    image
  • After resize: (width is 121, line wrap here seems wrong too)
    image
Originally created by @0x152a on GitHub (Sep 1, 2024). ### Windows Terminal version 1.21.2361.0 ### Windows build number 10.0.22631.0 ### Other Software - System Language: `zh_cn` - Console Font: `Hack Nerd Font Mono` - Font Size: 12 ### Steps to reproduce 1. Print more than two lines ending with space and causing line wrap ```python # `120` here is my console width for i in range(2): print('x' * 120 + ' ') print('yya') input('--') ``` 2. Resize the window to change the console width. ### Expected Behavior Cursor should be after `--` of `input('--')` throughout the process ### Actual Behavior After resize, cursor is before `a` of `print('yya')` - Before resize: (width is 120) ![image](https://github.com/user-attachments/assets/16eeecb3-13f2-4ab3-b50e-414d19449838) - After resize: (width is 121, line wrap here seems wrong too) ![image](https://github.com/user-attachments/assets/5367ebff-e1b4-427f-b95d-b96e246b0ae1)
claunia added the Area-OutputIssue-BugProduct-Conpty labels 2026-01-31 08:06:16 +00:00
Author
Owner

@ayush1233 commented on GitHub (Sep 2, 2024):

I want to work on this issue

@ayush1233 commented on GitHub (Sep 2, 2024): I want to work on this issue
Author
Owner

@carlos-zamora commented on GitHub (Sep 25, 2024):

Thanks for filing! We recently rewrote ConPty. Mind checking v1.22 (Preview) to see if it got fixed /?

Also, thanks @ayush1233!

@carlos-zamora commented on GitHub (Sep 25, 2024): Thanks for filing! We recently rewrote ConPty. Mind checking v1.22 (Preview) to see if it got fixed /? Also, thanks @ayush1233!
Author
Owner

@0x152a commented on GitHub (Sep 27, 2024):

@carlos-zamora

Mind checking v1.22 (Preview) to see if it got fixed /?

Thank you for the update. I've tested version 1.22.240823002-preview and found that the cursor position issue has been resolved.

However, I've noticed that the line wrapping still seems to be incorrect. That is, the spaces at the end of lines seem to be ignored after adjusting the window width. (Maybe I should open another issue?)

wt-issue

@0x152a commented on GitHub (Sep 27, 2024): @carlos-zamora > Mind checking v1.22 (Preview) to see if it got fixed /? Thank you for the update. I've tested version `1.22.240823002-preview` and found that the cursor position issue has been resolved. However, I've noticed that the line wrapping still seems to be incorrect. That is, the spaces at the end of lines seem to be ignored after adjusting the window width. (Maybe I should open another issue?) ![wt-issue](https://github.com/user-attachments/assets/3ccb1490-c2b2-41fe-a28d-35f5bce91260)
Author
Owner

@lhecker commented on GitHub (Sep 27, 2024):

That is, the spaces at the end of lines seem to be ignored after adjusting the window width.

That's a known issue that we're hoping to address at some point. I'm not entirely sure if we have an issue to track it though. We could repurpose this one for it.

The reason that happens is because our text buffer does not keep track of how much text you wrote on any given line. To it, there's no difference between whitespace and no text at all, and so it gets truncated during resize.

@lhecker commented on GitHub (Sep 27, 2024): > That is, the spaces at the end of lines seem to be ignored after adjusting the window width. That's a known issue that we're hoping to address at some point. I'm not entirely sure if we have an issue to track it though. We could repurpose this one for it. The reason that happens is because our text buffer does not keep track of how much text you wrote on any given line. To it, there's no difference between whitespace and no text at all, and so it gets truncated during resize.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22199