unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 37667@debbugs.gnu.org
Subject: bug#37667: 27.0.50; Tab Bar display problems with more than 5 tabs
Date: Thu, 31 Oct 2019 01:59:38 +0200	[thread overview]
Message-ID: <87tv7p4wet.fsf@mail.linkov.net> (raw)
In-Reply-To: <835zk6p6ki.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 30 Oct 2019 17:59:57 +0200")

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

>> 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"


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: current_tab_visible_p.patch --]
[-- Type: text/x-diff, Size: 2007 bytes --]

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);

  reply	other threads:[~2019-10-30 23:59 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08 18:55 bug#37667: 27.0.50; Tab Bar display problems with more than 5 tabs Eli Zaretskii
2019-10-10 22:25 ` Juri Linkov
2019-10-11  7:16   ` Eli Zaretskii
2019-10-13 22:39     ` Juri Linkov
2019-10-14  7:00       ` Eli Zaretskii
2019-10-14 21:47         ` Juri Linkov
2019-10-15  9:09           ` Eli Zaretskii
2019-10-15 18:07             ` Juri Linkov
2019-10-15 18:46               ` Eli Zaretskii
2019-10-15 19:10                 ` Eli Zaretskii
2019-10-15 22:39                   ` Juri Linkov
2019-10-16 16:51                     ` Eli Zaretskii
2019-10-16 22:39                       ` Juri Linkov
2019-10-17  7:20                         ` Eli Zaretskii
2019-10-17 22:34                           ` Juri Linkov
2019-10-18  6:57                             ` Eli Zaretskii
2019-10-20 22:28                               ` Juri Linkov
2019-10-21  7:58                                 ` Eli Zaretskii
2019-10-21 22:20                                   ` Juri Linkov
2019-10-22 15:16                                     ` Eli Zaretskii
2019-10-22 21:19                                       ` Juri Linkov
2019-10-23 16:10                                         ` Eli Zaretskii
2019-10-28 22:38                                           ` Juri Linkov
2019-10-29 12:01                                             ` Eli Zaretskii
2019-10-30  0:35                                               ` Juri Linkov
2019-10-30 15:59                                                 ` Eli Zaretskii
2019-10-30 23:59                                                   ` Juri Linkov [this message]
2019-10-31 14:25                                                     ` Eli Zaretskii
2019-10-31  0:03                                                   ` Juri Linkov
2019-10-31 14:30                                                     ` Eli Zaretskii
2019-10-31 20:46                                                       ` Juri Linkov
2019-11-01  7:43                                                         ` Eli Zaretskii
2019-11-02 19:06                                                           ` Juri Linkov
2019-11-02 19:28                                                             ` Eli Zaretskii
2019-11-02 22:36                                                               ` Juri Linkov
2019-11-17 21:44                                           ` Juri Linkov
2019-11-18 16:18                                             ` Eli Zaretskii
2019-11-18 21:57                                               ` Juri Linkov
2019-11-19 16:51                                                 ` Eli Zaretskii
2019-11-19 22:25                                                   ` Juri Linkov
2019-11-20  3:45                                                     ` Eli Zaretskii
2019-11-20 22:40                                                       ` Juri Linkov
2019-11-21  8:23                                                         ` martin rudalics
2019-11-21 14:20                                                           ` Eli Zaretskii
2019-11-21 21:56                                                           ` Juri Linkov
2019-11-22  8:16                                                             ` martin rudalics
2019-10-11  8:17   ` martin rudalics
2019-10-13 22:31     ` Juri Linkov
2019-10-14  6:51       ` Eli Zaretskii
2019-10-14 20:07         ` Juri Linkov
2019-10-14 20:22           ` Eli Zaretskii
2019-10-14 21:50             ` Juri Linkov
2019-10-15  6:26               ` Eli Zaretskii
2019-10-15 17:54                 ` Juri Linkov
2019-10-16 18:14       ` martin rudalics
2019-10-16 20:58         ` Juri Linkov
2019-10-17  8:25           ` martin rudalics
2020-09-20 11:24 ` Lars Ingebrigtsen
2020-09-20 11:27   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tv7p4wet.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=37667@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).