Failing to clear wrapped line #6668

Closed
opened 2026-01-31 00:44:19 +00:00 by claunia · 9 comments
Owner

Originally created by @Liamolucko on GitHub (Mar 1, 2020).

Environment

Windows build number: 10.0.18362.657
Windows Terminal version (if applicable): Not sure; latest version on Microsoft Store as of 2020-03-01

Any other software?
PowerShell 6.2.4
Python 3.7.6
TensorFlow 1.14.0

Steps to reproduce

Run a TensorFlow program which attempts to clear a line that exceeds the size of the window and is wrapped onto the next line.
If the window is wide enough to fit the entire line, this is not an issue.

Expected behavior

The entire 'line' should be deleted

212/723 [=======>......................] - ETA: 25:52 - loss: 1.6581 - rpn_class_loss: 0.0278 - rpn_
bbox_loss: 0.3465 - mrcnn_class_loss: 0.3752 - mrcnn_bbox_loss: 0.4602 - mrcnn_mask_loss: 0.4483

Actual behavior

Only the last line of the wrapped line is cleared, leaving behind lots of cut off lines.

190/723 [======>.......................] - ETA: 27:10 - loss: 1.6521 - rpn_class_loss: 0.0285 - rpn_
191/723 [======>.......................] - ETA: 27:06 - loss: 1.6524 - rpn_class_loss: 0.0284 - rpn_
192/723 [======>.......................] - ETA: 27:02 - loss: 1.6509 - rpn_class_loss: 0.0283 - rpn_
193/723 [=======>......................] - ETA: 26:58 - loss: 1.6483 - rpn_class_loss: 0.0284 - rpn_
194/723 [=======>......................] - ETA: 26:54 - loss: 1.6486 - rpn_class_loss: 0.0283 - rpn_
195/723 [=======>......................] - ETA: 26:51 - loss: 1.6507 - rpn_class_loss: 0.0282 - rpn_
196/723 [=======>......................] - ETA: 26:47 - loss: 1.6606 - rpn_class_loss: 0.0281 - rpn_
197/723 [=======>......................] - ETA: 26:43 - loss: 1.6626 - rpn_class_loss: 0.0282 - rpn_
198/723 [=======>......................] - ETA: 26:40 - loss: 1.6598 - rpn_class_loss: 0.0282 - rpn_
199/723 [=======>......................] - ETA: 26:36 - loss: 1.6653 - rpn_class_loss: 0.0281 - rpn_
200/723 [=======>......................] - ETA: 26:33 - loss: 1.6666 - rpn_class_loss: 0.0282 - rpn_
201/723 [=======>......................] - ETA: 26:30 - loss: 1.6665 - rpn_class_loss: 0.0283 - rpn_
202/723 [=======>......................] - ETA: 26:28 - loss: 1.6713 - rpn_class_loss: 0.0283 - rpn_
203/723 [=======>......................] - ETA: 26:24 - loss: 1.6662 - rpn_class_loss: 0.0283 - rpn_
204/723 [=======>......................] - ETA: 26:20 - loss: 1.6652 - rpn_class_loss: 0.0282 - rpn_
205/723 [=======>......................] - ETA: 26:16 - loss: 1.6606 - rpn_class_loss: 0.0281 - rpn_
206/723 [=======>......................] - ETA: 26:13 - loss: 1.6575 - rpn_class_loss: 0.0281 - rpn_
207/723 [=======>......................] - ETA: 26:09 - loss: 1.6591 - rpn_class_loss: 0.0280 - rpn_
208/723 [=======>......................] - ETA: 26:05 - loss: 1.6565 - rpn_class_loss: 0.0279 - rpn_
209/723 [=======>......................] - ETA: 26:03 - loss: 1.6592 - rpn_class_loss: 0.0279 - rpn_
210/723 [=======>......................] - ETA: 25:59 - loss: 1.6577 - rpn_class_loss: 0.0280 - rpn_
211/723 [=======>......................] - ETA: 25:56 - loss: 1.6591 - rpn_class_loss: 0.0279 - rpn_
212/723 [=======>......................] - ETA: 25:52 - loss: 1.6581 - rpn_class_loss: 0.0278 - rpn_
bbox_loss: 0.3465 - mrcnn_class_loss: 0.3752 - mrcnn_bbox_loss: 0.4602 - mrcnn_mask_loss: 0.4483
Originally created by @Liamolucko on GitHub (Mar 1, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.18362.657 Windows Terminal version (if applicable): Not sure; latest version on Microsoft Store as of 2020-03-01 Any other software? PowerShell 6.2.4 Python 3.7.6 TensorFlow 1.14.0 ``` # Steps to reproduce Run a TensorFlow program which attempts to clear a line that exceeds the size of the window and is wrapped onto the next line. If the window is wide enough to fit the entire line, this is not an issue. # Expected behavior The entire 'line' should be deleted ``` 212/723 [=======>......................] - ETA: 25:52 - loss: 1.6581 - rpn_class_loss: 0.0278 - rpn_ bbox_loss: 0.3465 - mrcnn_class_loss: 0.3752 - mrcnn_bbox_loss: 0.4602 - mrcnn_mask_loss: 0.4483 ``` # Actual behavior Only the last line of the wrapped line is cleared, leaving behind lots of cut off lines. ``` 190/723 [======>.......................] - ETA: 27:10 - loss: 1.6521 - rpn_class_loss: 0.0285 - rpn_ 191/723 [======>.......................] - ETA: 27:06 - loss: 1.6524 - rpn_class_loss: 0.0284 - rpn_ 192/723 [======>.......................] - ETA: 27:02 - loss: 1.6509 - rpn_class_loss: 0.0283 - rpn_ 193/723 [=======>......................] - ETA: 26:58 - loss: 1.6483 - rpn_class_loss: 0.0284 - rpn_ 194/723 [=======>......................] - ETA: 26:54 - loss: 1.6486 - rpn_class_loss: 0.0283 - rpn_ 195/723 [=======>......................] - ETA: 26:51 - loss: 1.6507 - rpn_class_loss: 0.0282 - rpn_ 196/723 [=======>......................] - ETA: 26:47 - loss: 1.6606 - rpn_class_loss: 0.0281 - rpn_ 197/723 [=======>......................] - ETA: 26:43 - loss: 1.6626 - rpn_class_loss: 0.0282 - rpn_ 198/723 [=======>......................] - ETA: 26:40 - loss: 1.6598 - rpn_class_loss: 0.0282 - rpn_ 199/723 [=======>......................] - ETA: 26:36 - loss: 1.6653 - rpn_class_loss: 0.0281 - rpn_ 200/723 [=======>......................] - ETA: 26:33 - loss: 1.6666 - rpn_class_loss: 0.0282 - rpn_ 201/723 [=======>......................] - ETA: 26:30 - loss: 1.6665 - rpn_class_loss: 0.0283 - rpn_ 202/723 [=======>......................] - ETA: 26:28 - loss: 1.6713 - rpn_class_loss: 0.0283 - rpn_ 203/723 [=======>......................] - ETA: 26:24 - loss: 1.6662 - rpn_class_loss: 0.0283 - rpn_ 204/723 [=======>......................] - ETA: 26:20 - loss: 1.6652 - rpn_class_loss: 0.0282 - rpn_ 205/723 [=======>......................] - ETA: 26:16 - loss: 1.6606 - rpn_class_loss: 0.0281 - rpn_ 206/723 [=======>......................] - ETA: 26:13 - loss: 1.6575 - rpn_class_loss: 0.0281 - rpn_ 207/723 [=======>......................] - ETA: 26:09 - loss: 1.6591 - rpn_class_loss: 0.0280 - rpn_ 208/723 [=======>......................] - ETA: 26:05 - loss: 1.6565 - rpn_class_loss: 0.0279 - rpn_ 209/723 [=======>......................] - ETA: 26:03 - loss: 1.6592 - rpn_class_loss: 0.0279 - rpn_ 210/723 [=======>......................] - ETA: 25:59 - loss: 1.6577 - rpn_class_loss: 0.0280 - rpn_ 211/723 [=======>......................] - ETA: 25:56 - loss: 1.6591 - rpn_class_loss: 0.0279 - rpn_ 212/723 [=======>......................] - ETA: 25:52 - loss: 1.6581 - rpn_class_loss: 0.0278 - rpn_ bbox_loss: 0.3465 - mrcnn_class_loss: 0.3752 - mrcnn_bbox_loss: 0.4602 - mrcnn_mask_loss: 0.4483 ```
Author
Owner

@Liamolucko commented on GitHub (Mar 1, 2020):

This is probably related to the issues in #4200

@Liamolucko commented on GitHub (Mar 1, 2020): This is probably related to the issues in #4200
Author
Owner

@Liamolucko commented on GitHub (Mar 1, 2020):

This doesn't seem to be an issue with Windows Terminal - it happens in both PowerShell and Command Prompt in the default windows shell, so it's probably an issue with TensorFlow.

@Liamolucko commented on GitHub (Mar 1, 2020): This doesn't seem to be an issue with Windows Terminal - it happens in both PowerShell and Command Prompt in the default windows shell, so it's probably an issue with TensorFlow.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 1, 2020):

Huh, thanks for following up. Does it reproduce in other terminals that work like xterm? That’s the compatibility level we’re going for :)

@DHowett-MSFT commented on GitHub (Mar 1, 2020): Huh, thanks for following up. Does it reproduce in other terminals that work like xterm? That’s the compatibility level we’re going for :)
Author
Owner

@Liamolucko commented on GitHub (Mar 1, 2020):

I tried it in Git Bash & Cygwin, since they both use mintty, but it doesn't seem to support deleting lines at all.

@Liamolucko commented on GitHub (Mar 1, 2020): I tried it in Git Bash & Cygwin, since they both use mintty, but it doesn't seem to support deleting lines at all.
Author
Owner

@Liamolucko commented on GitHub (Mar 14, 2020):

Okay, I've figured out that the specific problem is that TensorFlow is using carriage return (\r) for this.

My test:

for i in range(5):
    print((str(i) * 200) + '\r', end='')

print()

Note: I added the empty print() statement at the end so that the terminal wouldn't overwrite the last line.

Expected:

444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
44444444444444444444444444444444444444444444444444444444444444444444444444444444

Output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
44444444444444444444444444444444444444444444444444444444444444444444444444444444

Note: This also occured in VS Code's integrated terminal

Strangely, MinTTY had the same behaviour as Command Prompt and Windows Terminal this time.

@Liamolucko commented on GitHub (Mar 14, 2020): Okay, I've figured out that the specific problem is that TensorFlow is using carriage return (\r) for this. My test: ```python for i in range(5): print((str(i) * 200) + '\r', end='') print() ``` **Note:** I added the empty print() statement at the end so that the terminal wouldn't overwrite the last line. Expected: ``` 444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 44444444444444444444444444444444444444444444444444444444444444444444444444444444 ``` Output: ``` 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 44444444444444444444444444444444444444444444444444444444444444444444444444444444 ``` **Note:** This also occured in VS Code's integrated terminal Strangely, MinTTY had the same behaviour as Command Prompt and Windows Terminal this time.
Author
Owner

@Liamolucko commented on GitHub (Mar 14, 2020):

Should this issue be fixed? It seems to happen in pretty much every terminal.

It behaves this way in:

  • Windows Terminal
  • Command Prompt
  • MinTTY
  • VS Code Integrated Terminal
  • Terminal.app
@Liamolucko commented on GitHub (Mar 14, 2020): Should this issue be fixed? It seems to happen in pretty much every terminal. It behaves this way in: - Windows Terminal - Command Prompt - MinTTY - VS Code Integrated Terminal - Terminal.app
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 14, 2020):

Say, are you using python for Windows or python inside WSL?

@DHowett-MSFT commented on GitHub (Mar 14, 2020): Say, are you using python for Windows or python inside WSL?
Author
Owner

@Liamolucko commented on GitHub (Mar 16, 2020):

Python for Windows, versions 3.7.6 and 3.8.0.

I just tested it on WSL though, same behaviour (Python 3.6.7)

@Liamolucko commented on GitHub (Mar 16, 2020): Python for Windows, versions 3.7.6 and 3.8.0. I just tested it on WSL though, same behaviour (Python 3.6.7)
Author
Owner

@zadjii-msft commented on GitHub (Mar 16, 2020):

I'm gonna say that this should be resolved as "by-design". I just tried this out in gnome-terminal and I'm seeing the same behavior with your simple repro case as what happens in conhost and Windows Terminal. I'd bet that this is just a misunderstanding by the TensorFlow maintainers that \r won't take you to the beginning of a wrapped line if the line started on another row, it'll only take you to the start of the current row.

@zadjii-msft commented on GitHub (Mar 16, 2020): I'm gonna say that this should be resolved as "by-design". I just tried this out in `gnome-terminal` and I'm seeing the same behavior with your simple repro case as what happens in `conhost` and Windows Terminal. I'd bet that this is just a misunderstanding by the TensorFlow maintainers that `\r` won't take you to the beginning of a wrapped line if the line started on another row, it'll only take you to the start of the current row.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6668