/* 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.
GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
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>
#include "cm.h"
#include "termhooks.h"
+#ifdef HAVE_TERMCAP_H
+#include <termcap.h>
+#else
+extern void tputs P_ ((const char *, int, int (*)(int)));
+extern char *tgoto P_ ((const char *, int, int));
+#endif
+
#define BIG 9999 /* 9999 good on VAXen. For 16 bit machines
use about 2000.... */
-char *tgoto ();
-
extern char *BC, *UP;
int cost; /* sums up costs */
/* ARGSUSED */
+int
evalcost (c)
char c;
{
cost++;
+ return c;
}
-void
+int
cmputc (c)
char c;
{
if (termscript)
fputc (c & 0177, termscript);
putchar (c & 0177);
+ return c;
}
/* NEXT TWO ARE DONE WITH MACROS */
}
#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>.)
*/
+void
cmcostinit ()
{
char *p;
* actually perform the motion.
*/
-static
+static int
calccost (srcy, srcx, dsty, dstx, doit)
{
register int deltay,
#define USELL 2
#define USECR 3
+void
cmgoto (row, col)
{
int homecost,
Used before copying into it the info on the actual terminal.
*/
+void
Wcm_clear ()
{
bzero (&Wcm, sizeof Wcm);
* Return -2 if size not specified.
*/
+int
Wcm_init ()
{
#if 0