aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar Robert Günzler <r@gnzler.io>2019-10-31 20:09:33 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2019-10-31 23:05:06 +0100
commit354e705a7be9158c6dd14bb4f9751023e2e974b8 (patch)
treefdf05303d7cc4db848f7ae2f5827e7a1aa0057bd /sway/config.c
parentFix presentation feedback when scanning out fullscreen view (diff)
downloadsway-354e705a7be9158c6dd14bb4f9751023e2e974b8.tar.gz
sway-354e705a7be9158c6dd14bb4f9751023e2e974b8.tar.zst
sway-354e705a7be9158c6dd14bb4f9751023e2e974b8.zip
Skip line continuation when it is a comment
Currently commented lines ending in the backslash character will be concatenated with the following line. ``` # with this comment \ exec swaynag -m 'will not run' ``` This change modifies `getline_with_cont` to stop reading when the initial character is a '#'.
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sway/config.c b/sway/config.c
index c1b0efa0..bb5b920b 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -677,7 +677,7 @@ static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file,
677 size_t next_line_size = 0; 677 size_t next_line_size = 0;
678 ssize_t nread = getline(lineptr, line_size, file); 678 ssize_t nread = getline(lineptr, line_size, file);
679 *nlines = nread == -1 ? 0 : 1; 679 *nlines = nread == -1 ? 0 : 1;
680 while (nread >= 2 && strcmp(&(*lineptr)[nread - 2], "\\\n") == 0) { 680 while (nread >= 2 && strcmp(&(*lineptr)[nread - 2], "\\\n") == 0 && (*lineptr)[0] != '#') {
681 ssize_t next_nread = getline(&next_line, &next_line_size, file); 681 ssize_t next_nread = getline(&next_line, &next_line_size, file);
682 if (next_nread == -1) { 682 if (next_nread == -1) {
683 break; 683 break;