aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-10-06 08:58:29 -0400
committerGitHub <noreply@github.com>2017-10-06 08:58:29 -0400
commitfff684b98eb9a06e915f9b7dd9ebce1ceb95dede (patch)
tree4850489604dd7c55716044c8210dbeea1b7bb10f
parentc850d433a703f9c4730ef297d2aac296a269a98c (diff)
parenta7e1a0eea9325238be938c0a812413f4121e2eaa (diff)
Merge pull request #1384 from lbonn/move-workspace-fullname
Fix two issues with spaces in workspace names
-rw-r--r--sway/commands/move.c16
-rw-r--r--sway/workspace.c2
2 files changed, 12 insertions, 6 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 00b57103..8d89f2ef 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -7,6 +7,7 @@
#include "sway/output.h"
#include "sway/workspace.h"
#include "list.h"
+#include "stringop.h"
struct cmd_results *cmd_move(int argc, char **argv) {
struct cmd_results *error = NULL;
@@ -59,18 +60,23 @@ struct cmd_results *cmd_move(int argc, char **argv) {
return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views.");
}
- const char *ws_name = argv[3];
swayc_t *ws;
- if (argc == 5 && strcasecmp(ws_name, "number") == 0) {
+ const char *num_name = NULL;
+ char *ws_name = NULL;
+ if (argc == 5 && strcasecmp(argv[3], "number") == 0) {
// move "container to workspace number x"
- ws_name = argv[4];
- ws = workspace_by_number(ws_name);
+ num_name = argv[4];
+ ws = workspace_by_number(num_name);
} else {
+ ws_name = join_args(argv + 3, argc - 3);
ws = workspace_by_name(ws_name);
}
if (ws == NULL) {
- ws = workspace_create(ws_name);
+ ws = workspace_create(ws_name ? ws_name : num_name);
+ }
+ if (ws_name) {
+ free(ws_name);
}
move_container_to(view, get_focused_container(ws));
} else if (strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "output") == 0) {
diff --git a/sway/workspace.c b/sway/workspace.c
index 29cacce9..e0367190 100644
--- a/sway/workspace.c
+++ b/sway/workspace.c
@@ -61,7 +61,7 @@ char *workspace_next_name(const char *output_name) {
// workspace n
char *cmd = argsep(&cmdlist, " ");
if (cmdlist) {
- name = argsep(&cmdlist, " ,;");
+ name = argsep(&cmdlist, ",;");
}
if (strcmp("workspace", cmd) == 0 && name) {