]> code.delx.au - gnu-emacs/blobdiff - src/indent.c
* editfns.c (Fformat): Fix bug in text-property fix (Bug#9514).
[gnu-emacs] / src / indent.c
index 313315e908199ae2fb0f5a82c74c54495044f9a5..e00d21525772ce59edaf3c6cb94ee591a8f7317c 100644 (file)
@@ -56,7 +56,7 @@ EMACS_INT last_known_column_point;
 static int last_known_column_modified;
 
 static EMACS_INT current_column_1 (void);
-static EMACS_INT position_indentation (int);
+static EMACS_INT position_indentation (ptrdiff_t);
 
 /* Cache of beginning of line found by the last call of
    current_column. */
@@ -471,7 +471,7 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
   if (CONSP (val = get_char_property_and_overlay
             (make_number (pos), Qdisplay, Qnil, &overlay))
       && EQ (Qspace, XCAR (val)))
-    { /* FIXME: Use calc_pixel_width_or_height, as in term.c.  */
+    { /* FIXME: Use calc_pixel_width_or_height.  */
       Lisp_Object plist = XCDR (val), prop;
       int width = -1;
 
@@ -855,7 +855,7 @@ following any initial whitespace.  */)
 }
 
 static EMACS_INT
-position_indentation (register int pos_byte)
+position_indentation (ptrdiff_t pos_byte)
 {
   register EMACS_INT column = 0;
   int tab_width = SANE_TAB_WIDTH (current_buffer);
@@ -1543,7 +1543,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
              n = 1;
            }
 
-         for (i = n - 1; i >= 0; --i)
+         for (i = 0; i < n; ++i)
            {
              if (VECTORP (charvec))
                {
@@ -2063,7 +2063,7 @@ whether or not it is currently displayed in some window.  */)
          /* Do this even if LINES is 0, so that we move back to the
             beginning of the current line as we ought.  */
          if (XINT (lines) == 0 || IT_CHARPOS (it) > 0)
-           move_it_by_lines (&it, XINT (lines));
+           move_it_by_lines (&it, max (INT_MIN, XINT (lines)));
        }
       else
        {
@@ -2083,7 +2083,7 @@ whether or not it is currently displayed in some window.  */)
                      && it.c == '\n'))
                move_it_by_lines (&it, -1);
              it.vpos = 0;
-             move_it_by_lines (&it, XINT (lines));
+             move_it_by_lines (&it, min (INT_MAX, XINT (lines)));
            }
          else
            {
@@ -2099,12 +2099,12 @@ whether or not it is currently displayed in some window.  */)
                      move_it_by_lines (&it, 1);
                    }
                  if (XINT (lines) > 1)
-                   move_it_by_lines (&it, XINT (lines) - 1);
+                   move_it_by_lines (&it, min (INT_MAX, XINT (lines) - 1));
                }
              else
                {
                  it.vpos = 0;
-                 move_it_by_lines (&it, XINT (lines));
+                 move_it_by_lines (&it, min (INT_MAX, XINT (lines)));
                }
            }
        }