Skip to content

Commit

Permalink
Strip quotes from workspace name.
Browse files Browse the repository at this point in the history
Fix #444

This is a temporary fix, the real fix is to store the commands as a
formatted argv array, so they don't have to be reformatted all over the
place.
  • Loading branch information
mikkeloscar committed Jan 11, 2016
1 parent 46992d6 commit 222f0d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sway/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,11 +717,14 @@ static 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];
char *ws_name = strdup(argv[3]);
strip_quotes(ws_name);
swayc_t *ws;
if (argc == 5 && strcasecmp(ws_name, "number") == 0) {
// move "container to workspace number x"
ws_name = argv[4];
free(ws_name);
ws_name = strdup(argv[4]);
strip_quotes(ws_name);
ws = workspace_by_number(ws_name);
} else {
ws = workspace_by_name(ws_name);
Expand All @@ -730,6 +733,7 @@ static struct cmd_results *cmd_move(int argc, char **argv) {
if (ws == NULL) {
ws = workspace_create(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) {
// move container to output x
Expand Down
1 change: 1 addition & 0 deletions sway/workspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ char *workspace_next_name(void) {
if (strcmp("workspace", cmd) == 0 && name) {
sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", name);
char *_target = strdup(name);
strip_quotes(_target);
while (isspace(*_target))
_target++;

Expand Down

0 comments on commit 222f0d4

Please sign in to comment.