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 patch fixes the issue #2802 (https://github.com/i3/i3/issues/2802).
1). Revise the state machine for the 'rename workspace' command.
These scenarios are considered:
a). 'rename workspace to to bla'
state transitions: RENAME -> RENAME_WORKSPACE -> RENAME_WORKSPACE_LIKELY_TO -> RENAME_WORKSPACE_LIKELY_TO_NEW_NAME
b). 'rename workspace to tosomething'
state transitions: RENAME -> RENAME_WORKSPACE -> RENAME_WORKSPACE_LIKELY_TO
c). 'rename workspace to to'
state transitions: RENAME -> RENAME_WORKSPACE -> RENAME_WORKSPACE_LIKELY_TO
d). 'rename workspace to bla'
state transitions: RENAME -> RENAME_WORKSPACE -> RENAME_WORKSPACE_LIKELY_TO
e). 'rename workspace bla to foo'
state transitions: RENAME -> RENAME_WORKSPACE -> RENAME_WORKSPACE_TO -> RENAME_WORKSPACE_TO_NEW_NAME
2). Add a test case in 117-workspace.t for the scenario b.
The corresponding command is 'rename workspace to <name>'. As a side-effect
this fixes the command 'rename workspace 1 to to'.
Signed-off-by: Michael Walle <michael@walle.cc>
eval 'package foo; use strict;' enables strict within eval, it does
not leak into the surrounding scope.
Also fix various warnings/compile errors found due to now enabled
strict and warnings.