-
Notifications
You must be signed in to change notification settings - Fork 614
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
[WIP] Feature/combi format string #1123
base: next
Are you sure you want to change the base?
Conversation
I can see the use of adding The option I don't see the point of the linebreak options, I think they will cause a lot of confusion. |
Thanks for taking a look!
Ah, that’s annoying, I agree. Is there a way of escaping them if the mode does not set the style flag?
I admit it’s a bit tricky. The point was to be able to have a nice two line layout where both the mode and parts of the original entry can appear on the first line. That’s only possible if I can have the line break appear either in the |
if you check if the called modi does not set the markup flag, you can use that to escape the returned string. |
source/dialogs/combi.c
Outdated
if ( !(*state & MARKUP) && config.markup_combi ) { | ||
// Mode does not use markup, but we want to, so escape output | ||
char * tmp_str = g_markup_escape_text( str, -1 ); | ||
g_free(str); | ||
str = tmp_str; | ||
*state |= MARKUP; | ||
} | ||
if ( (*state & MARKUP) && !config.markup_combi ) { | ||
// Mode does use markup, but we did not want to, so escape pattern string | ||
char * tmp_str = g_markup_escape_text( format_str, -1 ); | ||
g_free(format_str); | ||
format_str = tmp_str; | ||
} |
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 should take care of the escaping.
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.
To avoid confusion, wouldn't it be better to remove the markup_combi option and always do markup (and convert element that is not markup).
So the combi_display_format option is always a markup string. (don't think this is unreasonable, and how drun-display-format works)
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.
Done! For now, I always enabled markup, without checking if there was a custom combi_display_format set, I hope this is OK (the same as drun, that also enables markup by default).
If you think the other two options are OK, I‘ll try to put some documentation in the man page.
This PR adds the ability to customize the output of combi mode as described here.
I tried using uncrustify but a) got an error (
unknown option 'align_number_left'
), and b) noticed that it changed a bunch of other files, so left it like this for now.It's basically done, but I added WIP because I’m not super familiar with C (would like some code review, it’s pretty short) and I’d still have to write the documentation for it.