summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/plugins/exec/exec.c14
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index d9c0a2f57..fe91e633d 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -90,6 +90,7 @@ Bug fixes::
* core: fix infinite loop on startup when running some gui commands before the switch to core buffer is performed (issue #1917)
* api: readjust string size in function string_dyn_free when string is not freed
* buflist: do not display keys added in default context on first load
+ * exec: remove trailing "M" (carriage return) in output of commands
* fset: remove scroll to top of fset buffer when options are added or removed (issue #1892)
* guile: fix crash when plugin is loaded on GNU/Hurd (issue #1951)
* irc: fix format of IRC tags displayed in messages (use "=" to separate key from value, do not convert "_" to "-") (issue #1929)
diff --git a/src/plugins/exec/exec.c b/src/plugins/exec/exec.c
index be28473c8..77cf90bea 100644
--- a/src/plugins/exec/exec.c
+++ b/src/plugins/exec/exec.c
@@ -379,12 +379,15 @@ exec_concat_output (struct t_exec_cmd *exec_cmd, struct t_gui_buffer *buffer,
int out, const char *text)
{
int length, new_size;
- const char *ptr_text;
- char *new_output, *pos, *line;
+ const char *ptr_text, *pos, *pos_next;
+ char *new_output, *line;
ptr_text = text;
- /* if output is not sent as hsignal, display lines (ending with '\n') */
+ /*
+ * if output is not sent as hsignal, display lines
+ * (ending with "\r\n" or "\n")
+ */
if (!exec_cmd->hsignal)
{
ptr_text = text;
@@ -393,6 +396,9 @@ exec_concat_output (struct t_exec_cmd *exec_cmd, struct t_gui_buffer *buffer,
pos = strchr (ptr_text, '\n');
if (!pos)
break;
+ pos_next = pos + 1;
+ if ((pos > ptr_text) && (ptr_text[pos - ptr_text - 1] == '\r'))
+ pos--;
if (exec_cmd->output_size[out] > 0)
{
length = exec_cmd->output_size[out] + (pos - ptr_text) + 1;
@@ -418,7 +424,7 @@ exec_concat_output (struct t_exec_cmd *exec_cmd, struct t_gui_buffer *buffer,
exec_cmd->output_size[out] = 0;
exec_display_line (exec_cmd, buffer, out, line);
free (line);
- ptr_text = pos + 1;
+ ptr_text = pos_next;
}
}