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

[Feature Request]: Make the length of the left aligned adapted box exceed box_width #33

Open
MasouShizuka opened this issue Jan 13, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@MasouShizuka
Copy link

When I use left aligned adapted box, I don't want it to wrap at box_width.
Currently to do this I have to setup like:

{
    doc_width = 10000,
    box_width = 10000,
}

But this will affect other box functions.

Is there a related setting, or can the setting be passed to function, something like:

require("comment-box").albox({ doc_width = 10000, box_width = 10000})
@MasouShizuka
Copy link
Author

By the way, report a few more bugs.

The following function api seem to have not changed, and still have to use the original api, like albox()

require("comment-box").labox()
require("comment-box").cabox()
require("comment-box").arbox()

An error occurs when using titled lines:

E5108: Error executing lua: ...nvim-data/lazy/comment-box.nvim/lua/comment-box/init.lua:678: attempt to perform arithmetic on local 'lend' (a nil value)
stack traceback:
        ...nvim-data/lazy/comment-box.nvim/lua/comment-box/init.lua:678: in function 'create_titled_line'
        ...nvim-data/lazy/comment-box.nvim/lua/comment-box/init.lua:794: in function 'display_titled_line'
        ...nvim-data/lazy/comment-box.nvim/lua/comment-box/init.lua:1014: in function 'llline'
        ...izuka/AppData/Local/nvim/lua/plugins/editing_support.lua:390: in function <...izuka/AppData/Local/nvim/lua/plugins/editing_support.lua:390>

@LudoPinelli
Copy link
Owner

Is there a related setting, or can the setting be passed to function, something like:

require("comment-box").albox({ doc_width = 10000, box_width = 10000})

Not currently, I will think of a way to allow it.

The following function api seem to have not changed, and still have to use the original api, like albox()

require("comment-box").labox()
require("comment-box").cabox()
require("comment-box").arbox()

You're right, it should be fixed now! (I still kept the old ones for now, so both should work)

An error occurs when using titled lines:

E5108: Error executing lua: ...nvim-data/lazy/comment-box.nvim/lua/comment-box/init.lua:678: attempt to perform arithmetic on local 'lend' (a nil value)
stack traceback:
        ...nvim-data/lazy/comment-box.nvim/lua/comment-box/init.lua:678: in function 'create_titled_line'
        ...nvim-data/lazy/comment-box.nvim/lua/comment-box/init.lua:794: in function 'display_titled_line'
        ...nvim-data/lazy/comment-box.nvim/lua/comment-box/init.lua:1014: in function 'llline'
        ...izuka/AppData/Local/nvim/lua/plugins/editing_support.lua:390: in function <...izuka/AppData/Local/nvim/lua/plugins/editing_support.lua:390>

Just to make sure, because I add this bug a couple commits ago, is the plugin updated to the last release in your config? (If you use lazy.nvim -> :Lazy then U)
If so, I can't reproduce the issue, can you tell me on which type of file you tried it?

Thanks for your bug reports and suggestion!

@MasouShizuka
Copy link
Author

I think the reason is that line 678 of init.lua does not detect nil of lstart and lend.

  local is_block
  if math.abs(lend - lstart) > 0 then
    is_block = true
  else
    is_block = false
  end

@LudoPinelli
Copy link
Owner

I think the reason is that line 678 of init.lua does not detect nil of lstart and lend.

  local is_block
  if math.abs(lend - lstart) > 0 then
    is_block = true
  else
    is_block = false
  end

Oh, I was using the command and not the function, it's why I couldn't replicate the problem. And you already found the bug! It's fixed, let me know how it goes, thanks a lot :)

@MasouShizuka
Copy link
Author

Okay, it works.

@LudoPinelli LudoPinelli self-assigned this Jan 13, 2024
@LudoPinelli LudoPinelli added the enhancement New feature or request label Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants