]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tty/lib_mvcur.c
ncurses 6.2 - patch 20210904
[ncurses.git] / ncurses / tty / lib_mvcur.c
index 86e2fb183dbed34b02b36a7a87dd2573f4c1d6f8..795922710978ab7e9362359178ec983ef1119043 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright 2018-2019,2020 Thomas E. Dickey                                *
+ * Copyright 2018-2020,2021 Thomas E. Dickey                                *
  * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
@@ -83,8 +83,8 @@
 
 /*
  * The average overhead of a full optimization computation in character
- * transmission times.  If it's too high, the algorithm will be a bit
- * over-biased toward using cup rather than local motions; if it's too
+ * transmission times.  If it is too high, the algorithm will be a bit
+ * over-biased toward using cup rather than local motions; if it is too
  * low, the algorithm may spend more time than is strictly optimal
  * looking for non-cup motions.  Profile the optimizer using the `t'
  * command of the exerciser (see below), and round to the nearest integer.
@@ -98,7 +98,7 @@
 
 /*
  * LONG_DIST is the distance we consider to be just as costly to move over as a
- * cup sequence is to emit.  In other words, it's the length of a cup sequence
+ * cup sequence is to emit.  In other words, it is the length of a cup sequence
  * adjusted for average computation overhead.  The magic number is the length
  * of "\033[yy;xxH", the typical cup sequence these days.
  */
  *     int             _rep_cost;      // cost of (repeat_char)
  *
  * The USE_HARD_TABS switch controls whether it is reliable to use tab/backtabs
- * for local motions.  On many systems, it's not, due to uncertainties about
+ * for local motions.  On many systems, it is not, due to uncertainties about
  * tab delays and whether or not tabs will be expanded in raw mode.  If you
  * have parm_right_cursor, tab motions don't win you a lot anyhow.
  */
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_mvcur.c,v 1.153 2020/05/27 23:56:32 tom Exp $")
+MODULE_ID("$Id: lib_mvcur.c,v 1.156 2021/09/04 10:29:15 tom Exp $")
 
 #define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x]    /* desired state */
 
@@ -577,7 +577,7 @@ relative_move(NCURSES_SP_DCLx
            }
 
            if (cursor_down
-               && (*cursor_down != '\n' || SP_PARM->_nl)
+               && (*cursor_down != '\n')
                && (n * SP_PARM->_cud1_cost < vcost)) {
                vcost = repeated_append(_nc_str_copy(target, &save), 0,
                                        SP_PARM->_cud1_cost, n, cursor_down);
@@ -760,7 +760,7 @@ relative_move(NCURSES_SP_DCLx
 #endif /* !NO_OPTIMIZE */
 
 /*
- * With the machinery set up above, it's conceivable that
+ * With the machinery set up above, it is conceivable that
  * onscreen_mvcur could be modified into a recursive function that does
  * an alpha-beta search of motion space, as though it were a chess
  * move tree, with the weight function being boolean and the search
@@ -962,7 +962,7 @@ _nc_real_mvcur(NCURSES_SP_DCLx
     NCURSES_CH_T oldattr;
     int code;
 
-    TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("_nc_tinfo_mvcur(%p,%d,%d,%d,%d)"),
+    TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("_nc_real_mvcur(%p,%d,%d,%d,%d)"),
                                  (void *) SP_PARM, yold, xold, ynew, xnew));
 
     if (SP_PARM == 0) {
@@ -997,37 +997,28 @@ _nc_real_mvcur(NCURSES_SP_DCLx
 
        if (xold >= screen_columns(SP_PARM)) {
 
-           if (SP_PARM->_nl) {
-               int l = (xold + 1) / screen_columns(SP_PARM);
+           int l = (xold + 1) / screen_columns(SP_PARM);
 
-               yold += l;
-               if (yold >= screen_lines(SP_PARM))
-                   l -= (yold - screen_lines(SP_PARM) - 1);
+           yold += l;
+           if (yold >= screen_lines(SP_PARM))
+               l -= (yold - screen_lines(SP_PARM) - 1);
 
-               if (l > 0) {
-                   if (carriage_return) {
-                       NCURSES_PUTP2("carriage_return", carriage_return);
-                   } else {
-                       myOutCh(NCURSES_SP_ARGx '\r');
-                   }
-                   xold = 0;
+           if (l > 0) {
+               if (carriage_return) {
+                   NCURSES_PUTP2("carriage_return", carriage_return);
+               } else {
+                   myOutCh(NCURSES_SP_ARGx '\r');
+               }
+               xold = 0;
 
-                   while (l > 0) {
-                       if (newline) {
-                           NCURSES_PUTP2("newline", newline);
-                       } else {
-                           myOutCh(NCURSES_SP_ARGx '\n');
-                       }
-                       l--;
+               while (l > 0) {
+                   if (newline) {
+                       NCURSES_PUTP2("newline", newline);
+                   } else {
+                       myOutCh(NCURSES_SP_ARGx '\n');
                    }
+                   l--;
                }
-           } else {
-               /*
-                * If caller set nonl(), we cannot really use newlines to
-                * position to the next row.
-                */
-               xold = -1;
-               yold = -1;
            }
        }