question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Line wrap not working in Windows Terminal

See original GitHub issue

Hi, it seems that line wrap is not working when using Windows Terminal (wt) instead of the default terminal emulator used by pwsh.exe/cmd.exe.

wt_radian_bug

I also did a quick check of running radian within wt inside WSL2-Ubuntu-bash instead of pwsh and suprisingly there it worked:

image

So my feeling is, that is has to do with some environment variables that need to be set or some special workarounds that radian does when running on windows, which aren’t required for wt. (I tested all options that can be set through .radian_profile, e.g. radian.auto_width without success).

Used versions checks on windows:

  • Windows Terminal Preview Version: 1.9.1523.0
  • Radian: 0.5.11
  • Python: 3.8.8
  • R: 4.0.5

Used versions for check on WSL2:

  • Radian: 0.5.11
  • Python: 3.8.5
  • R: 3.6.3

Any advice on how to fix/debug this issue would be greatly appreciated.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
toscmcommented, Jun 19, 2021

Ah, I did not notice that you were using you’re own prompt-toolkit version. Thanks for the explanation. In this case I can see that updating prompt-toolkit has a good chance to solve the problem.

So from my side it would be ok to close the issue now, unless you want to leave it open for other Windows Terminal users who might run into the same problem?

1reaction
toscmcommented, Jun 19, 2021

Thanks for the hint. I checked which version of prompt toolkit I have installed and it’s actually 3.0.18, but I think you’re right anyways.

I tried to step through the code to find out where the line gets cut off and it seems to happen in line 171-172 of console.py (in the output.write_raw(buf); output.flush() part.

radian_ipdb

As a workaround I replaced the output.write_raw(buf); output.flush() with sys.stdout.write(buf); sys.stdout.flush() and it seems to work for now 🥳

radian_workaround radian_fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ability to disable line wrapping in Windows Terminal #6895
Currently Windows Terminal wraps lines by default. It would be great to give an option (in settings json) or a shortcut to toggle...
Read more >
Turn On or Off Wrap Text Output on Resize of Console ...
If you set to use legacy console, then the Wrap text output on resize feature and setting will be disabled and grayed out....
Read more >
Enable Line Wrapping Selection in CMD on Windows 10
Step 3: In the "Command Prompt" Properties dialog, open Options, select Enable line wrapping selection under Text Selection, and then tap OK. Related...
Read more >
How to Enable or Disable Line Wrapping Selection in Console ...
How to Enable or Disable Line Wrapping Selection in Console Window in Windows 10This tutorial will show you how to enable or disable...
Read more >
Allow a user to disable line wrapping in the terminal - YouTrack
the wrapping length for python output on Windows is only 80 characters while running the script on the Windows command prompt will not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found