1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 12:56:37 +02:00

script: remove trailing "J" (line feed char) in source of scripts displayed

Regression was indirectly caused by commit
d18f68e497 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.
This commit is contained in:
Sébastien Helleu
2023-05-22 20:40:45 +02:00
parent c0b3f63985
commit 126d3559ca
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -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);