feat(target flag): -t expands formats#4903
Conversation
|
I do think a prefix might be better or we are going to risk breaking configs? What do you think? |
|
Oh, of course. I wasn't sure what the motivation behind a prefix was. You had mentioned in the todo list that '+' was a possible prefix, is this still the case, so we would then be looking at target formats being of the form |
|
Maybe we just bite the bullet and expand by default. How many people are going to have Bit of a pity we couldn't use |
|
I initially did not consider that format expansion may break some configs probably because I couldn't imagine a use case for a target looking like a format expansion. I would also estimate that the risk is very low. I am a bit smitten with the idea of -T being the flag for target format expansion, and have compiled a list (the most recent commit) of the current commands that contain a -T flag which would need to be reworked. Some of them seem very low risk, while others WILL break a LOT of configs, those being key binding (key-table specification) and menu display (titles) commands. I really like the idea, but I don't think it is worth it. What is tmux's history with config breaking releases? Take a look at the list and see what you think. If we were to do a prefix, I would suggest '#' because it is on theme, so a target with expansion would look like I find it so unlikely that configs would break that I am comfortable shipping default expansion, though I wouldn't say my intuition is calibrated yet. |
|
People hate it when we break configs and it will cause a lot of confusion and complaining. Realistically we cannot change TBH I would be inclined just to do it by default. How many people are really using |
1cb3597 to
aec0f8c
Compare
aec0f8c to
43c32e2
Compare
|
That works for me! Ready for review then. |
|
Thanks, looks good, I'm probably going to wait for a while see how I like the idea of doing it by default in a few more days... |
This is an implementation of the todo list item:
Expand targets as formats. Should this be done by default or require a prefix (maybe a leading + or just look for #{)?which is feature request from issue #3407. The code treats targets as formats, though this behavior can easily be adjusted to look for a prefix like '+'. The new function
args_get_targethas the same behavior asargs_getand is a drop-in replacement for calls toargs_get(args, 't').One part that I'm not sure about is in
cmdq_find_flagwhere I expand both targets and sources to keep the code footprint light. I believe that this would amount to a no-op on sources, but I am unsure of potential side effects. If there are unwanted side effects, I would either add if checks or split it into two functions.Am I on the right track?