From 817f7829f9cdb47d2bcdee95ffc97830537c490d Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 14 Jul 2025 09:43:18 +0300 Subject: [PATCH] * src/xdisp.c (tab-bar-truncate): New variable (bug#78953). (tab_bar_height): Use it. --- etc/NEWS | 5 +++++ src/xdisp.c | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 3889cb0e8f1..a81d1105443 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -397,6 +397,11 @@ customize help text for tabs displayed on the tab-bar. Help text is normally shown in the echo area or via tooltips. See the variable's docstring for arguments passed to a help-text function. +--- +*** New variable 'tab-bar-truncate'. +When non-nil, it truncates the tab bar, and therefore prevents +wrapping and resizing the tab bar to more than one line. + --- *** New command 'tab-line-move-tab-forward' ('C-x M-'). Together with the new command 'tab-line-move-tab-backward' diff --git a/src/xdisp.c b/src/xdisp.c index 15a88f0868a..992d162f2e3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14739,11 +14739,19 @@ tab_bar_height (struct frame *f, int *n_rows, bool pixelwise) it.paragraph_embedding = L2R; clear_glyph_row (temp_row); - while (!ITERATOR_AT_END_P (&it)) + if (tab_bar_truncate) { it.glyph_row = temp_row; display_tab_bar_line (&it, -1); } + else + { + while (!ITERATOR_AT_END_P (&it)) + { + it.glyph_row = temp_row; + display_tab_bar_line (&it, -1); + } + } clear_glyph_row (temp_row); /* f->n_tab_bar_rows == 0 means "unknown"; -1 means no tab-bar. */ @@ -38209,6 +38217,10 @@ window, nil if it's okay to leave the cursor partially-visible. */); DEFSYM (Qmake_window_start_visible, "make-window-start-visible"); Fmake_variable_buffer_local (Qmake_window_start_visible); + DEFVAR_BOOL ("tab-bar-truncate", tab_bar_truncate, + doc: /* Non-nil means truncate tab-bar and show only one line. */); + tab_bar_truncate = false; + DEFSYM (Qclose_tab, "close-tab"); DEFVAR_LISP ("tab-bar-border", Vtab_bar_border, doc: /* Border below tab-bar in pixels.