Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal output messes up and wraps at 80 characters #1416

Open
DasGandlaf opened this issue Jan 7, 2025 · 2 comments
Open

Terminal output messes up and wraps at 80 characters #1416

DasGandlaf opened this issue Jan 7, 2025 · 2 comments

Comments

@DasGandlaf
Copy link

DasGandlaf commented Jan 7, 2025

Debug adapter definition and debug configuration

Using nvim-dap with nvim-dap-ui

Debug adapter version

No response

Steps to Reproduce

Start a program, open nvim-dap-ui terminal, and see that terminal output is wrapped:
image

Expected Result

Should not wrap the terminal output. When user enables wrapping, it should wrap on the window width.

Actual Result

Terminal output wraps.

The width 80 is specified in session.lua. This width is passed to the vim pty that's started. The vim pty is what causes the problem I think, since a fixed width has to be passed, and it wraps based on that.

This is a major issue for viewing console logs. When viewing longer stack traces it's very hard to read what's going on.

Now there is a another issue as well, but I am not sure if this happens due to the wrapping or not. Here an example of the terminal output:

  1. I print =================================...
  2. An error gets thrown afterwards

Even though I print before the error happens, the characters get wrongly mixed into the error:

1: panic: reached unreachable code=====================================
2: C:\Users\user\game.zig:155:
3:              unreachable;=======================================================
4: =============^

However, when I print the lines received from on_stdout in order, this is what I get:

1: ==============================================================================
2: panic: reached unreachable code
3: C:\Users\user\game.zig:155:
4:              unreachable;
5:              ^

The order and the messages are correct here, but once the pty vim window is reached, the output gets messed up.

Are there any solution to these problems?

Thanks for your awesome plugins and your help!

@mfussenegger
Copy link
Owner

80 is only used as fallback if there is no terminal_win provided. That's only the case with custom terminal_win_cmd implementations.

Looks like nvim-dap-ui sets one: https://github.com/rcarriga/nvim-dap-ui/blob/e94d98649dccb6a3884b66aabc2e07beb279e535/lua/dapui/elements/console.lua#L51

In addition to returning the buffer it would have to return the window number.

That said, using vim.o.columns might be a better fallback than 80

@DasGandlaf
Copy link
Author

DasGandlaf commented Jan 7, 2025

Thanks for your answer!

When I use vim.o.columns, this is what I get:

1: ====================================================================
2: ====
3: ====================================================================
4: ====
5: ==================================

It just wraps at random locations, instead of not wrapping at all.

As a side point, generally, the entire terminal output is super buggy too. When resizing the window, lines get duplicated, moved to the wrong spots, characters disappear, etc.

Not sure if this happens only on my PC, please do let me know!

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants