Bugfix: do not require string param for `nop` cmd
Patch status: needinfo
Patch by Tony Crisci
Long description:
"nop" conventionally means "no operation". The old implementation required a string param and threw an error when not present, which is not intuitive. fixes #1318
To apply this patch, use:
curl http://cr.i3wm.org/patch/643/raw.patch | git am
b/include/commands.h
21 |
@@ -73,10 +73,10 @@ void cmd_resize(I3_CMD, char *way, char *direction, char *resize_px, char *resiz |
22 |
void cmd_border(I3_CMD, char *border_style_str, char *border_width); |
23 |
|
24 |
/** |
25 |
- * Implementation of 'nop <comment>'. |
26 |
+ * Implementation of 'nop'. |
27 |
* |
28 |
*/ |
29 |
-void cmd_nop(I3_CMD, char *comment); |
30 |
+void cmd_nop(I3_CMD); |
31 |
|
32 |
/** |
33 |
* Implementation of 'append_layout <path>'. |
b/parser-specs/commands.spec
38 |
@@ -335,8 +335,8 @@ state MODE: |
39 |
-> call cmd_mode($mode) |
40 |
|
41 |
state NOP: |
42 |
- comment = string |
43 |
- -> call cmd_nop($comment) |
44 |
+ end |
45 |
+ -> call cmd_nop() |
46 |
|
47 |
state SCRATCHPAD: |
48 |
'show' |
b/src/commands.c
53 |
@@ -884,13 +884,11 @@ void cmd_border(I3_CMD, char *border_style_str, char *border_width) { |
54 |
} |
55 |
|
56 |
/* |
57 |
- * Implementation of 'nop <comment>'. |
58 |
+ * Implementation of 'nop'. |
59 |
* |
60 |
*/ |
61 |
-void cmd_nop(I3_CMD, char *comment) { |
62 |
- LOG("-------------------------------------------------\n"); |
63 |
- LOG(" NOP: %s\n", comment); |
64 |
- LOG("-------------------------------------------------\n"); |
65 |
+void cmd_nop(I3_CMD) { |
66 |
+ // nop |
67 |
} |
68 |
|
69 |
/* |
b/testcases/t/187-commands-parser.t
74 |
@@ -68,10 +68,10 @@ is(parser_calls( |
75 |
"cmd_move_con_to_workspace_name(3: foobar, baz)", |
76 |
'move ok'); |
77 |
|
78 |
-is(parser_calls('move workspace 3: foobar, nop foo'), |
79 |
+is(parser_calls('move workspace 3: foobar, nop'), |
80 |
"cmd_move_con_to_workspace_name(3: foobar)\n" . |
81 |
- "cmd_nop(foo)", |
82 |
- 'multiple ops (move workspace 3: foobar, nop foo) ok'); |
83 |
+ "cmd_nop()", |
84 |
+ 'multiple ops (move workspace 3: foobar, nop) ok'); |
85 |
|
86 |
is(parser_calls( |
87 |
'exec i3-sensible-terminal; ' . |