aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2013-02-01 11:23:18 +0400
committerDmitry Antipov2013-02-01 11:23:18 +0400
commit422ff52b80abd9233225b22ccdc5263631cbe482 (patch)
tree4baeece0a77f8281603ae6ce4f5e7624caab0711 /src
parent8654f9d7d6d7c3ee97232a34a40250dcbc57af8e (diff)
downloademacs-422ff52b80abd9233225b22ccdc5263631cbe482.tar.gz
emacs-422ff52b80abd9233225b22ccdc5263631cbe482.zip
* window.h (struct window): Convert base_line_number, base_line_pos
and column_number_displayed members from Lisp_Object to ptrdiff_t. Convert region_showing member from Lisp_Object to bitfield. Remove sequence_number member. Adjust comments. * window.c (sequence_number): Remove. (make_window): Initialize column_number_displayed. * print.c (print_object): Follow the printed representation of frames and print window pointer to distinguish between windows. (adjust_window_count): Invalidate base_line_pos. Adjust comment. * xdisp.c (wset_base_line_number, wset_base_line_pos) (wset_column_number_displayed, wset_region_showing): Remove. (window_buffer_changed, mode_line_update_needed, redisplay_internal) (try_scrolling, try_cursor_movement, redisplay_window) (try_window_reusing_current_matrix, try_window_id, display_line) (display_mode_lines, decode_mode_spec): Adjust users. * .gdbinit (pwinx): Do not print sequence_number.
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit1
-rw-r--r--src/ChangeLog19
-rw-r--r--src/print.c2
-rw-r--r--src/window.c10
-rw-r--r--src/window.h36
-rw-r--r--src/xdisp.c111
6 files changed, 74 insertions, 105 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 4688b0a4421..4215ffa312b 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -358,7 +358,6 @@ end
358 358
359define pwinx 359define pwinx
360 set $w = $arg0 360 set $w = $arg0
361 xgetint $w->sequence_number
362 if ($w->mini_p != Qnil) 361 if ($w->mini_p != Qnil)
363 printf "Mini " 362 printf "Mini "
364 end 363 end
diff --git a/src/ChangeLog b/src/ChangeLog
index 2156d7f19c9..9682da24235 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,22 @@
12013-02-01 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * window.h (struct window): Convert base_line_number, base_line_pos
4 and column_number_displayed members from Lisp_Object to ptrdiff_t.
5 Convert region_showing member from Lisp_Object to bitfield.
6 Remove sequence_number member. Adjust comments.
7 * window.c (sequence_number): Remove.
8 (make_window): Initialize column_number_displayed.
9 * print.c (print_object): Follow the printed representation of
10 frames and print window pointer to distinguish between windows.
11 (adjust_window_count): Invalidate base_line_pos. Adjust comment.
12 * xdisp.c (wset_base_line_number, wset_base_line_pos)
13 (wset_column_number_displayed, wset_region_showing): Remove.
14 (window_buffer_changed, mode_line_update_needed, redisplay_internal)
15 (try_scrolling, try_cursor_movement, redisplay_window)
16 (try_window_reusing_current_matrix, try_window_id, display_line)
17 (display_mode_lines, decode_mode_spec): Adjust users.
18 * .gdbinit (pwinx): Do not print sequence_number.
19
12013-02-01 Paul Eggert <eggert@cs.ucla.edu> 202013-02-01 Paul Eggert <eggert@cs.ucla.edu>
2 21
3 Use fdopendir, fstatat and readlinkat, for efficiency (Bug#13539). 22 Use fdopendir, fstatat and readlinkat, for efficiency (Bug#13539).
diff --git a/src/print.c b/src/print.c
index 2d96202f389..24886a64914 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1766,7 +1766,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1766 { 1766 {
1767 int len; 1767 int len;
1768 strout ("#<window ", -1, -1, printcharfun); 1768 strout ("#<window ", -1, -1, printcharfun);
1769 len = sprintf (buf, "%d", XWINDOW (obj)->sequence_number); 1769 len = sprintf (buf, "%p", XWINDOW (obj));
1770 strout (buf, len, len, printcharfun); 1770 strout (buf, len, len, printcharfun);
1771 if (!NILP (XWINDOW (obj)->buffer)) 1771 if (!NILP (XWINDOW (obj)->buffer))
1772 { 1772 {
diff --git a/src/window.c b/src/window.c
index a0ebe4b4484..5679c150efa 100644
--- a/src/window.c
+++ b/src/window.c
@@ -116,9 +116,6 @@ Lisp_Object minibuf_selected_window;
116/* Hook run at end of temp_output_buffer_show. */ 116/* Hook run at end of temp_output_buffer_show. */
117static Lisp_Object Qtemp_buffer_show_hook; 117static Lisp_Object Qtemp_buffer_show_hook;
118 118
119/* Incremented for each window created. */
120static int sequence_number;
121
122/* Nonzero after init_window_once has finished. */ 119/* Nonzero after init_window_once has finished. */
123static int window_initialized; 120static int window_initialized;
124 121
@@ -286,8 +283,9 @@ adjust_window_count (struct window *w, int arg)
286 b = b->base_buffer; 283 b = b->base_buffer;
287 b->window_count += arg; 284 b->window_count += arg;
288 eassert (b->window_count >= 0); 285 eassert (b->window_count >= 0);
289 /* Catch redisplay's attention. */ 286 /* These should be recalculated by redisplay code. */
290 w->window_end_valid = 0; 287 w->window_end_valid = 0;
288 w->base_line_pos = 0;
291 } 289 }
292} 290}
293 291
@@ -3429,8 +3427,6 @@ make_parent_window (Lisp_Object window, int horflag)
3429 adjust_window_count (p, 1); 3427 adjust_window_count (p, 1);
3430 XSETWINDOW (parent, p); 3428 XSETWINDOW (parent, p);
3431 3429
3432 p->sequence_number = ++sequence_number;
3433
3434 replace_window (window, parent, 1); 3430 replace_window (window, parent, 1);
3435 3431
3436 wset_next (o, Qnil); 3432 wset_next (o, Qnil);
@@ -3479,7 +3475,7 @@ make_window (void)
3479 w->nrows_scale_factor = w->ncols_scale_factor = 1; 3475 w->nrows_scale_factor = w->ncols_scale_factor = 1;
3480 w->phys_cursor_type = -1; 3476 w->phys_cursor_type = -1;
3481 w->phys_cursor_width = -1; 3477 w->phys_cursor_width = -1;
3482 w->sequence_number = ++sequence_number; 3478 w->column_number_displayed = -1;
3483 3479
3484 /* Reset window_list. */ 3480 /* Reset window_list. */
3485 Vwindow_list = Qnil; 3481 Vwindow_list = Qnil;
diff --git a/src/window.h b/src/window.h
index 135f591ded7..f28ce1424d0 100644
--- a/src/window.h
+++ b/src/window.h
@@ -192,23 +192,6 @@ struct window
192 and Qt, so bitfield can't be used here. */ 192 and Qt, so bitfield can't be used here. */
193 Lisp_Object dedicated; 193 Lisp_Object dedicated;
194 194
195 /* Line number and position of a line somewhere above the top of the
196 screen. If this field is nil, it means we don't have a base
197 line. */
198 Lisp_Object base_line_number;
199 /* If this field is nil, it means we don't have a base line.
200 If it is a buffer, it means don't display the line number
201 as long as the window shows that buffer. */
202 Lisp_Object base_line_pos;
203
204 /* If we have highlighted the region (or any part of it),
205 this is the mark position that we used, as an integer. */
206 Lisp_Object region_showing;
207
208 /* The column number currently displayed in this window's mode line,
209 or nil if column numbers are not being displayed. */
210 Lisp_Object column_number_displayed;
211
212 /* If redisplay in this window goes beyond this buffer position, 195 /* If redisplay in this window goes beyond this buffer position,
213 must run the redisplay-end-trigger-hook. */ 196 must run the redisplay-end-trigger-hook. */
214 Lisp_Object redisplay_end_trigger; 197 Lisp_Object redisplay_end_trigger;
@@ -238,9 +221,6 @@ struct window
238 /* Number saying how recently window was selected. */ 221 /* Number saying how recently window was selected. */
239 int use_time; 222 int use_time;
240 223
241 /* Unique number of window assigned when it was created. */
242 int sequence_number;
243
244 /* Number of columns display within the window is scrolled to the left. */ 224 /* Number of columns display within the window is scrolled to the left. */
245 ptrdiff_t hscroll; 225 ptrdiff_t hscroll;
246 226
@@ -260,6 +240,19 @@ struct window
260 it should be positive. */ 240 it should be positive. */
261 ptrdiff_t last_point; 241 ptrdiff_t last_point;
262 242
243 /* Line number and position of a line somewhere above the top of the
244 screen. If this field is zero, it means we don't have a base line. */
245 ptrdiff_t base_line_number;
246
247 /* If this field is zero, it means we don't have a base line.
248 If it is -1, it means don't display the line number as long
249 as the window shows its buffer. */
250 ptrdiff_t base_line_pos;
251
252 /* The column number currently displayed in this window's mode
253 line, or -1 if column numbers are not being displayed. */
254 ptrdiff_t column_number_displayed;
255
263 /* Scaling factor for the glyph_matrix size calculation in this window. 256 /* Scaling factor for the glyph_matrix size calculation in this window.
264 Used if window contains many small images or uses proportional fonts, 257 Used if window contains many small images or uses proportional fonts,
265 as the normal may yield a matrix which is too small. */ 258 as the normal may yield a matrix which is too small. */
@@ -340,6 +333,9 @@ struct window
340 the frame image that window_end_pos did not get onto the frame. */ 333 the frame image that window_end_pos did not get onto the frame. */
341 unsigned window_end_valid : 1; 334 unsigned window_end_valid : 1;
342 335
336 /* Nonzero if we have highlighted the region (or any part of it). */
337 unsigned region_showing : 1;
338
343 /* Amount by which lines of this window are scrolled in 339 /* Amount by which lines of this window are scrolled in
344 y-direction (smooth scrolling). */ 340 y-direction (smooth scrolling). */
345 int vscroll; 341 int vscroll;
diff --git a/src/xdisp.c b/src/xdisp.c
index 0169238e994..7b6e108d97f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -367,28 +367,6 @@ Lisp_Object Qcenter;
367static Lisp_Object Qmargin, Qpointer; 367static Lisp_Object Qmargin, Qpointer;
368static Lisp_Object Qline_height; 368static Lisp_Object Qline_height;
369 369
370/* These setters are used only in this file, so they can be private. */
371static void
372wset_base_line_number (struct window *w, Lisp_Object val)
373{
374 w->base_line_number = val;
375}
376static void
377wset_base_line_pos (struct window *w, Lisp_Object val)
378{
379 w->base_line_pos = val;
380}
381static void
382wset_column_number_displayed (struct window *w, Lisp_Object val)
383{
384 w->column_number_displayed = val;
385}
386static void
387wset_region_showing (struct window *w, Lisp_Object val)
388{
389 w->region_showing = val;
390}
391
392#ifdef HAVE_WINDOW_SYSTEM 370#ifdef HAVE_WINDOW_SYSTEM
393 371
394/* Test if overflow newline into fringe. Called with iterator IT 372/* Test if overflow newline into fringe. Called with iterator IT
@@ -10775,7 +10753,7 @@ window_buffer_changed (struct window *w)
10775 10753
10776 return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star) 10754 return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star)
10777 || ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active))) 10755 || ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active)))
10778 != !NILP (w->region_showing))); 10756 != w->region_showing));
10779} 10757}
10780 10758
10781/* Nonzero if W has %c in its mode line and mode line should be updated. */ 10759/* Nonzero if W has %c in its mode line and mode line should be updated. */
@@ -10783,9 +10761,9 @@ window_buffer_changed (struct window *w)
10783static int 10761static int
10784mode_line_update_needed (struct window *w) 10762mode_line_update_needed (struct window *w)
10785{ 10763{
10786 return (!NILP (w->column_number_displayed) 10764 return (w->column_number_displayed != -1
10787 && !(PT == w->last_point && !window_outdated (w)) 10765 && !(PT == w->last_point && !window_outdated (w))
10788 && (XFASTINT (w->column_number_displayed) != current_column ())); 10766 && (w->column_number_displayed != current_column ()));
10789} 10767}
10790 10768
10791/*********************************************************************** 10769/***********************************************************************
@@ -13038,18 +13016,6 @@ redisplay_internal (void)
13038 clear_garbaged_frames (); 13016 clear_garbaged_frames ();
13039 } 13017 }
13040 13018
13041
13042 /* If showing the region, and mark has changed, we must redisplay
13043 the whole window. The assignment to this_line_start_pos prevents
13044 the optimization directly below this if-statement. */
13045 if (((!NILP (Vtransient_mark_mode)
13046 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
13047 != !NILP (w->region_showing))
13048 || (!NILP (w->region_showing)
13049 && !EQ (w->region_showing,
13050 Fmarker_position (BVAR (XBUFFER (w->buffer), mark)))))
13051 CHARPOS (this_line_start_pos) = 0;
13052
13053 /* Optimize the case that only the line containing the cursor in the 13019 /* Optimize the case that only the line containing the cursor in the
13054 selected window has changed. Variables starting with this_ are 13020 selected window has changed. Variables starting with this_ are
13055 set in display_line and record information about the line 13021 set in display_line and record information about the line
@@ -13213,7 +13179,7 @@ redisplay_internal (void)
13213 && (EQ (selected_window, 13179 && (EQ (selected_window,
13214 BVAR (current_buffer, last_selected_window)) 13180 BVAR (current_buffer, last_selected_window))
13215 || highlight_nonselected_windows) 13181 || highlight_nonselected_windows)
13216 && NILP (w->region_showing) 13182 && !w->region_showing
13217 && NILP (Vshow_trailing_whitespace) 13183 && NILP (Vshow_trailing_whitespace)
13218 && !cursor_in_echo_area) 13184 && !cursor_in_echo_area)
13219 { 13185 {
@@ -14710,7 +14676,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
14710 if (!just_this_one_p 14676 if (!just_this_one_p
14711 || current_buffer->clip_changed 14677 || current_buffer->clip_changed
14712 || BEG_UNCHANGED < CHARPOS (startp)) 14678 || BEG_UNCHANGED < CHARPOS (startp))
14713 wset_base_line_number (w, Qnil); 14679 w->base_line_number = 0;
14714 14680
14715 /* If cursor ends up on a partially visible line, 14681 /* If cursor ends up on a partially visible line,
14716 treat that as being off the bottom of the screen. */ 14682 treat that as being off the bottom of the screen. */
@@ -14859,7 +14825,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
14859 region exists, cursor movement has to do more than just 14825 region exists, cursor movement has to do more than just
14860 set the cursor. */ 14826 set the cursor. */
14861 && markpos_of_region () < 0 14827 && markpos_of_region () < 0
14862 && NILP (w->region_showing) 14828 && !w->region_showing
14863 && NILP (Vshow_trailing_whitespace) 14829 && NILP (Vshow_trailing_whitespace)
14864 /* This code is not used for mini-buffer for the sake of the case 14830 /* This code is not used for mini-buffer for the sake of the case
14865 of redisplaying to replace an echo area message; since in 14831 of redisplaying to replace an echo area message; since in
@@ -15425,7 +15391,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15425 15391
15426 /* Forget any recorded base line for line number display. */ 15392 /* Forget any recorded base line for line number display. */
15427 if (!buffer_unchanged_p) 15393 if (!buffer_unchanged_p)
15428 wset_base_line_number (w, Qnil); 15394 w->base_line_number = 0;
15429 15395
15430 /* Redisplay the mode line. Select the buffer properly for that. 15396 /* Redisplay the mode line. Select the buffer properly for that.
15431 Also, run the hook window-scroll-functions 15397 Also, run the hook window-scroll-functions
@@ -15665,7 +15631,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15665 || current_buffer->clip_changed 15631 || current_buffer->clip_changed
15666 || BEG_UNCHANGED < CHARPOS (startp)) 15632 || BEG_UNCHANGED < CHARPOS (startp))
15667 /* Forget any recorded base line for line number display. */ 15633 /* Forget any recorded base line for line number display. */
15668 wset_base_line_number (w, Qnil); 15634 w->base_line_number = 0;
15669 15635
15670 if (!cursor_row_fully_visible_p (w, 1, 0)) 15636 if (!cursor_row_fully_visible_p (w, 1, 0))
15671 { 15637 {
@@ -15732,11 +15698,9 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15732 debug_method_add (w, "recenter"); 15698 debug_method_add (w, "recenter");
15733#endif 15699#endif
15734 15700
15735 /* w->vscroll = 0; */
15736
15737 /* Forget any previously recorded base line for line number display. */ 15701 /* Forget any previously recorded base line for line number display. */
15738 if (!buffer_unchanged_p) 15702 if (!buffer_unchanged_p)
15739 wset_base_line_number (w, Qnil); 15703 w->base_line_number = 0;
15740 15704
15741 /* Determine the window start relative to point. */ 15705 /* Determine the window start relative to point. */
15742 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); 15706 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
@@ -15956,10 +15920,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15956 && !FRAME_WINDOW_P (f) 15920 && !FRAME_WINDOW_P (f)
15957 && !WINDOW_FULL_WIDTH_P (w)) 15921 && !WINDOW_FULL_WIDTH_P (w))
15958 /* Line number to display. */ 15922 /* Line number to display. */
15959 || INTEGERP (w->base_line_pos) 15923 || w->base_line_pos > 0
15960 /* Column number is displayed and different from the one displayed. */ 15924 /* Column number is displayed and different from the one displayed. */
15961 || (!NILP (w->column_number_displayed) 15925 || (w->column_number_displayed != -1
15962 && (XFASTINT (w->column_number_displayed) != current_column ()))) 15926 && (w->column_number_displayed != current_column ())))
15963 /* This means that the window has a mode line. */ 15927 /* This means that the window has a mode line. */
15964 && (WINDOW_WANTS_MODELINE_P (w) 15928 && (WINDOW_WANTS_MODELINE_P (w)
15965 || WINDOW_WANTS_HEADER_LINE_P (w))) 15929 || WINDOW_WANTS_HEADER_LINE_P (w)))
@@ -15990,11 +15954,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15990 goto need_larger_matrices; 15954 goto need_larger_matrices;
15991 } 15955 }
15992 15956
15993 if (!line_number_displayed 15957 if (!line_number_displayed && w->base_line_pos != -1)
15994 && !BUFFERP (w->base_line_pos))
15995 { 15958 {
15996 wset_base_line_pos (w, Qnil); 15959 w->base_line_pos = 0;
15997 wset_base_line_number (w, Qnil); 15960 w->base_line_number = 0;
15998 } 15961 }
15999 15962
16000 finish_menu_bars: 15963 finish_menu_bars:
@@ -16231,7 +16194,7 @@ try_window_reusing_current_matrix (struct window *w)
16231 16194
16232 /* Can't do this if region may have changed. */ 16195 /* Can't do this if region may have changed. */
16233 if (0 <= markpos_of_region () 16196 if (0 <= markpos_of_region ()
16234 || !NILP (w->region_showing) 16197 || w->region_showing
16235 || !NILP (Vshow_trailing_whitespace)) 16198 || !NILP (Vshow_trailing_whitespace))
16236 return 0; 16199 return 0;
16237 16200
@@ -17070,7 +17033,7 @@ try_window_id (struct window *w)
17070 GIVE_UP (11); 17033 GIVE_UP (11);
17071 17034
17072 /* Likewise if showing a region. */ 17035 /* Likewise if showing a region. */
17073 if (!NILP (w->region_showing)) 17036 if (w->region_showing)
17074 GIVE_UP (10); 17037 GIVE_UP (10);
17075 17038
17076 /* Can't use this if overlay arrow position and/or string have 17039 /* Can't use this if overlay arrow position and/or string have
@@ -19157,7 +19120,7 @@ display_line (struct it *it)
19157 } 19120 }
19158 19121
19159 /* Is IT->w showing the region? */ 19122 /* Is IT->w showing the region? */
19160 wset_region_showing (it->w, it->region_beg_charpos > 0 ? Qt : Qnil); 19123 it->w->region_showing = it->region_beg_charpos > 0;
19161 19124
19162 /* Clear the result glyph row and enable it. */ 19125 /* Clear the result glyph row and enable it. */
19163 prepare_desired_row (row); 19126 prepare_desired_row (row);
@@ -20161,7 +20124,7 @@ display_mode_lines (struct window *w)
20161 20124
20162 /* These will be set while the mode line specs are processed. */ 20125 /* These will be set while the mode line specs are processed. */
20163 line_number_displayed = 0; 20126 line_number_displayed = 0;
20164 wset_column_number_displayed (w, Qnil); 20127 w->column_number_displayed = -1;
20165 20128
20166 if (WINDOW_WANTS_MODELINE_P (w)) 20129 if (WINDOW_WANTS_MODELINE_P (w))
20167 { 20130 {
@@ -21184,8 +21147,7 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
21184 returned with spaces to that value. Return a Lisp string in 21147 returned with spaces to that value. Return a Lisp string in
21185 *STRING if the resulting string is taken from that Lisp string. 21148 *STRING if the resulting string is taken from that Lisp string.
21186 21149
21187 Note we operate on the current buffer for most purposes, 21150 Note we operate on the current buffer for most purposes. */
21188 the exception being w->base_line_pos. */
21189 21151
21190static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------"; 21152static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
21191 21153
@@ -21296,7 +21258,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21296 else 21258 else
21297 { 21259 {
21298 ptrdiff_t col = current_column (); 21260 ptrdiff_t col = current_column ();
21299 wset_column_number_displayed (w, make_number (col)); 21261 w->column_number_displayed = col;
21300 pint2str (decode_mode_spec_buf, width, col); 21262 pint2str (decode_mode_spec_buf, width, col);
21301 return decode_mode_spec_buf; 21263 return decode_mode_spec_buf;
21302 } 21264 }
@@ -21355,27 +21317,24 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21355 21317
21356 /* If we decided that this buffer isn't suitable for line numbers, 21318 /* If we decided that this buffer isn't suitable for line numbers,
21357 don't forget that too fast. */ 21319 don't forget that too fast. */
21358 if (EQ (w->base_line_pos, w->buffer)) 21320 if (w->base_line_pos == -1)
21359 goto no_value; 21321 goto no_value;
21360 /* But do forget it, if the window shows a different buffer now. */
21361 else if (BUFFERP (w->base_line_pos))
21362 wset_base_line_pos (w, Qnil);
21363 21322
21364 /* If the buffer is very big, don't waste time. */ 21323 /* If the buffer is very big, don't waste time. */
21365 if (INTEGERP (Vline_number_display_limit) 21324 if (INTEGERP (Vline_number_display_limit)
21366 && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit)) 21325 && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit))
21367 { 21326 {
21368 wset_base_line_pos (w, Qnil); 21327 w->base_line_pos = 0;
21369 wset_base_line_number (w, Qnil); 21328 w->base_line_number = 0;
21370 goto no_value; 21329 goto no_value;
21371 } 21330 }
21372 21331
21373 if (INTEGERP (w->base_line_number) 21332 if (w->base_line_number > 0
21374 && INTEGERP (w->base_line_pos) 21333 && w->base_line_pos > 0
21375 && XFASTINT (w->base_line_pos) <= startpos) 21334 && w->base_line_pos <= startpos)
21376 { 21335 {
21377 line = XFASTINT (w->base_line_number); 21336 line = w->base_line_number;
21378 linepos = XFASTINT (w->base_line_pos); 21337 linepos = w->base_line_pos;
21379 linepos_byte = buf_charpos_to_bytepos (b, linepos); 21338 linepos_byte = buf_charpos_to_bytepos (b, linepos);
21380 } 21339 }
21381 else 21340 else
@@ -21398,8 +21357,8 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21398 go back past it. */ 21357 go back past it. */
21399 if (startpos == BUF_BEGV (b)) 21358 if (startpos == BUF_BEGV (b))
21400 { 21359 {
21401 wset_base_line_number (w, make_number (topline)); 21360 w->base_line_number = topline;
21402 wset_base_line_pos (w, make_number (BUF_BEGV (b))); 21361 w->base_line_pos = BUF_BEGV (b);
21403 } 21362 }
21404 else if (nlines < height + 25 || nlines > height * 3 + 50 21363 else if (nlines < height + 25 || nlines > height * 3 + 50
21405 || linepos == BUF_BEGV (b)) 21364 || linepos == BUF_BEGV (b))
@@ -21425,13 +21384,13 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21425 give up on line numbers for this window. */ 21384 give up on line numbers for this window. */
21426 if (position == limit_byte && limit == startpos - distance) 21385 if (position == limit_byte && limit == startpos - distance)
21427 { 21386 {
21428 wset_base_line_pos (w, w->buffer); 21387 w->base_line_pos = -1;
21429 wset_base_line_number (w, Qnil); 21388 w->base_line_number = 0;
21430 goto no_value; 21389 goto no_value;
21431 } 21390 }
21432 21391
21433 wset_base_line_number (w, make_number (topline - nlines)); 21392 w->base_line_number = topline - nlines;
21434 wset_base_line_pos (w, make_number (BYTE_TO_CHAR (position))); 21393 w->base_line_pos = BYTE_TO_CHAR (position);
21435 } 21394 }
21436 21395
21437 /* Now count lines from the start pos to point. */ 21396 /* Now count lines from the start pos to point. */