summaryrefslogtreecommitdiffstats
path: root/sway/commands/move.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/move.c')
-rw-r--r--sway/commands/move.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c
index acdc50b5..33d1ee4a 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -1,4 +1,5 @@
1#define _XOPEN_SOURCE 500 1#define _XOPEN_SOURCE 500
2#include <ctype.h>
2#include <stdbool.h> 3#include <stdbool.h>
3#include <string.h> 4#include <string.h>
4#include <strings.h> 5#include <strings.h>
@@ -22,7 +23,7 @@
22static const char *expected_syntax = 23static const char *expected_syntax =
23 "Expected 'move <left|right|up|down> <[px] px>' or " 24 "Expected 'move <left|right|up|down> <[px] px>' or "
24 "'move [--no-auto-back-and-forth] <container|window> [to] workspace <name>' or " 25 "'move [--no-auto-back-and-forth] <container|window> [to] workspace <name>' or "
25 "'move [--no-auto-back-and-forth] <container|window|workspace> [to] output <name|direction>' or " 26 "'move <container|window|workspace> [to] output <name|direction>' or "
26 "'move <container|window> [to] mark <mark>'"; 27 "'move <container|window> [to] mark <mark>'";
27 28
28static struct sway_container *output_in_direction(const char *direction, 29static struct sway_container *output_in_direction(const char *direction,
@@ -124,7 +125,11 @@ static struct cmd_results *cmd_move_container(struct sway_container *current,
124 return cmd_results_new(CMD_INVALID, "move", 125 return cmd_results_new(CMD_INVALID, "move",
125 expected_syntax); 126 expected_syntax);
126 } 127 }
127 ws_name = strdup(argv[3]); 128 if (!isdigit(argv[3][0])) {
129 return cmd_results_new(CMD_INVALID, "move",
130 "Invalid workspace number '%s'", argv[3]);
131 }
132 ws_name = join_args(argv + 3, argc - 3);
128 ws = workspace_by_number(ws_name); 133 ws = workspace_by_number(ws_name);
129 } else { 134 } else {
130 ws_name = join_args(argv + 2, argc - 2); 135 ws_name = join_args(argv + 2, argc - 2);