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

Unnecessary space added if line contains comment char only #39

Closed
savchenko opened this issue Jan 20, 2024 · 9 comments
Closed

Unnecessary space added if line contains comment char only #39

savchenko opened this issue Jan 20, 2024 · 9 comments

Comments

@savchenko
Copy link

:set ft=bash and add execute :CBllline on an empty commented line.

Before

  #

After

# ──  ─────────────────────────────────────────────────────────────────────────────
@LudoPinelli
Copy link
Owner

Yes, it's because :CBllline is for a titled line (first "l" for the alignement of the line, second "l" for the alignement of the text, then "line", so 3 "l"), it expects that there is a string to align left on the line where the space is.

For a simple full line, the command is :CBlline (just 2 "l").

I agree that it's not very intuitive. I will add a check in case there is no text to avoid this behavior, thanks!

@savchenko
Copy link
Author

savchenko commented Jan 20, 2024

I agree that it's not very intuitive. I will add a check in case there is no text to avoid this behavior, thanks!

Might be worthwhile to merge those two under one function.

if line_contains_text then
    execute CommentWithSpace
else
    execute CommentSimpleLine

@LudoPinelli
Copy link
Owner

LudoPinelli commented Jan 20, 2024

Yes. It's not only the space btw, it's also the symbols before and after the text that are put no matter a text is on the line or not (it didn't show in your example because the symbols before and after the text are set to the same symbol as the one for the line by default).
For example :CBllline10 without text gives:

# ├┤  ├──────────────────────────────────────────────────────────────────┤

I'm currently rewriting the plugin from the ground up for the next version, in part because of this kind of poor design choices. The "simple lines" and "titled lines" won't be treated as two different categories.
But it will take some time, I will make a patch for the current version.

@LudoPinelli
Copy link
Owner

Done!

@savchenko
Copy link
Author

I'm currently rewriting the plugin from the ground up for the next version

Do you plan to land #36 there or as a patch for the current master?

@LudoPinelli
Copy link
Owner

It will be for the the rewritten version, it needs too many changes to be patch for the current one. It's going quite well so far, but I honestly don't know when it will be available.

@savchenko
Copy link
Author

Updated to latest, executing on this line:

        config = function()

CBllline<cr>

Note the offset and spaces.

-- -- config = function() --------------------------------------------------------

:CBlline<cr>

-- -------------------------------------------------------------------------------

@LudoPinelli
Copy link
Owner

Sorry, I don't understand what the problem is in your example?

@savchenko
Copy link
Author

I would expect that from this:

        config = function()

comment-box returns either:

-- ---- config = function() ---------------------------------------------------

or

--      config = function() ---------------------------------------------------

Note the preserved column position.

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