summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1995-01-17 00:18:20 +0000
committerKarl Heuer <kwzh@gnu.org>1995-01-17 00:18:20 +0000
commit049d292f5d30c41cd120a2537625b60eb84d4165 (patch)
treefc23019c97ccd361b8fdac26fabd1ae2b1b68731
parent410a9647911e0017dabb01da512c68eb93a7641f (diff)
downloademacs-049d292f5d30c41cd120a2537625b60eb84d4165.tar.gz
(cmcheckmagic): New function.
-rw-r--r--src/cm.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cm.c b/src/cm.c
index f0ea1e26f1c..5d18e812e5a 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -100,6 +100,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
* out of <sgtty.h>.)