From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#37667: 27.0.50; Tab Bar display problems with more than 5 tabs Date: Thu, 31 Oct 2019 01:59:38 +0200 Organization: LINKOV.NET Message-ID: <87tv7p4wet.fsf@mail.linkov.net> References: <83o8yrvzgh.fsf@gnu.org> <83h84agytj.fsf@gnu.org> <87tv89opbh.fsf@mail.linkov.net> <83mue1g845.fsf@gnu.org> <83lftlg6zc.fsf@gnu.org> <87lftlk504.fsf@mail.linkov.net> <83eezceir2.fsf@gnu.org> <87pniwuwj5.fsf@mail.linkov.net> <83blufdehy.fsf@gnu.org> <878spj57dk.fsf@mail.linkov.net> <83v9sm8rs3.fsf@gnu.org> <87blubaw63.fsf@mail.linkov.net> <83zhhu34xz.fsf@gnu.org> <8736fl91vp.fsf@mail.linkov.net> <834l0024lr.fsf@gnu.org> <87eez4pjfk.fsf@mail.linkov.net> <83ftjjzbln.fsf@gnu.org> <87d0egpjec.fsf@mail.linkov.net> <83sgnbpxq6.fsf@gnu.org> <871ruvax4p.fsf@mail.linkov.net> <835zk6p6ki.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="197146"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 37667@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 31 01:17:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iPy9K-000p8q-Dp for geb-bug-gnu-emacs@m.gmane.org; Thu, 31 Oct 2019 01:17:14 +0100 Original-Received: from localhost ([::1]:45516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPy9I-00050M-L1 for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Oct 2019 20:17:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56010) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPy9A-0004zy-LN for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2019 20:17:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPy97-0003yJ-Tf for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2019 20:17:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43119) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iPy97-0003xl-QE for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2019 20:17:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iPy97-0007yl-JD for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2019 20:17:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Oct 2019 00:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37667 X-GNU-PR-Package: emacs Original-Received: via spool by 37667-submit@debbugs.gnu.org id=B37667.157248096830576 (code B ref 37667); Thu, 31 Oct 2019 00:17:01 +0000 Original-Received: (at 37667) by debbugs.gnu.org; 31 Oct 2019 00:16:08 +0000 Original-Received: from localhost ([127.0.0.1]:51937 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iPy8F-0007x6-JN for submit@debbugs.gnu.org; Wed, 30 Oct 2019 20:16:07 -0400 Original-Received: from crocodile.birch.relay.mailchannels.net ([23.83.209.45]:45718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iPy8D-0007wx-F0 for 37667@debbugs.gnu.org; Wed, 30 Oct 2019 20:16:06 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3C6A2340D9F; Thu, 31 Oct 2019 00:16:04 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a82.g.dreamhost.com (100-96-15-217.trex.outbound.svc.cluster.local [100.96.15.217]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id A966F341010; Thu, 31 Oct 2019 00:16:03 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a82.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Thu, 31 Oct 2019 00:16:04 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Turn-Spill: 2299bb9c785ab281_1572480963955_1726179847 X-MC-Loop-Signature: 1572480963955:2135995242 X-MC-Ingress-Time: 1572480963954 Original-Received: from pdx1-sub0-mail-a82.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a82.g.dreamhost.com (Postfix) with ESMTP id 5D61680153; Wed, 30 Oct 2019 17:15:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=iaZZdGbCgCltD/9Yf/65WUbfZng=; b= nw/BPIiymYw42f8dWk5FTeb4iccu6W9x9kV8GvkiFPDI9DKy8q7CIrBn3JMmXTAi jWqkhjLLqr25SZLD5hIwAVgpkXsTiBhTAj9sVsTPQh0rRyHFfGX0yl5AssNZ+FQ2 cmBggjyNsDg4lLp1HFjxsogGAX6yN92K5Dvto9V5y9Q= Original-Received: from mail.jurta.org (m91-129-101-77.cust.tele2.ee [91.129.101.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a82.g.dreamhost.com (Postfix) with ESMTPSA id C6F1E8015C; Wed, 30 Oct 2019 17:15:56 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a82 In-Reply-To: <835zk6p6ki.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 30 Oct 2019 17:59:57 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:170493 Archived-At: --=-=-= Content-Type: text/plain >> I tried to not reset these flags only for the tab-line, and indeed >> when the tab-line is truncated, then truncated_on_right_p is true >> most of the time, but not always. It's false when the tab-line >> is truncated between tabs. >> >> AFAIU by looking at 'display_string', it looks like this has something >> to do with whitespace between tabs as this comment explains: >> >> /* Add truncation mark, but don't do it if the line is >> truncated at a padding space. */ > > I don't think this is the reason, because AFAICT tab-line-format > doesn't include constructs that would pad its elements with spaces. > > Can you cook up a simple recipe where the truncation bitmaps don't > appear, and also show the patch you used not to reset those flags? > I'd like to look into what happens in the code in that case. Please try with this patch to resize the frame right edge until the edge is between tabs, then it outputs "truncated_on_right_p=0" whereas when the truncating frame edge is not between tabs then it outputs "truncated_on_right_p=1" --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=current_tab_visible_p.patch diff --git a/src/xdisp.c b/src/xdisp.c index 987c760c74..b20c7718bd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1419,6 +1419,33 @@ window_hscroll_limited (struct window *w, struct frame *f) return window_hscroll; } +static bool +current_tab_visible_p (struct window *w, int *tab_num) +{ + bool visible_p = false; + + if (window_wants_tab_line (w)) + { + struct it it; + + Lisp_Object window_tab_line_format + = window_parameter (w, Qtab_line_format); + + w->tab_line_height + = display_mode_line (w, TAB_LINE_FACE_ID, + NILP (window_tab_line_format) + ? BVAR (current_buffer, tab_line_format) + : window_tab_line_format); + + init_iterator (&it, w, -1, -1, NULL, TAB_LINE_FACE_ID); + + fprintf (stderr, "tab_line_p=%d truncated_on_right_p=%d last_visible_x=%d\n", + it.glyph_row->tab_line_p, it.glyph_row->truncated_on_right_p, it.last_visible_x); + } + + return visible_p; +} + /* Return true if position CHARPOS is visible in window W. CHARPOS < 0 means return info about WINDOW_END position. If visible, set *X and *Y to pixel coordinates of top left corner. @@ -24897,6 +24924,13 @@ display_mode_lines (struct window *w) if (window_wants_tab_line (w)) { + int tab_num = 0; + + if (current_tab_visible_p (w, &tab_num)) + { + /* Set some Lisp variable */ + } + Lisp_Object window_tab_line_format = window_parameter (w, Qtab_line_format); @@ -24984,7 +25018,10 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format) it.glyph_row->full_width_p = true; it.glyph_row->continued_p = false; it.glyph_row->truncated_on_left_p = false; - it.glyph_row->truncated_on_right_p = false; + + /* Currently only tab-line needs truncation detection. */ + if (face_id != TAB_LINE_FACE_ID) + it.glyph_row->truncated_on_right_p = false; /* Make a 3D mode-line have a shadow at its right end. */ face = FACE_FROM_ID (it.f, face_id); --=-=-=--