aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/readline.c7
-rw-r--r--sway/sway.5.txt6
2 files changed, 13 insertions, 0 deletions
diff --git a/common/readline.c b/common/readline.c
index 76ed6926..5106172c 100644
--- a/common/readline.c
+++ b/common/readline.c
@@ -5,17 +5,24 @@
char *read_line(FILE *file) {
size_t length = 0, size = 128;
char *string = malloc(size);
+ char lastChar = '\0';
if (!string) {
return NULL;
}
while (1) {
int c = getc(file);
+ if (c == '\n' && lastChar == '\\'){
+ --length; // Ignore last character.
+ lastChar = '\0';
+ continue;
+ }
if (c == EOF || c == '\n' || c == '\0') {
break;
}
if (c == '\r') {
continue;
}
+ lastChar = c;
if (length == size) {
char *new_string = realloc(string, size *= 2);
if (!new_string) {
diff --git a/sway/sway.5.txt b/sway/sway.5.txt
index bd2de12d..397b6d87 100644
--- a/sway/sway.5.txt
+++ b/sway/sway.5.txt
@@ -16,6 +16,12 @@ on startup. These commands usually consist of setting your preferences and
setting key bindings. An example config is likely present in /etc/sway/config
for you to check out.
+Lines in the configuration file might be extended through multiple lines by
+adding a '\' character at the end of line. e.g.:
+
+ bindsym Shift+XF86AudioRaiseVolume exec pactl set-sink-volume \
+ $(pactl list sinks | grep -B 1 RUNNING | sed '1q;d' | sed 's/[^0-9]\+//g') +5%
+
These commands can be executed in your config file, via **sway-msg**(1), or via
the bindsym command.