Line
Link Here
|
|
Don't segfault when calling #'center-to-window-pos and friends, -batch |
|
Don't segfault when calling #'center-to-window-pos and friends, -batch |
1 |
-- xemacs-21.5.35/src/indent.c |
1 |
++ xemacs-21.5.35/src/indent.c |
Lines 642-647
Bytebpos
Link Here
|
642 |
vmotion (struct window *w, Bytebpos orig, Charcount vtarget, |
642 |
vmotion (struct window *w, Bytebpos orig, Charcount vtarget, |
643 |
Charcount *ret_vpos) |
643 |
Charcount *ret_vpos) |
644 |
{ |
644 |
{ |
|
|
645 |
if (!redisplayable_window_p (w)) |
646 |
{ |
647 |
if (ret_vpos) |
648 |
{ |
649 |
*ret_vpos = 0; |
650 |
} |
651 |
return orig; |
652 |
} |
653 |
|
645 |
return vmotion_1 (w, orig, vtarget, ret_vpos, NULL); |
654 |
return vmotion_1 (w, orig, vtarget, ret_vpos, NULL); |
646 |
} |
655 |
} |
647 |
|
656 |
|
Lines 671-676
vertical_motion_1 (Lisp_Object lines, Li
Link Here
|
671 |
|
680 |
|
672 |
w = XWINDOW (window); |
681 |
w = XWINDOW (window); |
673 |
|
682 |
|
|
|
683 |
if (!redisplayable_window_p (w)) |
684 |
{ |
685 |
return Qzero; |
686 |
} |
687 |
|
674 |
orig = selected ? BYTE_BUF_PT (XBUFFER (w->buffer)) |
688 |
orig = selected ? BYTE_BUF_PT (XBUFFER (w->buffer)) |
675 |
: marker_byte_position (w->pointm[CURRENT_DISP]); |
689 |
: marker_byte_position (w->pointm[CURRENT_DISP]); |
676 |
|
690 |
|
677 |
-- xemacs-21.5.35/src/window.c |
691 |
++ xemacs-21.5.35/src/window.c |
Lines 402-407
allocate_window (void)
Link Here
|
402 |
return obj; |
402 |
return obj; |
403 |
} |
403 |
} |
404 |
#undef INIT_DISP_VARIABLE |
404 |
#undef INIT_DISP_VARIABLE |
|
|
405 |
|
406 |
Boolint |
407 |
redisplayable_window_p (struct window *w) |
408 |
{ |
409 |
return !FRAME_STREAM_P (XFRAME (WINDOW_FRAME (w))); |
410 |
} |
405 |
|
411 |
|
406 |
/************************************************************************/ |
412 |
/************************************************************************/ |
407 |
/* Window mirror structure */ |
413 |
/* Window mirror structure */ |
Lines 1491-1501
POS defaults to point in WINDOW's buffer
Link Here
|
1491 |
(pos, window, partially)) |
1497 |
(pos, window, partially)) |
1492 |
{ |
1498 |
{ |
1493 |
struct window *w = decode_window (window); |
1499 |
struct window *w = decode_window (window); |
1494 |
Bytebpos top = marker_byte_position (w->start[CURRENT_DISP]); |
1500 |
Bytebpos top, posint; |
1495 |
struct buffer *buf = XBUFFER (w->buffer); |
1501 |
struct buffer *buf; |
1496 |
Bytebpos posint = get_buffer_pos_byte (buf, pos, |
1502 |
|
1497 |
GB_ALLOW_PAST_ACCESSIBLE | |
1503 |
if (!redisplayable_window_p (w)) |
1498 |
GB_ALLOW_NIL | GB_NO_ERROR_IF_BAD); |
1504 |
{ |
|
|
1505 |
return Qnil; |
1506 |
} |
1507 |
|
1508 |
top = marker_byte_position (w->start[CURRENT_DISP]); |
1509 |
buf = XBUFFER (w->buffer); |
1510 |
posint = get_buffer_pos_byte (buf, pos, |
1511 |
GB_ALLOW_PAST_ACCESSIBLE | GB_ALLOW_NIL |
1512 |
| GB_NO_ERROR_IF_BAD); |
1499 |
|
1513 |
|
1500 |
if (posint < top || posint > BYTE_BUF_ZV (buf)) |
1514 |
if (posint < top || posint > BYTE_BUF_ZV (buf)) |
1501 |
return Qnil; |
1515 |
return Qnil; |
Lines 1659-1664
is non-nil, do not include space occupie
Link Here
|
1659 |
line_start_cache_dynarr *cache; |
1673 |
line_start_cache_dynarr *cache; |
1660 |
|
1674 |
|
1661 |
window = wrap_window (w); |
1675 |
window = wrap_window (w); |
|
|
1676 |
|
1677 |
if (!redisplayable_window_p (w)) |
1678 |
{ |
1679 |
return Qzero; |
1680 |
} |
1681 |
|
1662 |
start = marker_byte_position (w->start[CURRENT_DISP]); |
1682 |
start = marker_byte_position (w->start[CURRENT_DISP]); |
1663 |
hlimit = WINDOW_TEXT_HEIGHT (w); |
1683 |
hlimit = WINDOW_TEXT_HEIGHT (w); |
1664 |
eobuf = BYTE_BUF_ZV (XBUFFER (w->buffer)); |
1684 |
eobuf = BYTE_BUF_ZV (XBUFFER (w->buffer)); |
Lines 1903-1913
e.g. if the window's current buffer has
Link Here
|
1903 |
struct window *w = decode_window (window); |
1923 |
struct window *w = decode_window (window); |
1904 |
Bytebpos eoll; |
1924 |
Bytebpos eoll; |
1905 |
|
1925 |
|
1906 |
if (NILP (guarantee) || in_display) |
1926 |
if (NILP (guarantee) || !redisplayable_window_p (w) || in_display) |
1907 |
{ |
1927 |
{ |
1908 |
struct buffer *b = window_display_buffer (w); |
1928 |
struct buffer *b = window_display_buffer (w); |
1909 |
|
1929 |
|
1910 |
if (in_display || |
1930 |
if (in_display || !redisplayable_window_p (w) || |
1911 |
(BUFFER_LIVE_P (b) && EQ (wrap_buffer (b), window_buffer (w)))) |
1931 |
(BUFFER_LIVE_P (b) && EQ (wrap_buffer (b), window_buffer (w)))) |
1912 |
{ |
1932 |
{ |
1913 |
return Fmarker_position (w->end_pos[CURRENT_DISP]); |
1933 |
return Fmarker_position (w->end_pos[CURRENT_DISP]); |
Lines 3341-3347
value is reasonable when this function i
Link Here
|
3341 |
window start is outside the visible portion (as might happen when |
3361 |
window start is outside the visible portion (as might happen when |
3342 |
the display is not current, due to typeahead). */ |
3362 |
the display is not current, due to typeahead). */ |
3343 |
if (start_pos >= BYTE_BUF_BEGV (b) && start_pos <= BYTE_BUF_ZV (b) |
3363 |
if (start_pos >= BYTE_BUF_BEGV (b) && start_pos <= BYTE_BUF_ZV (b) |
3344 |
&& !MINI_WINDOW_P (w)) |
3364 |
&& !MINI_WINDOW_P (w) && redisplayable_window_p (w)) |
3345 |
{ |
3365 |
{ |
3346 |
Bytebpos new_start |
3366 |
Bytebpos new_start |
3347 |
= start_with_line_at_pixpos |
3367 |
= start_with_line_at_pixpos |
Lines 4628-4633
window_scroll (Lisp_Object window, Lisp_
Link Here
|
4628 |
struct display_line* dl; |
4648 |
struct display_line* dl; |
4629 |
Boolint unchain_point = 0; |
4649 |
Boolint unchain_point = 0; |
4630 |
struct gcpro gcpro1; |
4650 |
struct gcpro gcpro1; |
|
|
4651 |
|
4652 |
if (!redisplayable_window_p (w)) |
4653 |
{ |
4654 |
return; |
4655 |
} |
4631 |
|
4656 |
|
4632 |
if (selected) |
4657 |
if (selected) |
4633 |
point = b->point_marker; |
4658 |
point = b->point_marker; |
Lines 5127-5132
If WINDOW is nil, the selected window is
Link Here
|
5127 |
Bytebpos opoint = BYTE_BUF_PT (b); |
5152 |
Bytebpos opoint = BYTE_BUF_PT (b); |
5128 |
Bytebpos startp; |
5153 |
Bytebpos startp; |
5129 |
|
5154 |
|
|
|
5155 |
if (!redisplayable_window_p (w)) |
5156 |
{ |
5157 |
return Qnil; |
5158 |
} |
5159 |
|
5130 |
if (NILP (n)) |
5160 |
if (NILP (n)) |
5131 |
startp = start_with_line_at_pixpos (w, opoint, window_half_pixpos (w)); |
5161 |
startp = start_with_line_at_pixpos (w, opoint, window_half_pixpos (w)); |
5132 |
else |
5162 |
else |
Lines 5491-5504
get_current_pixel_pos (Lisp_Object windo
Link Here
|
5491 |
{ |
5521 |
{ |
5492 |
int first_line, i; |
5522 |
int first_line, i; |
5493 |
Bytebpos point; |
5523 |
Bytebpos point; |
|
|
5524 |
struct buffer *buf; |
5494 |
|
5525 |
|
5495 |
if (NILP (pos)) |
5526 |
if (NILP (pos)) |
5496 |
{ |
5527 |
{ |
5497 |
pos = Fwindow_point (wrap_window (*w)); |
5528 |
pos = Fwindow_point (wrap_window (*w)); |
5498 |
} |
5529 |
} |
5499 |
|
5530 |
|
5500 |
point = get_buffer_pos_byte (window_display_buffer (*w), pos, |
5531 |
buf = window_display_buffer (*w); |
5501 |
GB_NO_ERROR_IF_BAD); |
5532 |
if (buf == NULL) |
|
|
5533 |
{ |
5534 |
return 0; |
5535 |
} |
5536 |
|
5537 |
point = get_buffer_pos_byte (buf, pos, GB_NO_ERROR_IF_BAD); |
5502 |
|
5538 |
|
5503 |
/* If the window has a modeline, ignore it for our purposes, POS can't |
5539 |
/* If the window has a modeline, ignore it for our purposes, POS can't |
5504 |
be over it. Start examining the display lines from 1. */ |
5540 |
be over it. Start examining the display lines from 1. */ |
Lines 5552-5558
a new frame, use the following instead:
Link Here
|
5552 |
*/ |
5588 |
*/ |
5553 |
(window, pos)) |
5589 |
(window, pos)) |
5554 |
{ |
5590 |
{ |
5555 |
struct window* w; |
5591 |
struct window *w = decode_window (window); |
5556 |
struct display_line *dl; |
5592 |
struct display_line *dl; |
5557 |
struct rune* rb; |
5593 |
struct rune* rb; |
5558 |
|
5594 |
|
Lines 5575-5581
use the following instead:
Link Here
|
5575 |
*/ |
5611 |
*/ |
5576 |
(window, pos)) |
5612 |
(window, pos)) |
5577 |
{ |
5613 |
{ |
5578 |
struct window* w; |
5614 |
struct window *w = decode_window (window); |
5579 |
struct display_line *dl; |
5615 |
struct display_line *dl; |
5580 |
struct rune* rb; |
5616 |
struct rune* rb; |
5581 |
|
5617 |
|
5582 |
-- xemacs-21.5.35/src/window.h |
5618 |
++ xemacs-21.5.35/src/window.h |
Lines 152-157
int buffer_window_mru (struct window *w)
Link Here
|
152 |
void check_frame_size (struct frame *frame, int *cols, int *rows); |
152 |
void check_frame_size (struct frame *frame, int *cols, int *rows); |
153 |
int frame_pixsize_valid_p (struct frame *frame, int width, int height); |
153 |
int frame_pixsize_valid_p (struct frame *frame, int width, int height); |
154 |
struct window *decode_window (Lisp_Object window); |
154 |
struct window *decode_window (Lisp_Object window); |
|
|
155 |
Boolint redisplayable_window_p (struct window *w); |
155 |
struct window *find_window_by_pixel_pos (int pix_x, int pix_y, Lisp_Object win); |
156 |
struct window *find_window_by_pixel_pos (int pix_x, int pix_y, Lisp_Object win); |
156 |
|
157 |
|
157 |
void free_window_mirror (struct window_mirror *mir); |
158 |
void free_window_mirror (struct window_mirror *mir); |