diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-05-22 20:40:45 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-05-22 20:40:45 +0200 |
commit | 126d3559ca24c7a298b0c20f685dc7fd7badd76d (patch) | |
tree | 7f7c3e73be57a1c640fbd6982b0b46f6a82adad6 /src/plugins/script | |
parent | c0b3f63985525dbba5964afe26fa04054f62cd40 (diff) | |
download | weechat-126d3559ca24c7a298b0c20f685dc7fd7badd76d.zip |
script: remove trailing "J" (line feed char) in source of scripts displayed
Regression was indirectly caused by commit
d18f68e497c4244404ff8f4f50de82717b178e09 in core that allows to display all
control chars in buffers.
But the fix is in script plugin: when the script is downloaded and read line by
line, trailing "\r" and "\n" are removed, and therefore not displayed.
Diffstat (limited to 'src/plugins/script')
-rw-r--r-- | src/plugins/script/script-action.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/script/script-action.c b/src/plugins/script/script-action.c index 89994a1fe..551733c2f 100644 --- a/src/plugins/script/script-action.c +++ b/src/plugins/script/script-action.c @@ -993,6 +993,15 @@ script_action_show_source_process_cb (const void *pointer, void *data, ptr_line = fgets (line, sizeof (line) - 1, file); if (ptr_line) { + /* remove trailing '\r' and '\n' */ + length = strlen (line) - 1; + while ((length >= 0) + && ((line[length] == '\n') + || (line[length] == '\r'))) + { + line[length] = '\0'; + length--; + } weechat_printf_y (script_buffer, script_buffer_detail_script_last_line++, "%s", ptr_line); |