* Fix `%p` replacement in build (and print external) commands when no project is open (#4314) * Fix replacing placeholders in replacements. This happened for a long time, but in could cause fairly annoying issues if the replacement did contain a placeholder in an unexpected fashion, and that's usually unexpected with paths and alike. * Support `%%` to insert a literal `%` in build formats. * Use the same algorithm implementation for build, external print command and statusbar format strings. This actually fixes a corner case in the statusbar implementation that would repeat part of the format if the format ended with `%`. * Add test code for the algorithm.
--- If this is too many changes close to a release (although most of them are either legitimately useful, or smaller than they might look at first glance), I can leave out e.g. the `ui_statusbar_update()` changes that are not actually part of an original intended fix. The only fix there is handling a trailing `%`, but it's not of huge importance, and is trivial to fix in the previous code. But we need to fix `%p` before 2.1 at the very least. ## Hints for review * in *ui_utils.c* (278d1901fe28bc6be7d368e4c5a6c056ec485511), check the diff ignoring whitespace changes. A lot of it had little changes but has been unintended 1 level. * in *utils.c*, maybe check the before and after rather than the diff itself, that looks way more confusing because of the few coincidentally identical lines, whereas the algorithm is just entirely different. You can view, comment on, or merge this pull request online at: https://github.com/geany/geany/pull/4318 -- Commit Summary -- * Fix build placeholder replacement * Remove position argument from ui_update_statusbar() * utils: Add utils_replace_placeholders() * Use utils_replace_placeholders() in ui_update_statusbar() * Fix external print command tooltip -- File Changes -- M data/geany.glade (10) M src/build.c (8) M src/callbacks.c (14) M src/document.c (24) M src/editor.c (4) M src/keybindings.c (2) M src/prefs.c (2) M src/printing.c (4) M src/ui_utils.c (254) M src/ui_utils.h (2) M src/utils.c (241) M src/utils.h (6) M tests/test_utils.c (84) -- Patch Links -- https://github.com/geany/geany/pull/4318.patch https://github.com/geany/geany/pull/4318.diff -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/4318 You are receiving this because you are subscribed to this thread. Message ID: <geany/geany/pull/4...@github.com>