X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a08974906cc8cce5b14dedee441af71e56d11d89..0925c80cd3d8f9a973d699fc1dbdbe79cca62988:/src/cm.c diff --git a/src/cm.c b/src/cm.c index a84a42ce98..354097b39e 100644 --- a/src/cm.c +++ b/src/cm.c @@ -1,5 +1,6 @@ /* Cursor motion subroutines for GNU Emacs. - Copyright (C) 1985, 1995 Free Software Foundation, Inc. + Copyright (C) 1985, 1995, 2002, 2003, 2004, + 2005 Free Software Foundation, Inc. based primarily on public domain code written by Chris Torek This file is part of GNU Emacs. @@ -16,8 +17,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, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ #include @@ -25,19 +26,20 @@ Boston, MA 02111-1307, USA. */ #include "cm.h" #include "termhooks.h" -#ifdef HAVE_TERMCAP_H +/* For now, don't try to include termcap.h. On some systems, + configure finds a non-standard termcap.h that the main build + won't find. */ + +#if defined HAVE_TERMCAP_H && 0 #include #else -#ifdef HAVE_TERM_H -#include -#endif +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 */ @@ -187,6 +189,7 @@ cmcostinit () static int calccost (srcy, srcx, dsty, dstx, doit) + int srcy, srcx, dsty, dstx, doit; { register int deltay, deltax, @@ -222,7 +225,7 @@ calccost (srcy, srcx, dsty, dstx, doit) if (doit) while (--deltay >= 0) tputs (p, 1, cmputc); -x: +x: if ((deltax = dstx - srcx) == 0) goto done; if (deltax < 0) { @@ -233,7 +236,7 @@ x: if (Wcm.cc_tab >= BIG || !Wcm.cm_usetabs) goto olddelta; /* forget it! */ - /* + /* * ntabs is # tabs towards but not past dstx; n2tabs is one more * (ie past dstx), but this is only valid if that is not past the * right edge of the screen. We can check that at the same time @@ -249,7 +252,7 @@ x: if (tab2x >= Wcm.cm_cols) /* too far (past edge) */ n2tabs = 0; - /* + /* * Now set tabcost to the cost for using ntabs, and c to the cost * for using n2tabs, then pick the minimum. */ @@ -268,7 +271,7 @@ x: if (tabcost >= BIG) /* caint use tabs */ goto newdelta; - /* + /* * See if tabcost is less than just moving right */ @@ -280,20 +283,20 @@ x: srcx = tabx; } - /* + /* * Now might as well just recompute the delta. */ -newdelta: +newdelta: if ((deltax = dstx - srcx) == 0) goto done; -olddelta: +olddelta: if (deltax > 0) p = Wcm.cm_right, c = Wcm.cc_right; else p = Wcm.cm_left, c = Wcm.cc_left, deltax = -deltax; -dodelta: +dodelta: if (c == BIG) { /* caint get thar from here */ fail: if (doit) @@ -304,7 +307,7 @@ fail: if (doit) while (--deltax >= 0) tputs (p, 1, cmputc); -done: +done: return totalcost; } @@ -322,6 +325,7 @@ losecursor () void cmgoto (row, col) + int row, col; { int homecost, crcost, @@ -376,7 +380,7 @@ cmgoto (row, col) dcm = Wcm.cm_abs; } - /* + /* * In the following comparison, the = in <= is because when the costs * are the same, it looks nicer (I think) to move directly there. */ @@ -397,17 +401,17 @@ cmgoto (row, col) switch (use) { - case USEHOME: + case USEHOME: tputs (Wcm.cm_home, 1, cmputc); curY = 0, curX = 0; break; - case USELL: + case USELL: tputs (Wcm.cm_ll, 1, cmputc); curY = Wcm.cm_rows - 1, curX = 0; break; - case USECR: + case USECR: tputs (Wcm.cm_cr, 1, cmputc); if (Wcm.cm_autolf) curY++; @@ -457,3 +461,6 @@ Wcm_init () return - 2; return 0; } + +/* arch-tag: bcf64c02-00f6-44ef-94b6-c56eab5b3dc4 + (do not change this comment) */