-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
fix(promo): promote/demote range + keybinds #1487
base: main
Are you sure you want to change the base?
Conversation
Looks to be working fine for me. Tried indenting several nested lists with no problem, what issues did you run into re: the indentation? |
@mtrajano the issue stems from e.g. paragraphs. It seems that the indentation is cumulative: with the following snippet:
Doing a ranged promotion indents the paragraph twice as far:
This isn't the absolute end of the world, but would be nice to have fixed somehow 🤔 edit: wow, github rendering makes the indentation look really bad in the code block. it's less bad in a Norg buffer haha |
8f89476
to
0d62d30
Compare
Now this behaves itself a little better. There is still one behavior that might be unexpected. If you promote:
Normal text is correctly indented. But if you promote:
Then "normal text" is indented, while "list item" is promoted. However, this case:
"new paragraph" is not indented. I think this behavior is fine. It allows visual |
Changes make sense to make, there's just a random print statement there |
0d62d30
to
8792470
Compare
local current_visual_indent = vim.fn.indent(row + 1) | ||
local new_indent = math.max(0, current_visual_indent + n_space_diff) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also feels internal to the indent module. Shouldn't have to pass it an indent, just a bufnr and a range/line number and it should be able to figure it out
@@ -28,17 +28,21 @@ local neorg = require("neorg.core") | |||
local modules = neorg.modules | |||
|
|||
local module = modules.create("core.promo") | |||
local indent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be part of module.private
, not sure what the convention around this is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this convention, vhyrro and I have gone back and forth on this in the past as well.
---@param buffer number | ||
---@param start_row number 0 based | ||
---@param new_indent number | ||
buffer_set_line_indent = function(buffer, start_row, new_indent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename to reindent_line
just to be consistent with the above, and rename the start_row
to line
@benlubas the new behaviour is much better than what we had previously, so that sounds good enough for the time being. Running out of time today, but I'll revisit this PR tomorrow :) |
what it says on the tin. These were broken/removed a while ago. Presumably due to concealer changes but I'm not sure. Someone asked about bringing them back today, so here they are.
The re-indentation code in this module seems to struggle a little though. Not sure what's up with that.