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

header align bug #126

Closed
hyawara opened this issue Aug 25, 2024 · 13 comments · Fixed by #127
Closed

header align bug #126

hyawara opened this issue Aug 25, 2024 · 13 comments · Fixed by #127

Comments

@hyawara
Copy link

hyawara commented Aug 25, 2024

First open file, header like this:

image

and after the buffer is switched again, the buffer becomes normal

image

header config:

            headings = {
                enable = true,
                shift_width = 0,
                textoff = 9,
                heading_1 = {
                    style = 'label',
                    align = 'center',
                    hl = 'CursorLineNr',
                    icon = '',
                    sign = '',
                    sign_hl = 'CursorLineNr',
                },
                heading_2 = {
                    style = 'label',
                    align = 'center',
                    hl = 'Character',
                    icon = '',
                    sign = '',
                    sign_hl = 'Character',
                },
                heading_3 = {
                    style = 'label',
                    align = 'center',
                    hl = 'DiagnosticInfo',
                    icon = '',
                    sign = '',
                    sign_hl = 'DiagnosticInfo',
                },
                heading_4 = {
                    style = 'label',
                    align = 'center',
                    hl = 'Identifier',
                    icon = '',
                    sign = '',
                    sign_hl = 'Identifier',
                },
                heading_5 = {
                    style = 'label',
                    align = 'center',
                    hl = 'Identifier',
                    icon = '',
                    sign = '',
                    sign_hl = 'Identifier',
                },
                heading_6 = {
                    style = 'label',
                    align = 'center',
                    hl = 'Identifier',
                    icon = '',
                    sign = '',
                    sign_hl = 'Identifier',
                },
            },
@OXY2DEV
Copy link
Owner

OXY2DEV commented Aug 25, 2024

You don't happen to use a file-tree plugin, do you?

The plugin gets the width of the current window(as it's impossible to get the width of the window containing the buffer since multiple windows with various sizes can have the same buffer). So, if you opened it via some other plugin it will look like that.

@hyawara
Copy link
Author

hyawara commented Aug 25, 2024

Yes, i use the neo-tree plugin.

I understand, thank you

@hyawara hyawara closed this as completed Aug 25, 2024
OXY2DEV added a commit that referenced this issue Aug 25, 2024
Current window width is used as a fallback.

Ref: #126
@OXY2DEV
Copy link
Owner

OXY2DEV commented Aug 25, 2024

@hyawara, It should work now. Can you check again?

@hyawara
Copy link
Author

hyawara commented Aug 25, 2024

@hyawara, It should work now. Can you check again?

Give me a second. I'll try. I'll get back to you

@hyawara
Copy link
Author

hyawara commented Aug 25, 2024

20240825_233903.mp4

I need to move it to make it work.

But it worked out. You were very efficient, thanks.

@OXY2DEV
Copy link
Owner

OXY2DEV commented Aug 25, 2024

Does it work now?

@hyawara
Copy link
Author

hyawara commented Aug 25, 2024

I'll try it tomorrow morning. 😁

@hyawara
Copy link
Author

hyawara commented Aug 26, 2024

There are still some problems @OXY2DEV

1724633973607-20240826_085758.mp4

@OXY2DEV
Copy link
Owner

OXY2DEV commented Aug 26, 2024

It should be fixed now.

@hyawara
Copy link
Author

hyawara commented Aug 26, 2024

Do you know how to listen for buffer window size changes? I think it should be the problem.

1724646370747-20240826_122523.mp4

@OXY2DEV
Copy link
Owner

OXY2DEV commented Aug 26, 2024

WinResized won't be used by the plugin.

For example, you have a file opened in a window and hit :vsp.

Now, you have 2 windows containing the same buffer. Now if you resize one of them that window will have the correct alignment but the other window will have an incorrect alignment.

There's no relation between buffers & windows. So, there's no good way to use WinResize to update the buffer.


Also, someone famous once said, "If you always have your file browser open, I have a lot of questions and the only important one is, 'Why?'"

So, there's no point in adding something for every niche case.

@hyawara
Copy link
Author

hyawara commented Aug 26, 2024

Could you provide me with a copy of your nvim configuration for my reference? thank you

@OXY2DEV
Copy link
Owner

OXY2DEV commented Aug 26, 2024

OXY2DEV/nvim

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

Successfully merging a pull request may close this issue.

2 participants