[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Test to determine character left-overhangs a tab stretch.
From: |
Keith David Bershatsky |
Subject: |
Re: Test to determine character left-overhangs a tab stretch. |
Date: |
Tue, 13 Nov 2018 11:11:49 -0800 |
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