* src/xdisp.c (syms_of_xdisp): New var redisplay_skip_initial_frame.

This makes it possible to run most of the redisplay code (tho not the
actual drawing since there's nowhere to draw) even when there's no
real frame at hand, as is the case in batch mode.
This makes `xdisp-tests--minibuffer-resizing` work even in batch.

(redisplay_internal): Obey it.
(init_xdisp): Set `echo_area_window` even in noninteractive mode.
* src/dispnew.c (update_frame): Skip the initial frame.
* src/frame.c (make_frame): Use 80x25 as the default initial size.

* test/src/xdisp-tests.el (xdisp-tests--minibuffer-resizing):
Use the new var and fix use of `executing-kbd-macro`.
This commit is contained in:
Stefan Monnier 2020-10-04 22:50:38 -04:00
parent 5ec21155c3
commit 14a5db2912
5 changed files with 45 additions and 25 deletions

View file

@ -85,6 +85,10 @@ useful on systems such as FreeBSD which ships only with "etc/termcap".
* Changes in Emacs 28.1
*** New var 'redisplay-skip-initial-frame' to enable batch redisplay tests.
Setting it to nil forces the redisplay to do its job even in the
initial frame used in batch mode.
---
** Support for the 'strike-through' face attribute on TTY frames.
If your terminal's termcap or terminfo database entry has the 'smxx'

View file

@ -1830,7 +1830,7 @@ adjust_frame_glyphs (struct frame *f)
/* Don't forget the buffer for decode_mode_spec. */
adjust_decode_mode_spec_buffer (f);
f->glyphs_initialized_p = 1;
f->glyphs_initialized_p = true;
unblock_input ();
}
@ -2251,7 +2251,7 @@ free_glyphs (struct frame *f)
/* Block interrupt input so that we don't get surprised by an X
event while we're in an inconsistent state. */
block_input ();
f->glyphs_initialized_p = 0;
f->glyphs_initialized_p = false;
/* Release window sub-matrices. */
if (!NILP (f->root_window))
@ -3236,9 +3236,16 @@ update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p)
build_frame_matrix (f);
/* Update the display. */
update_begin (f);
paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p, 1, false);
update_end (f);
if (FRAME_INITIAL_P (f))
/* No actual display to update so the "update" is a nop and
obviously isn't interrupted by pending input. */
paused_p = false;
else
{
update_begin (f);
paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p, 1, false);
update_end (f);
}
if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
{

View file

@ -931,18 +931,18 @@ make_frame (bool mini_p)
wset_frame (rw, frame);
/* 10 is arbitrary,
/* 80/25 is arbitrary,
just so that there is "something there."
Correct size will be set up later with adjust_frame_size. */
SET_FRAME_COLS (f, 10);
SET_FRAME_LINES (f, 10);
SET_FRAME_COLS (f, 80);
SET_FRAME_LINES (f, 25);
SET_FRAME_WIDTH (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f));
SET_FRAME_HEIGHT (f, FRAME_LINES (f) * FRAME_LINE_HEIGHT (f));
rw->total_cols = 10;
rw->total_cols = FRAME_COLS (f);
rw->pixel_width = rw->total_cols * FRAME_COLUMN_WIDTH (f);
rw->total_lines = mini_p ? 9 : 10;
rw->total_lines = FRAME_LINES (f) - (mini_p ? 1 : 0);
rw->pixel_height = rw->total_lines * FRAME_LINE_HEIGHT (f);
if (mini_p)
@ -1101,7 +1101,7 @@ make_initial_frame (void)
terminal = init_initial_terminal ();
f = make_frame (1);
f = make_frame (true);
XSETFRAME (frame, f);
Vframe_list = Fcons (frame, Vframe_list);

View file

@ -15464,7 +15464,8 @@ redisplay_internal (void)
/* No redisplay if running in batch mode or frame is not yet fully
initialized, or redisplay is explicitly turned off by setting
Vinhibit_redisplay. */
if (FRAME_INITIAL_P (SELECTED_FRAME ())
if ((FRAME_INITIAL_P (SELECTED_FRAME ())
&& redisplay_skip_initial_frame)
|| !NILP (Vinhibit_redisplay))
return;
@ -35452,6 +35453,12 @@ When nil, mouse-movement events will not be generated as long as the
mouse stays within the extent of a single glyph (except for images). */);
mouse_fine_grained_tracking = false;
DEFVAR_BOOL ("redisplay-skip-initial-frame", redisplay_skip_initial_frame,
doc: /* Non-nil to skip redisplay in initial frame.
The initial frame is not displayed anywhere, so skipping it is
best except in special circumstances such as running redisplay tests
in batch mode. */);
redisplay_skip_initial_frame = true;
}
@ -35462,6 +35469,8 @@ init_xdisp (void)
{
CHARPOS (this_line_start_pos) = 0;
echo_area_window = minibuf_window;
if (!noninteractive)
{
struct window *m = XWINDOW (minibuf_window);
@ -35471,8 +35480,6 @@ init_xdisp (void)
struct window *r = XWINDOW (root);
int i;
echo_area_window = minibuf_window;
r->top_line = FRAME_TOP_MARGIN (f);
r->pixel_top = r->top_line * FRAME_LINE_HEIGHT (f);
r->total_cols = FRAME_COLS (f);

View file

@ -33,19 +33,21 @@
(lambda ()
(insert "hello")
(let ((ol (make-overlay (point) (point)))
(redisplay-skip-initial-frame nil)
(max-mini-window-height 1)
(text "askdjfhaklsjdfhlkasjdfhklasdhflkasdhflkajsdhflkashdfkljahsdlfkjahsdlfkjhasldkfhalskdjfhalskdfhlaksdhfklasdhflkasdhflkasdhflkajsdhklajsdgh"))
;; (save-excursion (insert text))
;; (sit-for 2)
;; (delete-region (point) (point-max))
(put-text-property 0 1 'cursor t text)
(overlay-put ol 'after-string text)
(redisplay 'force)
(throw 'result
;; Make sure we do the see "hello" text.
(prog1 (equal (window-start) (point-min))
;; (list (window-start) (window-end) (window-width))
(delete-overlay ol)))))
;; (save-excursion (insert text))
;; (sit-for 2)
;; (delete-region (point) (point-max))
(put-text-property 0 1 'cursor t text)
(overlay-put ol 'after-string text)
(let ((executing-kbd-macro nil)) ;Don't skip redisplay
(redisplay 'force))
(throw 'result
;; Make sure we do the see "hello" text.
(prog1 (equal (window-start) (point-min))
;; (list (window-start) (window-end) (window-width))
(delete-overlay ol)))))
(let ((executing-kbd-macro t)) ;Force real minibuffer in `read-string'.
(read-string "toto: ")))))))