emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117473: Fix bug #18384 with incorrect reporting


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 r117473: Fix bug #18384 with incorrect reporting of row number by posn-col-row.
Date: Tue, 02 Sep 2014 15:17:49 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117473
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18384
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Tue 2014-09-02 18:16:42 +0300
message:
  Fix bug #18384 with incorrect reporting of row number by posn-col-row.
  
   lisp/subr.el (posn-col-row): Revert the change from commit
   r99634.2.576 address@hidden, which
   was inadvertently merged from emacs-23 release branch in r102428
   address@hidden, and
   introduced an off-by-one error in the reported row when there is a
   header line.
  
   src/dispnew.c (buffer_posn_from_coords): Fix an off-by-one error in
   the reported row in the case of a window with a header line, by
   improving on the fix committed in r106022
   address@hidden
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/subr.el                   subr.el-20091113204419-o5vbwnq5f7feedwu-151
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/dispnew.c                  dispnew.c-20091113204419-o5vbwnq5f7feedwu-258
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-09-01 22:51:46 +0000
+++ b/lisp/ChangeLog    2014-09-02 15:16:42 +0000
@@ -1,3 +1,12 @@
+2014-09-02  Eli Zaretskii  <address@hidden>
+
+       * subr.el (posn-col-row): Revert the change from commit
+       r99634.2.576 address@hidden, which
+       was inadvertently merged from emacs-23 release branch in r102428
+       address@hidden, and
+       introduced an off-by-one error in the reported row when there is a
+       header line.  (Bug#18384)
+
 2014-09-01  Fabián Ezequiel Gallina  <address@hidden>
 
        * progmodes/python.el (python-indent-post-self-insert-function):

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2014-08-11 01:13:38 +0000
+++ b/lisp/subr.el      2014-09-02 15:16:42 +0000
@@ -1146,10 +1146,7 @@
              ((null spacing)
               (setq spacing 0)))
        (cons (/ (car pair) (frame-char-width frame))
-             (- (/ (cdr pair) (+ (frame-char-height frame) spacing))
-                (if (null (with-current-buffer (window-buffer window)
-                            header-line-format))
-                    0 1))))))))
+             (/ (cdr pair) (+ (frame-char-height frame) spacing))))))))
 
 (defun posn-actual-col-row (position)
   "Return the actual column and row in POSITION, measured in characters.

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-02 06:29:01 +0000
+++ b/src/ChangeLog     2014-09-02 15:16:42 +0000
@@ -1,3 +1,10 @@
+2014-09-02  Eli Zaretskii  <address@hidden>
+
+       * dispnew.c (buffer_posn_from_coords): Fix an off-by-one error in
+       the reported row in the case of a window with a header line, by
+       improving on the fix committed in r106022
+       address@hidden  (Bug#18384)
+
 2014-09-02  Paul Eggert  <address@hidden>
 
        * eval.c (internal_lisp_condition_case): Don't overrun the stack

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2014-08-17 14:34:05 +0000
+++ b/src/dispnew.c     2014-09-02 15:16:42 +0000
@@ -5107,7 +5107,7 @@
 #ifdef HAVE_WINDOW_SYSTEM
   struct image *img = 0;
 #endif
-  int x0, x1, to_x;
+  int x0, x1, to_x, it_vpos;
   void *itdata = NULL;
 
   /* We used to set current_buffer directly here, but that does the
@@ -5116,11 +5116,6 @@
   itdata = bidi_shelve_cache ();
   CLIP_TEXT_POS_FROM_MARKER (startp, w->start);
   start_display (&it, w, startp);
-  /* start_display takes into account the header-line row, but IT's
-     vpos still counts from the glyph row that includes the window's
-     start position.  Adjust for a possible header-line row.  */
-  it.vpos += WINDOW_WANTS_HEADER_LINE_P (w);
-
   x0 = *x;
 
   /* First, move to the beginning of the row corresponding to *Y.  We
@@ -5190,8 +5185,13 @@
     }
 #endif
 
-  if (it.vpos < w->current_matrix->nrows
-      && (row = MATRIX_ROW (w->current_matrix, it.vpos),
+  /* IT's vpos counts from the glyph row that includes the window's
+     start position, i.e. it excludes the header-line row, but
+     MATRIX_ROW includes the header-line row.  Adjust for a possible
+     header-line row.  */
+  it_vpos = it.vpos + WINDOW_WANTS_MODELINE_P (w);
+  if (it_vpos < w->current_matrix->nrows
+      && (row = MATRIX_ROW (w->current_matrix, it_vpos),
          row->enabled_p))
     {
       if (it.hpos < row->used[TEXT_AREA])


reply via email to

[Prev in Thread] Current Thread [Next in Thread]