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.

[REQUEST] tab_size=None keeps and doesn't replace tab-characters

See original GitHub issue

Have you checked the issues for a similar suggestions? I have googled, but couldn’t find any discussion naming this issue.

I have found no way to set tab_size in the console to None, meaning that tab-characters should not be replaced and kept as-is.

Give as much detail as you can. Example code of how you would like it to work would help.

What I’d like to achieve is the ability to print a csv-table with tabulators as delimiters. Yet I have found no way to do that using rich - all tabulator-characters are replaced with a varying amount of spaces.

>>> from rich.console import Console
>>> c = Console(tab_size=None)
>>> c.print("a\tb")
a       b
>>> print("a\t")  # I'd like to have an option to get this output from rich as well
a\tb

What problem do you have that this feature would solve? I may be able to suggest an existing way of solving it.

In rich text it should be possible to print a tab-character as-is 😃.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
fjellvannetcommented, May 26, 2022

That completely does the trick! Thank you very much for your fast answer

tor. 26. mai 2022, 17:01 skrev Will McGugan @.***>:

Got you. Literal tab characters will pretty much break any kind of formatting Rich does, which is why they are replaced with spaces.

I’d suggest doing this:

if console.is_terminal: print_table(my_csv)else: console.file.write(my_csv)

— Reply to this email directly, view it on GitHub https://github.com/Textualize/rich/issues/2298#issuecomment-1138673182, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLABQCBQRVRBTRNPU5TSPTVL6G3FANCNFSM5XBHVTJQ . You are receiving this because you authored the thread.Message ID: @.***>

0reactions
github-actions[bot]commented, May 26, 2022

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: tabSize affects indentation #10339 - microsoft/vscode
When getting the new `indentSize` option programatically, it always returns a numeric value (just as `tabSize` does when set to the deprecated "auto"...
Read more >
Visual Studio replace tab with 4 spaces? - Stack Overflow
Change Tab to use "Insert Spaces" instead of "Keep Tabs". ... the options of the tab size in Visual Studio but it still...
Read more >
Tabs and indents settings does not work
Go to Settings and change indentation to Tab; Go back to file and press Enter so it creates new line (e.g. after opening...
Read more >
Add option to control tab width when viewing files - GitLab
Tabulation character (0x09, \t) is always rendered with a width of 8 spaces, but many projects use 4 spaces for the width of...
Read more >
Options, Text Editor, All Languages, Tabs - Visual Studio ...
When selected, indent operations insert only space characters, not TAB characters. If the Indent size is set to 5, for example, then five...
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