]> code.delx.au - gnu-emacs/blobdiff - src/cm.c
(fill-individual-paragraphs): If JUST-ONE-LINE-PREFIX matches
[gnu-emacs] / src / cm.c
index 7011a37125e23d65b7d09ca20e5f3f9e66bdbf05..ef4dccd23de0786624257faf6c72c02942a44049 100644 (file)
--- a/src/cm.c
+++ b/src/cm.c
@@ -1,5 +1,5 @@
 /* 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.
@@ -16,7 +16,8 @@ GNU General Public License for more details.
 
 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>
@@ -34,19 +35,22 @@ 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 */
@@ -98,12 +102,42 @@ 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>.)
  */
 
+void
 cmcostinit ()
 {
     char *p;
@@ -143,7 +177,7 @@ cmcostinit ()
  * actually perform the motion.
  */
 
-static
+static int
 calccost (srcy, srcx, dsty, dstx, doit)
 {
     register int    deltay,
@@ -278,6 +312,7 @@ losecursor ()
 #define        USELL   2
 #define        USECR   3
 
+void
 cmgoto (row, col)
 {
     int     homecost,
@@ -380,6 +415,7 @@ cmgoto (row, col)
    Used before copying into it the info on the actual terminal.
  */
 
+void
 Wcm_clear ()
 {
   bzero (&Wcm, sizeof Wcm);
@@ -394,6 +430,7 @@ Wcm_clear ()
  * Return -2 if size not specified.
  */
 
+int
 Wcm_init ()
 {
 #if 0