diff --git a/BUGS b/BUGS
index 76bea52aaf0fc4c2c44b7d70a2f2d7d1389f8147..7dd9a8b255a00ed97272dc49cf507e42c79e0829 100644
--- a/BUGS
+++ b/BUGS
@@ -120,8 +120,7 @@
 
 ** Open BUGS **
 
-Informal note - when using marked write to file, if there's only one
-line of text hilighted, it writes the whole rest of the ifle to disk and
-goes bonkers.  Delete this message when fixed.
+Informal note - when using marked write to file, the number of lines
+written is off by one.  Delete this message when fixed.
 
 $Id$
diff --git a/ChangeLog b/ChangeLog
index 0a6962d043dfa29d7cdd1b3695ee46a72da5fda4..0fefd52a3c7a88234cac7c1355d6f75ffd9efdfb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -70,6 +70,9 @@ Cvs code -
 	- If the line is empty when using -k and wasn't already added,
 	  create a dummy line and add it to the cutbuffer (fixes bug #61)
 	- Reset marked_cut if we blow away the cutbuffer.
+	- Moved the case of current == mark_beginbuf into cut_marked
+	  segment, so do_writeout could call it when writing selection to
+	  file.
   do_uncut_text()
 	- Reset cutbuffer even if we're uncutting marked or cut to end text!
 - faq.html:
diff --git a/cut.c b/cut.c
index 591648f7e21df07d569e995ba355b0ea804c85b5..73a30630a6ba075b24bb7385c30ee8e3e98ca8e7 100644
--- a/cut.c
+++ b/cut.c
@@ -68,6 +68,39 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
 {
     filestruct *tmp, *next, *botcopy;
     char *tmpstr;
+    int newsize;
+
+    /* Special case for cutting part of one line */
+    if (top == bot) {
+        int swap;
+
+	tmp = copy_node(top);
+	newsize = abs(bot_x - top_x) + 1;
+	tmpstr = charalloc(newsize + 1);
+
+	/* Make top_x always be before bot_x */
+	if (top_x > bot_x) {
+	    swap = top_x;
+	    top_x = bot_x;
+	    bot_x = swap;
+	}
+
+	strncpy(tmpstr, &top->data[top_x], newsize);
+
+	if (destructive) {
+	    memmove(&top->data[top_x], &top->data[bot_x],
+		strlen(&top->data[bot_x]) + 1);
+	    align(&top->data);
+	    current_x = top_x;
+	    update_cursor();
+	}
+	tmpstr[newsize - 1] = 0;
+	tmp->data = tmpstr;
+	add_to_cutbuffer(tmp);
+	dump_buffer(cutbuffer);
+
+	return;
+    }
 
     /* Set up the beginning of the cutbuffer */
     tmp = copy_node(top);
@@ -159,8 +192,7 @@ int do_cut_text(void)
 {
     filestruct *tmp, *fileptr = current;
 #ifndef NANO_SMALL
-    char *tmpstr;
-    int newsize, cuttingtoend = 0;
+    int cuttingtoend = 0;
 #endif
 
 
@@ -218,30 +250,7 @@ int do_cut_text(void)
 	}
     }
     if (ISSET(MARK_ISSET)) {
-	if (current->lineno == mark_beginbuf->lineno) {
-	    tmp = copy_node(current);
-	    newsize = abs(mark_beginx - current_x) + 1;
-
-	    tmpstr = charalloc(newsize + 1);
-	    if (current_x < mark_beginx) {
-		strncpy(tmpstr, &current->data[current_x], newsize);
-		memmove(&current->data[current_x],
-			&current->data[mark_beginx],
-			strlen(&current->data[mark_beginx]) + 1);
-	    } else {
-		strncpy(tmpstr, &current->data[mark_beginx], newsize);
-		memmove(&current->data[mark_beginx],
-			&current->data[current_x],
-			strlen(&current->data[current_x]) + 1);
-		current_x = mark_beginx;
-		update_cursor();
-	    }
-	    tmpstr[newsize - 1] = 0;
-	    tmp->data = tmpstr;
-	    add_to_cutbuffer(tmp);
-	    dump_buffer(cutbuffer);
-	    align(&current->data);
-	} else if (current->lineno < mark_beginbuf->lineno)
+	if (current->lineno <= mark_beginbuf->lineno)
 	    cut_marked_segment(current, current_x, mark_beginbuf,
 			       mark_beginx, 1);
 	else
diff --git a/files.c b/files.c
index 503e0ddedbd394f6d190e55c12a6b56399ac6924..f37d7a795901d277e9069ba22ccce8e1d7ff0173 100644
--- a/files.c
+++ b/files.c
@@ -546,10 +546,12 @@ int do_writeout(char *path, int exiting, int append)
     }
 
     while (1) {
+#ifndef NANO_SMALL
 	if (ISSET(MARK_ISSET) && !exiting)
 	    i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, "",
 		    _("%s Selection to File"), append ? _("Append") : _("Write"));
 	else
+#endif
 	    i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, answer,
 		    _("File Name to %s"), append ? _("Append") : _("Write"));
 
@@ -604,6 +606,7 @@ int do_writeout(char *path, int exiting, int append)
 	    filestruct *filebotbak = filebot;
 	    filestruct *cutback = cutbuffer;
 	    int oldmod = 0;
+	    cutbuffer = NULL;
 
 	    /* Okay, since write_file changes the filename, back it up */
 	    if (ISSET(MODIFIED))
@@ -611,7 +614,7 @@ int do_writeout(char *path, int exiting, int append)
 
 	    /* Now, non-destructively add the marked text to the
 	       cutbuffer, and write the file out using the cutbuffer ;) */
-	    if (current->lineno < mark_beginbuf->lineno)
+	    if (current->lineno <= mark_beginbuf->lineno)
 		cut_marked_segment(current, current_x, mark_beginbuf,
 				mark_beginx, 0);
 	    else