Article View: gnu.emacs.bug
Article #98889Display Bugs in Emacs 18.56
From: Leonard N. Zubkoff
Date: Mon, 28 Jan 1991 00:08
Date: Mon, 28 Jan 1991 00:08
68 lines
2457 bytes
2457 bytes
I've just tracked down and fixed a couple of display bugs in Emacs 18.56. The
screen line contents data structures are organized so that there is always a
null byte sentinel at both ends of a screen line. These sentinels are
destroyed under certain circumstances, leading to later problems (nlen = -1) in
update_line. (This might at least partly account for why the commented out code
was seen to lose.)
The first two bugs are in display_text_line and display_string in "xdisp.c".
In each of these routines, tabs are expanded without regard for whether the
expansion may over flow the line or not. The correct code for the tab
expansion is:
display_text_line:
else if (c == '\t')
{
do
{
if (p1 >= startp && p1 < endp)
*p1 = ' ';
p1++;
}
while ((p1 - startp + taboffset + hscroll - (hscroll > 0))
% tab_width);
}
display_string:
else if (c == '\t')
{
do
{
if (p1 >= start && p1 < end)
*p1 = ' ';
p1++;
}
while ((p1 - start + hscroll - (hscroll > 0)) % tab_width);
}
In each case, I've added an end test to the p1 >= start test.
The third piece of code that can violate the sentinel assumption is in the
routine update_line in "dispnew.c". Specifically, the code
obody[olen] = 1;
save = nbody[nlen];
nbody[nlen] = 0;
is used to setup sentinels in the lines and make sure the end points will not
match, and later on we see
/* Put correct value back in nbody[nlen].
This is important because direct_output_for_insert
can write into the line at a later point. */
nbody[nlen] = save;
to fix up nbody. The assignment to obody[olen] will violate the original
assumption if olen = screen_width. My solution is just to add the line
obody[olen] = 0;
immediately following
nbody[nlen] = save;
Enjoy!
Leonard
Technical Details
Message-ID:
<9101280008.AA01522@sodom>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!LUCID.COM!lnzShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,8038126900e40f9f,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1991-01-27 16:08:55 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!LUCID.COM!lnz From: lnz@LUCID.COM (Leonard N. Zubkoff) Newsgroups: gnu.emacs.bug Subject: Display Bugs in Emacs 18.56 Message-ID: <9101280008.AA01522@sodom> Date: 28 Jan 91 00:08:55 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 68 Approved: bug-gnu-emacs@prep.ai.mit.edu