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

[i3ass][i3fyra][i3viswiz] i3viswiz accepts any amount of arguments as long as the last one starts with u|l|d|r|up|left|down|right #194

Closed
1ntronaut opened this issue Jul 20, 2023 · 2 comments · Fixed by #197
Assignees

Comments

@1ntronaut
Copy link

Description

    1. I found out that i3viswiz does accept some (I suppose) non-intended input. It seems i3viswiz will accept any amount of arguments, as long as the last argument is any of u|l|d|r|up|left|down|right.

To Reproduce
Steps to reproduce the behavior:

  • see terminal commands and output below:

as intended, direction only:

~ > i3viswiz --verbose l
m [con_mark=i3viswiz-last-direction=94457275819920] mark --toggle --add i3viswiz-last-direction=94457275819920
m [con_id=94457275831344] mark --add i3viswiz-last-direction=94457275819920
m [con_id=94457275960096] focus
[{"success":true},{"success":true},{"success":true}]

single extra argument before direction:

~ > i3viswiz --verbose asdfasdf l  
m [con_mark=i3viswiz-last-direction=94457275819920] mark --toggle --add i3viswiz-last-direction=94457275819920
m [con_id=94457275831344] mark --add i3viswiz-last-direction=94457275819920
m [con_id=94457275960096] focus
[{"success":true},{"success":true},{"success":true}]

multiple extra arguments before direction:

~ > i3viswiz --verbose asdfasdf qwer asdfgasdf l
m [con_mark=i3viswiz-last-direction=94457275819920] mark --toggle --add i3viswiz-last-direction=94457275819920
m [con_id=94457275831344] mark --add i3viswiz-last-direction=94457275819920
m [con_id=94457275960096] focus
[{"success":true},{"success":true},{"success":true}]

multiple extra arguments, direction inbetween:

~ > i3viswiz --verbose blah bar left nei
[ERROR] nei not valid direction (l|r|u|d)

multiple extra arguments, last one starting with direction:

~ > i3viswiz --verbose blah bar rleftnei 
m [con_mark=i3viswiz-last-direction=94457276140256] mark --toggle --add i3viswiz-last-direction=94457276140256
m [con_id=94457275831344] mark --add i3viswiz-last-direction=94457275819920
m [con_id=94457275960096] focus
[{"success":true},{"success":true},{"success":true}]

Directionality doesn't matter here, i3viswiz chooses whatever valid argument it finds first, so i3viswiz blah barnei lright will focus to the left.

Expected behavior
I was expecting an error message on multiple arguments and/or all arguments starting with u|l|d|r|up|left|down|right

Desktop (please complete the following information):

  • Arch btw
~ > i3 --version
i3 version 4.22 (2023-01-02) © 2009 Michael Stapelberg and contributors
@budRich
Copy link
Collaborator

budRich commented Jul 22, 2023

This is more or less the same problem as with i3Kornhe (#195) . I don't remember why i went with this approach of just getting the first character of the last argument, if it was just a way to support subcommands like this, or if it was fast or if i was stupid.

i3viswiz (focusing) is however not as sensitive as i3Kornhe (moving), since it is unlikely that users hold down the directions keybindings for more than one or two step (where i3Kornhe it is quite likely ~100 steps will be triggered). So here i feel more comfortable adding similar checks as the PR #196 proposes.

@budRich
Copy link
Collaborator

budRich commented Jul 22, 2023

Yeah, this was smoother than #196 , i will merge #197 . Below is new error messages:

$ i3viswiz --verbose asdfasdf l  
[ERROR] i3viswiz: direction ('asdfasdf') is not valid! ( left|right|up|down|l|r|u|d )

$ i3viswiz --verbose asdfasdf qwer asdfgasdf l
[ERROR] i3viswiz: direction ('asdfasdf') is not valid! ( left|right|up|down|l|r|u|d )

$ i3viswiz --verbose blah bar left nei
[ERROR] i3viswiz: direction ('blah') is not valid! ( left|right|up|down|l|r|u|d )

$ i3viswiz --verbose left right up
[ERROR] i3viswiz: expected 0 arguments got '(right up)'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants