Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 May 2001 22:03:15 -0700 (PDT)
From:      bpederson@geocities.com
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/27700: editors/nano 1.0.2 cut/paste patch needed
Message-ID:  <200105280503.f4S53Fv86800@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         27700
>Category:       ports
>Synopsis:       editors/nano 1.0.2 cut/paste patch needed
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 27 22:10:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Barry Pederson
>Release:        4.2 Release
>Organization:
>Environment:
>Description:
nano 1.0.1 and 1.0.2 have a bug in which cutting and pasting 
works incorrectly.  See

  http://sourceforge.net/tracker/index.php?func=detail&aid=423389&group_id=1304&atid=101304

for details.  Patch below is from the sourceforge website.
>How-To-Repeat:
Given these two paragraphs of random characters: 

-------- 
asdf asd f asdf sadf sdf asf 
weqw e wqe qwe qwe qwe qw e 
xc zxc c zxc zxc z xcz xc 

asdf asd f asdf sadf sdf asf 
weqw e wqe qwe qwe qwe qw e 
xc zxc c zxc zxc z xcz xc 

--------- 

Place the cursor on the first lone 'f', hit Ctrl-^ to 
start marking, down-arrow to the next line, Ctrl-K to cut, and 
then Ctrl-U to uncut, what gets pasted back is wrong (it should look 
like the second paragraph, which was identical to begin with) 

If you then go down to the second paragraph, and repeat the cutting, 
a message: "Nano in free(): warning chunk is already free." appears mixed in with the text.
>Fix:
diff -u -r1.27.2.3 cut.c
--- cut.c	2001/05/10 22:55:16	1.27.2.3
+++ cut.c	2001/05/17 03:39:40
@@ -61,7 +61,7 @@
 void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
 			int bot_x)
 {
-    filestruct *tmp, *next;
+    filestruct *tmp, *next, *botcopy;
     char *tmpstr;
 
     /* Set up the beginning of the cutbuffer */
@@ -103,7 +103,15 @@
      * up a newline when we're grabbing the last line of the mark.  For
      * the same reason, we don't do an extra totsize decrement. */
 
-    add_to_cutbuffer(bot);
+
+    /* I honestly do not know why this is needed.  After many hours of
+       using gdb on an OpenBSD box, I can honestly say something is 
+       screwed somewhere.  Not doing this causes update_line to annihilate
+       the last line copied into the cutbuffer when the mark is set ?!?!? */
+    botcopy = copy_node(bot);
+    add_to_cutbuffer(botcopy);
+    free(bot);
+
     top->next = next;
     if (next != NULL)
 	next->prev = top;
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105280503.f4S53Fv86800>