Skip to content
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

Ability to add a package to ignored regardless of the keyboard layout #219

Open
TAforever opened this issue Oct 11, 2023 · 3 comments
Open
Labels
enhancement triage Requires triage to ascertain relevance and actions

Comments

@TAforever
Copy link

Hello! Could you make it so that when I downgrade a package, when asked whether to add the package to those ignored during the upgrade, the confirmation is accepted regardless of the keyboard layout, as many other programs work. The fact is that I have a Russian layout and it is not convenient to switch the layout to add a package to the ignored ones. The program will add the package to the ignored ones only with the Russian keyboard layout Д/н if I press Y/n then nothing will happen.

@TAforever TAforever added enhancement triage Requires triage to ascertain relevance and actions labels Oct 11, 2023
@pbrisbin
Copy link
Member

Oh, interesting use-case!

Looking over the code, I find this:

        eval_gettext "add \$pkg to IgnorePkg? [y/N] "
        read -r ans
        if [[ "${ans,,}" == $(gettext 'y')* ]]; then

What that means is that we compare ans with the localized string for y. With the ru locale, which I assume you're using, that is:

#: bin/downgrade:129
msgid "y"
msgstr "д"

So gettext 'y' returns д. If you enter that (ans="д"), then the condition's true and it works. If you type y instead (ans="y"), the condition's false and it doesn't work.

It sounds like your use-case is to be in one locale (ru), but answer prompts in another (en). This isn't directly related to keyboard layout, but I can see how one leads to the other. Just curious, is there a reason you don't switch locales when you switch keyboard layouts?

The only way I can think of to make this work is if we change our code to also accept en answers to prompts in addition to the localized values.

Does this all sound accurate? Am I missing anything?

@TAforever
Copy link
Author

Yes, thank you, you understood everything correctly. I’m just too lazy to switch the layout because when working in the shell, the Russian layout is almost never needed.

@pbrisbin
Copy link
Member

OK, it shouldn't be much trouble to implement,

-        if [[ "${ans,,}" == $(gettext 'y')* ]]; then
-          pacignore add -c "$PACMAN_CONF" "$pkg"
-        fi
+        case "${ans,,}" in
+          # comment explaining why we're doing this surprising thing
+          $(gettext 'y')*|y*)
+            pacignore add -c "$PACMAN_CONF" "$pkg"
+          ;;
+        esac

(And similar anywhere else we have a y/n prompt.)

I'm not sure when I'd be able to actually do this work/release, etc, but I'll leave this here in case anyone else can jump on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement triage Requires triage to ascertain relevance and actions
Projects
None yet
Development

No branches or pull requests

2 participants