From 758714995091977ec0dd87b7c664cd3f36a7d093 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 7 Apr 2020 13:20:16 +0200 Subject: [PATCH] [Script] Update example and doc. --- Examples/test_script_mode_delim.sh | 6 +++++- doc/rofi-script.5 | 2 +- doc/rofi-script.5.markdown | 2 +- source/dialogs/script.c | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Examples/test_script_mode_delim.sh b/Examples/test_script_mode_delim.sh index 1fc15871..d5ff26e8 100755 --- a/Examples/test_script_mode_delim.sh +++ b/Examples/test_script_mode_delim.sh @@ -6,7 +6,11 @@ then fi # Override the previously set prompt. -echo -en "\x00delim\x1f\\x1\n" +# We only want to do this on first call of script. +if [ $ROFI_RETV = 0 ] +then + echo -en "\x00delim\x1f\\x1\n" +fi echo -en "\x00prompt\x1fChange prompt\x1" for a in {1..10} do diff --git a/doc/rofi-script.5 b/doc/rofi-script.5 index 2ebd1ca3..4d5a2ea3 100644 --- a/doc/rofi-script.5 +++ b/doc/rofi-script.5 @@ -103,7 +103,7 @@ The following extra options exists: .IP \(bu 2 \fBactive\fP: Mark rows as active. (for syntax see the active option in dmenu mode) .IP \(bu 2 -\fBdelim\fP: Set the delimiter for for next rows. Default is '\\n' and this option should finish with this. +\fBdelim\fP: Set the delimiter for for next rows. Default is '\\n' and this option should finish with this. Only call this on first call of script, it is remembered for consecutive calls. .SH Parsing row options .PP diff --git a/doc/rofi-script.5.markdown b/doc/rofi-script.5.markdown index 63a37d57..8b941aa7 100644 --- a/doc/rofi-script.5.markdown +++ b/doc/rofi-script.5.markdown @@ -77,7 +77,7 @@ The following extra options exists: * **markup-rows**: If 'true' renders markup in the row. * **urgent**: Mark rows as urgent. (for syntax see the urgent option in dmenu mode) * **active**: Mark rows as active. (for syntax see the active option in dmenu mode) - * **delim**: Set the delimiter for for next rows. Default is '\n' and this option should finish with this. + * **delim**: Set the delimiter for for next rows. Default is '\n' and this option should finish with this. Only call this on first call of script, it is remembered for consecutive calls. ## Parsing row options diff --git a/source/dialogs/script.c b/source/dialogs/script.c index 6976fe05..653a5726 100644 --- a/source/dialogs/script.c +++ b/source/dialogs/script.c @@ -108,7 +108,7 @@ static void parse_header_entry ( Mode *sw, char *line, ssize_t length ) length_key++; } - if ( length_key < length ) { + if ( (length_key+1) < length ) { line[length_key] = '\0'; char *value = line + length_key + 1; if ( strcasecmp ( line, "message" ) == 0 ) {