From 124bd15ee6a027526cb74d25e0edcb2e81f1d2b8 Mon Sep 17 00:00:00 2001 From: Gunnar Ritter Date: Thu, 17 Feb 2005 15:16:43 +0000 Subject: [PATCH] * If standard output is not a terminal, no '\r' is written at the end of printed lines anymore. --- Changes | 2 ++ ex_put.c | 14 ++++++++------ ex_tty.c | 6 ++++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Changes b/Changes index e1b209f..850db08 100644 --- a/Changes +++ b/Changes @@ -33,6 +33,8 @@ Release ... * The -w option now also sets the scroll size for the 'z' command. * When the name of a nonexisting file is given with the 'edit' ex command, the command now succeeds and prints a "[New file]" message. +* If standard output is not a terminal, no '\r' is written at the end of + printed lines anymore. Release 1/19/05 * The last release erroneously made 'X' work like 'x' in visual mode. It now diff --git a/ex_put.c b/ex_put.c index 08b5e0a..7f0e0d0 100644 --- a/ex_put.c +++ b/ex_put.c @@ -73,7 +73,7 @@ #ifndef lint #ifdef DOSCCS -static char sccsid[] = "@(#)ex_put.c 1.31 (gritter) 2/15/05"; +static char sccsid[] = "@(#)ex_put.c 1.32 (gritter) 2/17/05"; #endif #endif @@ -604,10 +604,12 @@ plod(int cnt) * BUG: this doesn't take the (possibly long) length * of xCR into account. */ - if (xCR) - tputs(xCR, 0, plodput); - else - plodput('\r'); + if (ospeed != B0) { + if (xCR) + tputs(xCR, 0, plodput); + else + plodput('\r'); + } if (NC) { if (xNL) tputs(xNL, 0, plodput); @@ -796,7 +798,7 @@ fgoto(void) outcol %= TCOLUMNS; if (AM == 0) { while (l > 0) { - if (pfast) + if (pfast && ospeed != B0) if (xCR) tputs(xCR, 0, putch); else diff --git a/ex_tty.c b/ex_tty.c index 4c2daf2..05702b6 100644 --- a/ex_tty.c +++ b/ex_tty.c @@ -73,7 +73,7 @@ #ifndef lint #ifdef DOSCCS -static char sccsid[] = "@(#)ex_tty.c 1.28 (gritter) 2/17/05"; +static char sccsid[] = "@(#)ex_tty.c 1.29 (gritter) 2/17/05"; #endif #endif @@ -96,8 +96,10 @@ gettmode(void) { speed_t pospeed; - if (tcgetattr(1, &tty) < 0) + if (tcgetattr(1, &tty) < 0) { + ospeed = B0; return; + } pospeed = cfgetospeed(&tty); if (ospeed != pospeed) value(SLOWOPEN) = pospeed < B1200;