helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
32.93k stars 2.43k forks source link

:sh doesn't render tabs correctly #9189

Open Kelatte opened 8 months ago

Kelatte commented 8 months ago

Summary

I have a txt file o. in Helix, typing :sh cat o doesn't output the whole file.

Similarly, if a program output contains tabs, the same problem happens.

If I delete the tabs in o, everything goes fine.

No error message.

Reproduction Steps

录屏 2023-12-30 09-26-21.webm

I tried this:

  1. sh cat o

I expected this to happen:

the full file is printed

Instead, this happened:

several lines in the end are not printed.

Helix log

~/.cache/helix/helix.log ``` please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines ```

Platform

Linux

Terminal Emulator

gnome-terminal v3.48.1 with GNOME 44

Installation Method

dnf

Helix Version

helix 23.10 (f6021dd0)

pascalkuthe commented 8 months ago

This is cause by us essentially rendering shell output as a markdown codeblock. I am not sure why but the Tabs throw off the markdown parser.

I think it was never a good idea to implement it this way since command output is not necessarily valid shell (and even less likely valid inside markdown).

IMO we should just render this as plaintext or use TS directly in a custom component.

It seems the current rendering code rendering Tabs woth a width of 0. In general I don't trust that text rendering code too much and want to replace it with our existing textrenderong infrastructure anyway.

mo8it commented 6 months ago

What about opening the output (if it exists) in a new, temporary buffer? That would enable all editor capabilities like navigation, copying etc. Adding support for ANSI highlighting to that buffer would be awesome! ✨