Limit workspace numbers within 0..INT32_MAX
Before this commit, large workspace numbers treated oddly: $ i3-msg 'rename workspace to 1234567890' # displayed in i3bar as `0` $ i3-msg 'rename workspace to 4294967200' $ i3-msg -t get_workspaces | jq '.[]|select(.focused).num' -96 # int32_t overflow $ i3-msg 'rename workspace to 99999999999999999999' $ i3-msg -t get_workspaces | jq '.[]|select(.focused).num' -1 # treated as unnumbered This commit puts a consistent limit on workspace numbers. Now workspaces with numbers beyond INT32_MAX are treated as unnumbered.
This commit is contained in:
@ -130,6 +130,21 @@ $ws = get_ws("aa: $tmp");
|
||||
ok(defined($ws), "workspace aa: $tmp was created");
|
||||
is($ws->{num}, -1, 'workspace number is -1');
|
||||
|
||||
cmd "workspace -42: $tmp";
|
||||
$ws = get_ws("-42: $tmp");
|
||||
ok(defined($ws), "workspace -42: $tmp was created");
|
||||
is($ws->{num}, -1, 'negative workspace number is ignored');
|
||||
|
||||
cmd "workspace 2147483647: $tmp";
|
||||
$ws = get_ws("2147483647: $tmp");
|
||||
ok(defined($ws), "workspace 2147483647: $tmp was created");
|
||||
is($ws->{num}, 2147483647, 'workspace number is 2147483647');
|
||||
|
||||
cmd "workspace 2147483648: $tmp";
|
||||
$ws = get_ws("2147483648: $tmp");
|
||||
ok(defined($ws), "workspace 2147483648: $tmp was created");
|
||||
is($ws->{num}, -1, 'workspace number past the limit is ignored');
|
||||
|
||||
################################################################################
|
||||
# Check that we can go to workspace "4: foo" with the command
|
||||
# "workspace number 4".
|
||||
|
Reference in New Issue
Block a user