mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Fix tab-bar resizing under 'auto-resize-tab-bars' = 'grow-only'
* src/xdisp.c (redisplay_tab_bar): Compute the desired height of the tab-bar before iterating over the tab-bar string, to detect the required resizing earlier. Default 'change_p' to 'false'. * lisp/tab-bar.el (tab-bar--update-tab-bar-lines): Support 'auto-resize-tab-bars' set to 'grow-only'.
This commit is contained in:
parent
407ee71c06
commit
5db4ec20fe
2 changed files with 33 additions and 21 deletions
|
|
@ -200,7 +200,9 @@ a list of frames to update."
|
|||
(t frames))))
|
||||
;; Loop over all frames and update `tab-bar-lines'
|
||||
(dolist (frame frame-lst)
|
||||
(unless (frame-parameter frame 'tab-bar-lines-keep-state)
|
||||
(unless (or (frame-parameter frame 'tab-bar-lines-keep-state)
|
||||
(and (eq auto-resize-tab-bars 'grow-only)
|
||||
(> (frame-parameter frame 'tab-bar-lines) 1)))
|
||||
(set-frame-parameter frame 'tab-bar-lines
|
||||
(tab-bar--tab-bar-lines-for-frame frame)))))
|
||||
;; Update `default-frame-alist'
|
||||
|
|
|
|||
50
src/xdisp.c
50
src/xdisp.c
|
|
@ -14054,15 +14054,41 @@ redisplay_tab_bar (struct frame *f)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Build a string that represents the contents of the tab-bar. */
|
||||
build_desired_tab_bar_string (f);
|
||||
|
||||
int new_nrows;
|
||||
int new_height = tab_bar_height (f, &new_nrows, true);
|
||||
|
||||
if (f->n_tab_bar_rows == 0)
|
||||
{
|
||||
f->n_tab_bar_rows = new_nrows;
|
||||
if (new_height != WINDOW_PIXEL_HEIGHT (w))
|
||||
frame_default_tab_bar_height = new_height;
|
||||
}
|
||||
|
||||
/* If new_height or new_nrows indicate that we need to enlarge the
|
||||
tab-bar window, we can return right away. */
|
||||
if (new_nrows > f->n_tab_bar_rows
|
||||
|| (EQ (Vauto_resize_tab_bars, Qgrow_only)
|
||||
&& !f->minimize_tab_bar_window_p
|
||||
&& new_height > WINDOW_PIXEL_HEIGHT (w)))
|
||||
{
|
||||
if (FRAME_TERMINAL (f)->change_tab_bar_height_hook)
|
||||
FRAME_TERMINAL (f)->change_tab_bar_height_hook (f, new_height);
|
||||
if (new_nrows != f->n_tab_bar_rows)
|
||||
f->n_tab_bar_rows = new_nrows;
|
||||
clear_glyph_matrix (w->desired_matrix);
|
||||
f->fonts_changed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Set up an iterator for the tab-bar window. */
|
||||
init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TAB_BAR_FACE_ID);
|
||||
it.first_visible_x = 0;
|
||||
it.last_visible_x = WINDOW_PIXEL_WIDTH (w);
|
||||
row = it.glyph_row;
|
||||
row->reversed_p = false;
|
||||
|
||||
/* Build a string that represents the contents of the tab-bar. */
|
||||
build_desired_tab_bar_string (f);
|
||||
reseat_to_string (&it, NULL, f->desired_tab_bar_string, 0, 0, 0,
|
||||
STRING_MULTIBYTE (f->desired_tab_bar_string));
|
||||
/* FIXME: This should be controlled by a user option. But it
|
||||
|
|
@ -14074,22 +14100,6 @@ redisplay_tab_bar (struct frame *f)
|
|||
do. */
|
||||
it.paragraph_embedding = L2R;
|
||||
|
||||
if (f->n_tab_bar_rows == 0)
|
||||
{
|
||||
int new_height = tab_bar_height (f, &f->n_tab_bar_rows, true);
|
||||
|
||||
if (new_height != WINDOW_PIXEL_HEIGHT (w))
|
||||
{
|
||||
if (FRAME_TERMINAL (f)->change_tab_bar_height_hook)
|
||||
FRAME_TERMINAL (f)->change_tab_bar_height_hook (f, new_height);
|
||||
frame_default_tab_bar_height = new_height;
|
||||
/* Always do that now. */
|
||||
clear_glyph_matrix (w->desired_matrix);
|
||||
f->fonts_changed = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Display as many lines as needed to display all tab-bar items. */
|
||||
|
||||
if (f->n_tab_bar_rows > 0)
|
||||
|
|
@ -14135,7 +14145,7 @@ redisplay_tab_bar (struct frame *f)
|
|||
|
||||
if (!NILP (Vauto_resize_tab_bars))
|
||||
{
|
||||
bool change_height_p = true;
|
||||
bool change_height_p = false;
|
||||
|
||||
/* If we couldn't display everything, change the tab-bar's
|
||||
height if there is room for more. */
|
||||
|
|
|
|||
Loading…
Reference in a new issue