diff --git a/src/nano.c b/src/nano.c
index 3f94a6a7d3e63e79c8e81dcff72f5d16dac84447..317f7d154a6a36d388e1e01ce8e24bac94ea7038 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2764,8 +2764,8 @@ void do_justify(bool full_justify)
 	        break_pos = break_line(current->data + indent_len,
 			fill - strnlenpt(current->data, indent_len),
 			TRUE);
-		if (break_pos == -1 || break_pos + indent_len ==
-			line_len)
+		if (break_pos == -1 ||
+			break_pos + indent_len == line_len)
 		    /* We can't break the line, or don't need to, so
 		     * just go on to the next. */
 		    goto continue_loc;
@@ -3587,6 +3587,15 @@ void do_output(int *kbinput, size_t kbinput_len)
 #endif
 
     for (i = 0; i < kbinput_len; i++) {
+	/* Null to newline, if needed. */
+	if (kbinput[i] == '\0')
+	    kbinput[i] = '\n';
+	/* Newline to Enter, if needed. */
+	else if (kbinput[i] == '\n') {
+	    do_enter();
+	    continue;
+	}
+
 #ifdef NANO_WIDE
 	/* Change the wide character to its multibyte value.  If it's
 	 * invalid, go on to the next character. */
@@ -3604,15 +3613,6 @@ void do_output(int *kbinput, size_t kbinput_len)
 	}
 #endif
 
-	/* Null to newline, if needed. */
-	if (key[0] == '\0' && key_len == 1)
-	    key[0] = '\n';
-	/* Newline to Enter, if needed. */
-	else if (key[0] == '\n' && key_len == 1) {
-	    do_enter();
-	    continue;
-	}
-
 	/* When a character is inserted on the current magicline, it
 	 * means we need a new one! */
 	if (filebot == current)
diff --git a/src/winio.c b/src/winio.c
index aad629f50a92976e710fd3c1b42d3ec7c479e9f0..fbc0a3f05f72ed7566715e52bc493099a1fd429b 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2897,8 +2897,8 @@ void edit_add(const filestruct *fileptr, const char *converted, int
 #endif /* !NANO_SMALL */
 }
 
-/* Just update one line in the edit buffer.  Basically a wrapper for
- * edit_add().
+/* Just update one line in the edit buffer.  This is basically a wrapper
+ * for edit_add().
  *
  * If fileptr != current, then index is considered 0.  The line will be
  * displayed starting with fileptr->data[index].  Likely args are
@@ -2906,7 +2906,7 @@ void edit_add(const filestruct *fileptr, const char *converted, int
 void update_line(const filestruct *fileptr, size_t index)
 {
     int line;
-	/* line in the edit window for CURSES calls */
+	/* The line in the edit window that we want to update. */
     char *converted;
 	/* fileptr->data converted to have tabs and control characters
 	 * expanded. */
@@ -2922,7 +2922,7 @@ void update_line(const filestruct *fileptr, size_t index)
     if (line < 0 || line >= editwinrows)
 	return;
 
-    /* First, blank out the line (at a minimum) */
+    /* First, blank out the line. */
     mvwaddstr(edit, line, 0, hblank);
 
     /* Next, convert variables that index the line to their equivalent
@@ -2930,11 +2930,11 @@ void update_line(const filestruct *fileptr, size_t index)
     index = (fileptr == current) ? strnlenpt(fileptr->data, index) : 0;
     page_start = get_page_start(index);
 
-    /* Expand the line, replacing Tab by spaces, and control characters
-     * by their display form. */
+    /* Expand the line, replacing tabs with spaces, and control
+     * characters with their displayed forms. */
     converted = display_string(fileptr->data, page_start, COLS);
 
-    /* Now, paint the line */
+    /* Paint the line. */
     edit_add(fileptr, converted, line, page_start);
     free(converted);