9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] acme line wrap bug
Date: Thu,  4 Mar 2010 10:59:47 -0500	[thread overview]
Message-ID: <e9be45d847b532ab66328a885b267326@brasstown.quanstro.net> (raw)
In-Reply-To: <dd6fe68a1002120848n43edba50mc0a27c01eafa413b@mail.gmail.com>

On Fri Feb 12 11:49:37 EST 2010, rsc@swtch.com wrote:
> > acme doesn't always clear the right margin to compensate for
> > the different amount of right-margin slop due to different
> > character widths.  in this case ">" is very wide and won't fit
> > in the space that "n" did.  so the n is mistakenly shown where
> > it shouldn't be.
> >
> > between the two pngs, the text "has gone" was cut.
>
> long time bug.  patch?

this has been effective for me:

; diff -c /n/dump/2010/0212/sys/src/libframe/frdelete.c frdelete.c
/n/dump/2010/0212/sys/src/libframe/frdelete.c:10,16 - frdelete.c:10,16
  {
  	Point pt0, pt1, ppt0;
  	Frbox *b;
- 	int n0, n1, n;
+ 	int n0, n1, n, w0;
  	ulong cn1;
  	Rectangle r;
  	int nn0;
/n/dump/2010/0212/sys/src/libframe/frdelete.c:53,58 - frdelete.c:53,59
  		r.max = pt0;
  		r.max.y += f->font->height;
  		if(b->nrune > 0){
+ 			w0 = b->wid;
  			if(n != b->nrune){
  				_frsplitbox(f, n1, n);
  				b = &f->box[n1];
/n/dump/2010/0212/sys/src/libframe/frdelete.c:60,65 - frdelete.c:61,74
  			r.max.x += b->wid;
  			draw(f->b, r, f->b, nil, pt1);
  			cn1 += b->nrune;
+
+ 			/* blank remainder of line */
+ 			r.min.x = r.max.x;
+ 			r.max.x += w0 - b->wid;
+ 			if(r.max.x > f->r.max.x)
+ 				r.max.x = f->r.max.x;
+ 			if(r.max.x != r.min.x)
+ 				draw(f->b, r, f->cols[BACK], nil, r.min);
  		}else{
  			r.max.x += _frnewwid0(f, pt0, b);
  			if(r.max.x > f->r.max.x)

- erik



      parent reply	other threads:[~2010-03-04 15:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 19:16 erik quanstrom
2010-02-12 16:48 ` Russ Cox
2010-02-12 16:57   ` erik quanstrom
2010-03-04 15:59   ` erik quanstrom [this message]

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

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

  git send-email \
    --in-reply-to=e9be45d847b532ab66328a885b267326@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /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.
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 NNTP newsgroup(s).