# HG changeset patch # User Karl Heuer # Date 790301900 0 # Node ID 3021721d1d69bbebf8127a321089c6d5b271a811 # Parent c9ba2babe54e4fbc889923e964215ec53a541398 (cmcheckmagic): New function. diff -r c9ba2babe54e -r 3021721d1d69 src/cm.c --- a/src/cm.c Mon Jan 16 22:59:42 1995 +0000 +++ b/src/cm.c Tue Jan 17 00:18:20 1995 +0000 @@ -100,6 +100,35 @@ #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 * out of .)