fix: keep the flag in front of a bare double dash

Discord's entry is `discord --url -- %u`. The flag went in before the
field code, which put it after the double dash, and that is where
Chromium stops reading switches and starts treating everything as an
address. The feature never came on.
This commit is contained in:
Felitendo committed 2026-09-24 08:24:15 +02:00
1 parent da291cefa5
commit 2401855b70
1 file changed
+6 -1
+6 -1
View File
@@ -71,6 +71,11 @@ MCA_FEATURE_OPTS='--enable-blink-features|--enable-features'
# Where an argument has to go: after the program and its own arguments, but # Where an argument has to go: after the program and its own arguments, but
# before the first field code (%U and friends) or Flatpak's @@ markers, which # before the first field code (%U and friends) or Flatpak's @@ markers, which
# are placeholders the launcher expands rather than arguments. # are placeholders the launcher expands rather than arguments.
#
# A bare "--" stops it too. That is where Chromium stops reading switches and
# starts treating everything as an address, so a flag put after it is read as a
# page to open and the feature never comes on. Discord's entry is exactly that
# shape: `discord --url -- %u`.
_mca_exec_insert_at() { _mca_exec_insert_at() {
local rest="$1" tok idx=0 local rest="$1" tok idx=0
@@ -79,7 +84,7 @@ _mca_exec_insert_at() {
[[ -n $rest ]] || break [[ -n $rest ]] || break
tok="${rest%% *}" tok="${rest%% *}"
case "$tok" in case "$tok" in
%[a-zA-Z]|@@|@@u) printf '%s\n' "$idx"; return 0 ;; %[a-zA-Z]|@@|@@u|--) printf '%s\n' "$idx"; return 0 ;;
esac esac
rest="${rest:${#tok}}" rest="${rest:${#tok}}"
idx=$(( idx + ${#tok} )) idx=$(( idx + ${#tok} ))