/* Cursor motion subroutines for GNU Emacs.
- Copyright (C) 1985 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1995 Free Software Foundation, Inc.
based primarily on public domain code written by Chris Torek
This file is part of GNU Emacs.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
#include <config.h>
}
#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