You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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):
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.
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)'
Description
u|l|d|r|up|left|down|right
.To Reproduce
Steps to reproduce the behavior:
as intended, direction only:
single extra argument before direction:
multiple extra arguments before direction:
multiple extra arguments, direction inbetween:
multiple extra arguments, last one starting with direction:
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):
The text was updated successfully, but these errors were encountered: