NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/57072: nvi error "Error: move: l(24 + 0) c(80 + 0)"



The following reply was made to PR bin/57072; it has been noted by GNATS.

From: Simon Burge <simonb%NetBSD.org@localhost>
To: RVP <rvp%SDF.ORG@localhost>
Cc: Rin Okuyama <rokuyama.rk%gmail.com@localhost>,
    Brett Lymn <blymn%internode.on.net@localhost>, gnats-bugs%netbsd.org@localhost
Subject: Re: bin/57072: nvi error "Error: move: l(24 + 0) c(80 + 0)"
Date: Thu, 27 Oct 2022 01:32:32 +1100

 RVP wrote:
 
 > On Wed, 26 Oct 2022, Simon Burge wrote:
 >
 > > I haven't looked closely at the vi code, but would be easier/simplier
 > > or just plain more-hacky to just not try to put the cursor in the last
 > > column of the last row?  Already it deals with status messages longer
 > > than (window-width) chars by doing a multiline status message, so maybe
 > > just tweak that logic to kick in for (window-width - 1)?
 > >
 >
 > Here you go. Cooked this up a couple of days back, but, didn't send
 > it in 'cuz like rin@ I noticed nvi behaved OK with ncurses, but didn't
 > characterize the bug any further:
 
 Thanks.  That got me thinking though that a more general fix^Whack would
 be to check in msgq() itself rather than one caller to msgq().  I'm not
 sure if this is called with any other longer strings, but this seems
 more robust.
 
 Still better for Brett to fix the bug if possible/easy/whatever!
 
 Cheers,
 Simon.
 
 Index: vs_msg.c
 ===================================================================
 RCS file: /cvsroot/src/external/bsd/nvi/dist/vi/vs_msg.c,v
 retrieving revision 1.6
 diff -d -p -u -r1.6 vs_msg.c
 --- vs_msg.c	26 Jan 2014 21:43:45 -0000	1.6
 +++ vs_msg.c	26 Oct 2022 09:51:52 -0000
 @@ -341,6 +341,11 @@ vs_msg(SCR *sp, mtype_t mtype, char *lin
  	 * XXX
  	 * There are almost certainly pathological cases that will break this
  	 * code.
 +	 *
 +	 * XXX
 +	 * Some versions of curses have problems writing to the last column
 +	 * in the last row.  Set maxcols to the number of columns-2 to work
 +	 * around this.
  	 */
  	if (IS_ONELINE(sp))
  		(void)msg_cmsg(sp, CMSG_CONT_S, &padding);
 @@ -348,7 +353,7 @@ vs_msg(SCR *sp, mtype_t mtype, char *lin
  		padding = 0;
  	padding += 2;
  
 -	maxcols = sp->cols - 1;
 +	maxcols = sp->cols - 2;
  	if (vip->lcontinue != 0) {
  		if (len + vip->lcontinue + padding > maxcols)
  			vs_output(sp, vip->mtype, ".\n", 2);
 


Home | Main Index | Thread Index | Old Index