From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.devel Subject: Re: Test to determine character left-overhangs a tab stretch. Date: Tue, 13 Nov 2018 11:11:49 -0800 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1542136233 4580 195.159.176.226 (13 Nov 2018 19:10:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Nov 2018 19:10:33 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 13 20:10:29 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gMe4y-000165-DF for ged-emacs-devel@m.gmane.org; Tue, 13 Nov 2018 20:10:29 +0100 Original-Received: from localhost ([::1]:55775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMe74-0007gh-KV for ged-emacs-devel@m.gmane.org; Tue, 13 Nov 2018 14:12:38 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMe6P-0007gR-JC for emacs-devel@gnu.org; Tue, 13 Nov 2018 14:11:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMe6K-0007mW-JB for emacs-devel@gnu.org; Tue, 13 Nov 2018 14:11:57 -0500 Original-Received: from gateway36.websitewelcome.com ([192.185.198.13]:28587) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMe6K-0007lh-8D for emacs-devel@gnu.org; Tue, 13 Nov 2018 14:11:52 -0500 Original-Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 36072400C73AE for ; Tue, 13 Nov 2018 12:20:32 -0600 (CST) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id Me6IgTtzokBj6Me6IgT2ga; Tue, 13 Nov 2018 13:11:51 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=hfvFuytAQF5HBRoHxjPbyabz1+nzm72pHsyCVWHNLaY=; b=P95Zd7Suv+IJaDNajIH2F6PzM+ 9jhVzip5VLhcArWgdWKGqRtElpWILH/jvCJt82dq9+C6s//8KV4Bq1PTe3YtH3ylAgJ3f804KOi54 pKQPtAusXBfoko+JCg1JQXNDsRuX0BgiSbS84Foz2qoY4b+WFWN+EwWXkbfoqw7VB570KPNPQ5Y9E 0AINXmeRNoLOY2fnBtoarPdRUnd/ApKuqkoTwSNeLgFcgIRGn3UORv0BMOKFRDzVsxHqET9dj+YWT gq3ckeJ1iIm4n1mym0C5PbRvgvbfPn2Mgtzh3tlNuqz6nmnsBawjOBvq/5Trt5B5rav/gI9p266vt QWfRei7g==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:50826 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.91) (envelope-from ) id 1gMe6I-0010Ak-76; Tue, 13 Nov 2018 13:11:50 -0600 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1gMe6I-0010Ak-76 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:50826 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.198.13 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:231119 Archived-At: I was able to locate the exact location where the tab stretch is being redrawn when I place a fake cursor on the following character; however, my test is causing Emacs to crash. I tried putting in two additional checks in an effort to void a crash (first_glyph != NULL && first_glyph->type != NULL), but the crash still occurs. Any pointers on how to refine my test to avoid crashing Emacs would be greatly appreciated. A partial GDB printout follows the relevant xdisp.c snippet below. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; xdisp.c snippet /* Prepend glyph strings for glyphs in front of the first glyph string that are overwritten because of the first glyph string's left overhang. The background of all strings prepended must be drawn because the first glyph string draws over it. */ i = left_overwritten (head); bool skip_p = false; int beg = i; if (w->mc.glyph_flavor == MC_GLYPH || w->mc.glyph_flavor == MC_GLYPHLESS || w->mc.glyph_flavor == MC_GLYPH_TAB) while (beg < start) { struct glyph *first_glyph = (row)->glyphs[area] + beg; if (first_glyph != NULL && first_glyph->type != NULL) { switch (first_glyph->type) { case CHAR_GLYPH: break; case COMPOSITE_GLYPH: break; case STRETCH_GLYPH: { skip_p = true; break; } case IMAGE_GLYPH: break; } } beg += 1; } if (i >= 0 && !skip_p) { enum draw_glyphs_face overlap_hl; /* If this row contains mouse highlighting, attempt to draw the overlapped glyphs with the correct highlight. This code fails if the overlap encompasses more than one glyph and mouse-highlight spans only some of these glyphs. However, making it work perfectly involves a lot more code, and I don't know if the pathological case occurs in practice, so we'll stick to this for now. --- cyd */ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; GDB Program received signal SIGSEGV, Segmentation fault. 0x000000010009c6cb in draw_glyphs (w=0x11e373c30, x=186, row=0x102f6fa00, area=TEXT_AREA, start=15, end=16, hl=DRAW_CURSOR, overlaps=0) at xdisp.c:31453 warning: Source file is more recent than executable. 31453 { (gdb) bt #0 0x000000010009c6cb in draw_glyphs (w=0x11e373c30, x=186, row=0x102f6fa00, area=TEXT_AREA, start=15, end=16, hl=DRAW_CURSOR, overlaps=0) at xdisp.c:31453 #1 0x00000001000a9361 in draw_phys_cursor_glyph (w=0x11e373c30, row=0x102f6fa00, hl=DRAW_CURSOR) at xdisp.c:34272 #2 0x00000001002c2828 in ns_draw_window_cursor (w=0x11e373c30, glyph_row=0x102f6fa00, x=165, y=444, cursor_type=BAR_CURSOR, cursor_width=1, on_p=true, active_p=true) at nsterm.m:3077 * * * (gdb) frame 0 #0 0x000000010009c6cb in draw_glyphs (w=0x11e373c30, x=186, row=0x102f6fa00, area=TEXT_AREA, start=15, end=16, hl=DRAW_CURSOR, overlaps=0) at xdisp.c:31453 31453 { (gdb) print first_glyph->type Cannot access memory at address 0x1227fffb8 (gdb) print first_glyph $1 = (struct glyph *) 0x1227fffb8