From: Karl Heuer Date: Tue, 17 Jan 1995 00:18:20 +0000 (+0000) Subject: (cmcheckmagic): New function. X-Git-Tag: emacs-19.34~5421 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=902a3b86a41b7142ba27c0430a9dff06e878fc14;p=emacs.git (cmcheckmagic): New function. --- diff --git a/src/cm.c b/src/cm.c index f0ea1e26f1c..5d18e812e5a 100644 --- a/src/cm.c +++ b/src/cm.c @@ -99,6 +99,35 @@ addcol (n) { } #endif +/* + * Terminals with magicwrap (xn) don't all behave identically. + * The VT100 leaves the cursor in the last column but will wrap before + * printing the next character. I hear that the Concept terminal does + * the wrap immediately but ignores the next newline it sees. And some + * terminals just have buggy firmware, and think that the cursor is still + * in limbo if we use direct cursor addressing from the phantom column. + * The only guaranteed safe thing to do is to emit a CRLF immediately + * after we reach the last column; this takes us to a known state. + */ +void +cmcheckmagic () +{ + if (curX == FrameCols) + { + if (!MagicWrap || curY >= FrameRows - 1) + abort (); + if (termscript) + putc ('\r', termscript); + putchar ('\r'); + if (termscript) + putc ('\n', termscript); + putchar ('\n'); + curX = 0; + curY++; + } +} + + /* * (Re)Initialize the cost factors, given the output speed of the terminal * in the variable ospeed. (Note: this holds B300, B9600, etc -- ie stuff