diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index a280b48de99..15901af9a8d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1782,6 +1782,12 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, | |||
| 1782 | start_display (&it3, w, top); | 1782 | start_display (&it3, w, top); |
| 1783 | if (start > CHARPOS (top)) | 1783 | if (start > CHARPOS (top)) |
| 1784 | move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); | 1784 | move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); |
| 1785 | /* Record the line-number width, if any. Do it here, | ||
| 1786 | before subsequent calls to start_display etc. reset | ||
| 1787 | the line_number_produced_p flag, and we can no | ||
| 1788 | longer be sure we are not using stale info. */ | ||
| 1789 | int lnum_pixel_width = | ||
| 1790 | it3.line_number_produced_p ? it3.lnum_pixel_width : 0; | ||
| 1785 | /* Move forward one more line if the position before | 1791 | /* Move forward one more line if the position before |
| 1786 | the display string is a newline or if it is the | 1792 | the display string is a newline or if it is the |
| 1787 | rightmost character on a line that is | 1793 | rightmost character on a line that is |
| @@ -1850,10 +1856,14 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, | |||
| 1850 | top_x = it3.current_x - it3.pixel_width; | 1856 | top_x = it3.current_x - it3.pixel_width; |
| 1851 | /* Account for line-number display, if IT3 still | 1857 | /* Account for line-number display, if IT3 still |
| 1852 | didn't. This can happen if START - 1 is the | 1858 | didn't. This can happen if START - 1 is the |
| 1853 | first character on its display line. */ | 1859 | first or the last character on its display line. */ |
| 1854 | if (!it3.line_number_produced_p | 1860 | if (!it3.line_number_produced_p) |
| 1855 | && it.line_number_produced_p) | 1861 | { |
| 1856 | top_x += it.lnum_pixel_width; | 1862 | if (lnum_pixel_width > 0) |
| 1863 | top_x += lnum_pixel_width; | ||
| 1864 | else if (it.line_number_produced_p) | ||
| 1865 | top_x += it.lnum_pixel_width; | ||
| 1866 | } | ||
| 1857 | /* Normally, we would exit the above loop because we | 1867 | /* Normally, we would exit the above loop because we |
| 1858 | found the display element whose character | 1868 | found the display element whose character |
| 1859 | position is CHARPOS. For the contingency that we | 1869 | position is CHARPOS. For the contingency that we |