commit
a376d1e52f
|
@ -114,7 +114,7 @@ static int workspaces_string_cb(void *params_, const unsigned char *val, size_t
|
|||
|
||||
if ((config.strip_ws_numbers || config.strip_ws_name) && params->workspaces_walk->num >= 0) {
|
||||
/* Special case: strip off the workspace number/name */
|
||||
static char ws_num[10];
|
||||
static char ws_num[32];
|
||||
|
||||
snprintf(ws_num, sizeof(ws_num), "%d", params->workspaces_walk->num);
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ bool layout_from_name(const char *layout_str, layout_t *out);
|
|||
* interpreted as a "named workspace".
|
||||
*
|
||||
*/
|
||||
long ws_name_to_number(const char *name);
|
||||
int ws_name_to_number(const char *name);
|
||||
|
||||
/**
|
||||
* Updates *destination with new_value and returns true if it was changed or false
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
#define ROOT_EVENT_MASK (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \
|
||||
XCB_EVENT_MASK_BUTTON_PRESS | \
|
||||
XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* when the user adds a screen (e.g. video \
|
||||
projector), the root window gets a \
|
||||
ConfigureNotify */ \
|
||||
* projector), the root window gets a \
|
||||
* ConfigureNotify */ \
|
||||
XCB_EVENT_MASK_POINTER_MOTION | \
|
||||
XCB_EVENT_MASK_PROPERTY_CHANGE | \
|
||||
XCB_EVENT_MASK_FOCUS_CHANGE | \
|
||||
|
|
|
@ -98,7 +98,8 @@ void display_running_version(void) {
|
|||
if (state != yajl_status_ok)
|
||||
errx(EXIT_FAILURE, "Could not parse my own reply. That's weird. reply is %.*s", (int)reply_length, reply);
|
||||
|
||||
printf("\rRunning i3 version: %s (pid %s)\n", human_readable_version, pid_from_atom);
|
||||
printf("\r\x1b[K");
|
||||
printf("Running i3 version: %s (pid %s)\n", human_readable_version, pid_from_atom);
|
||||
|
||||
if (loaded_config_file_name) {
|
||||
struct stat sb;
|
||||
|
|
10
src/util.c
10
src/util.c
|
@ -109,14 +109,12 @@ bool layout_from_name(const char *layout_str, layout_t *out) {
|
|||
* interpreted as a "named workspace".
|
||||
*
|
||||
*/
|
||||
long ws_name_to_number(const char *name) {
|
||||
int ws_name_to_number(const char *name) {
|
||||
/* positive integers and zero are interpreted as numbers */
|
||||
char *endptr = NULL;
|
||||
long parsed_num = strtol(name, &endptr, 10);
|
||||
if (parsed_num == LONG_MIN ||
|
||||
parsed_num == LONG_MAX ||
|
||||
parsed_num < 0 ||
|
||||
endptr == name) {
|
||||
errno = 0;
|
||||
long long parsed_num = strtoll(name, &endptr, 10);
|
||||
if (errno != 0 || parsed_num > INT32_MAX || parsed_num < 0 || endptr == name) {
|
||||
parsed_num = -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -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".
|
||||
|
|
Loading…
Reference in New Issue