tibirna / qgit

Official git repository for QGit.
Other
174 stars 68 forks source link

custom actions - custom parameters issue #19

Closed pasnox closed 1 year ago

pasnox commented 6 years ago

When using more than one custom parameter (ie, echo --%lineedit:family=my family% --%lineedit:name=my name%) the final command is broken, looking at the code (https://github.com/tibirna/qgit/blob/master/src/inputdialog.cpp#L192), the replace logic seems wrong. It assume the start/end pos are fixed an not moved, but everything is out of sync as soon as you replaced something before the currently replaced variable. To continue to use your current code logic, you need to ensure to replace variables in the reverse order they appears in the command, from far right to far left, ie the variable having the highest start pos is to replace first and so on.

negora commented 6 years ago

I think it would be fantastic to have this problem fixed. Being able to input only 1 parameter prevents us to enjoy this powerful feature at 100%.

negora commented 4 years ago

Are there any news about this issue?

I've found a case that I don't know whether it's related to this issue. It's puzzling me a lot. Take a look, please.

Consider that I run this script, and I leave the text boxes empty:

parameterA=%lineedit:a%
parameterB=%lineedit:b%

This makes QGit to fail, because it produces this command:

parameterA=
parameterB=%lineedit:b%

However, if I switch the labels of the parameters:

parameterA=%lineedit:b%
parameterB=%lineedit:a%

QGit produces the right command:

parameterA=
parameterB=

Why? It looks like the alphabetic order of the labels is relevant for their substitution.

tibirna commented 1 year ago

Fixed.