diff options
| author | Eli Zaretskii | 2019-04-26 22:40:54 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-04-26 22:40:54 +0300 |
| commit | 86b6e91091ba14edb4811427fec8fe194f6520d4 (patch) | |
| tree | 3188f302545557e0924a224d6296e73f94cfcdb3 /src | |
| parent | 82fc8ca6ba179596928db614ab903e44968ef44e (diff) | |
| download | emacs-86b6e91091ba14edb4811427fec8fe194f6520d4.tar.gz emacs-86b6e91091ba14edb4811427fec8fe194f6520d4.zip | |
Avoid assertion violations in calculating line-number width
* src/indent.c (line_number_display_width): Don't use the
window's start marker if it belongs to a different buffer.
(Bug#35429)
Diffstat (limited to 'src')
| -rw-r--r-- | src/indent.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/indent.c b/src/indent.c index 1d5d346e63f..c76e6b7b4bd 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -1968,8 +1968,11 @@ line_number_display_width (struct window *w, int *width, int *pixel_width) | |||
| 1968 | outside the accessible region, in which case we widen the | 1968 | outside the accessible region, in which case we widen the |
| 1969 | buffer temporarily. It could even be beyond the buffer's end | 1969 | buffer temporarily. It could even be beyond the buffer's end |
| 1970 | (Org mode's display of source code snippets is known to cause | 1970 | (Org mode's display of source code snippets is known to cause |
| 1971 | that), in which case we just punt and start from point instead. */ | 1971 | that) or belong to the wrong buffer, in which cases we just |
| 1972 | if (startpos.charpos > Z) | 1972 | punt and start from point instead. */ |
| 1973 | if (startpos.charpos > Z | ||
| 1974 | || !(BUFFERP (w->contents) | ||
| 1975 | && XBUFFER (w->contents) == XMARKER (w->start)->buffer)) | ||
| 1973 | SET_TEXT_POS (startpos, PT, PT_BYTE); | 1976 | SET_TEXT_POS (startpos, PT, PT_BYTE); |
| 1974 | if (startpos.charpos < BEGV || startpos.charpos > ZV) | 1977 | if (startpos.charpos < BEGV || startpos.charpos > ZV) |
| 1975 | { | 1978 | { |