-
Notifications
You must be signed in to change notification settings - Fork 529
[#954] parser.rs: enable multiline descriptions #962
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
base: master
Are you sure you want to change the base?
[#954] parser.rs: enable multiline descriptions #962
Conversation
Thanks for opening this pull request! |
…g on item.comment
bd9876f
to
4ce58fd
Compare
I'm not sure I understand your question correctly, but I will comment on what I understand about Lines 113 to 114 in 6f1bbcf
In manual of fzf:
Does this help? |
…locks with multiple lines (only fzf supported)
It did. Thanks!! I hadn't realized that the delimiter could be used for multiple columns within |
3d8cb7b
to
57c7c90
Compare
It looks good @gabriel-vanzandycke , thanks! Could you link this PR to your issue ? |
Caveats of this PR: |
Personally, I don't think it's going to be a big issue, it would be a breaking change for sure to people mainly using this feature but it might make sense if we're moving forward to allow converting other cheatsheet types into navi cheatsheets (see #891) and introducing a syntax parser for cheatsheets (see #948). To me, we can take two roads from here regarding the columns, both are breaking changes with the current implementation:
The second option would be viable IF modifying the order of the columns is not something a lot of users do. |
Implementing the first option doesn't necessarily need to be done in this PR as it implies a breaking change anyway... |
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 think the change in the parsing multiline descriptions is compatible, but the change in the display part is a breaking change.
I think it is better to avoid this breaking change.
How about adding an option to display descriptions and snippets on multiple lines.
To add a note about the --with-nth
option, it can be used not only for reordering columns but also for selecting which columns to display.
Thanks @kit494way for your review !
An option specific for multilines rendering is anyway mutually exclusive with column selection option I believe giving users the ability to select columns another way is the best option in term of code maintenance, but it's a breaking change. |
I agree but it would be best to decide how we're going to change this for users before breaking the current behavior. |
2e0c169
to
643e74a
Compare
Can someone assist me for setting up tests ? |
I won't be able to help you on that but maybe those references can help: |
Can't run |
If needed, I can trigger the tests on GitHub, just let me know. |
@@ -258,14 +258,15 @@ impl<'a> Parser<'a> { | |||
|
|||
// blank | |||
if line.is_empty() { | |||
if !item.snippet.is_empty() { | |||
if !item.snippet.is_empty() && inside_snippet { | |||
item.snippet.push_str(deser::LINE_SEPARATOR); | |||
} | |||
} | |||
// tag | |||
else if line.starts_with('%') { | |||
should_break = self.write_cmd(&item).is_err(); | |||
item.snippet = String::from(""); |
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 someone enlighten me on why the item is reset rather than creating a new item object when we move to the next item ? (It makes me wonder each time I'm in this file)
Thanks. |
If you successfully installed act, you just need to be in the directory of navi (where act push It should trigger both CI/Lints and CI/Tests. |
Thanks. I ran |
Great @gabriel-vanzandycke ! I am waiting for the approval of @kit494way and @denisidoro on this PR and since it contains breaking changes I don't know if we wait to merge it in a later major release or we upgrade the next release from a minor to a major release. I would like to at least merge it after #955 . EDIT: When I say a major release I mean a release with breaking changes. |
Please make displaying multiple lines optional. |
@@ -119,7 +119,7 @@ impl FinderChoice { | |||
]); | |||
|
|||
if !opts.show_all_columns { | |||
command.args(["--with-nth", "1,2,3"]); | |||
command.args(["--read0", "--print0", "--with-nth", "1"]); |
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.
It is better to rename show_all_columns
or introduce another option for --read0
and --print0
because --read0
and --print0
do not control the number of columns to display.
I agree with @kit494way. Let's make this opt-in. Otherwise, people may import cheatsheets using this syntax and be surprised by the behavior. I'll approve the PR once this is addressed. |
Hi @gabriel-vanzandycke , |
Hello, no, I haven't had the time to look into this, sorry. |
No worries. ^^ I just wanted to check on you, you can take the time you need to work on this PR. |
This PR adds the possibility to split description into multiple lines.
Resolves #954
The following cheat sheet:
Yields the following result:
