diff --git a/ChangeLog b/ChangeLog
index 8a8021cf3f7e6ab058680693638e7f6af9958291..986b38979bbaa9ec99c3b4710940aa7cce2e164a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -110,10 +110,10 @@ CVS code -
 	  chars.c), move_left() (renamed move_mbleft() and moved to
 	  chars.c), move_right() (renamed move_mbright() and moved to
 	  chars.c), do_home(), do_verbatim_input(), do_delete(),
-	  do_tab(), do_next_word(), do_prev_word(), do_input(),
-	  do_output(), strstrwrapper(), get_buffer(), unget_input(),
-	  unget_kbinput(), get_input(), parse_kbinput(),
-	  unparse_kbinput(), parse_verbatim_kbinput(),
+	  do_tab(), do_enter(), indent_length(), do_next_word(),
+	  do_prev_word(), do_input(), do_output(), strstrwrapper(),
+	  get_buffer(), unget_input(), unget_kbinput(), get_input(),
+	  parse_kbinput(), unparse_kbinput(), parse_verbatim_kbinput(),
 	  do_statusbar_input(), do_statusbar_home(),
 	  do_statusbar_verbatim_kbinput(), do_statusbar_output(), and
 	  display_string(); removal of buffer_to_keys() and
diff --git a/src/move.c b/src/move.c
index bcda6dc8a87de7c4b9d172d6d9b0ec4f6e94876a..7925cf8f668326ddb5bdc356995f8ec0bcde17a9 100644
--- a/src/move.c
+++ b/src/move.c
@@ -57,26 +57,8 @@ void do_home(void)
 #ifndef NANO_SMALL
     if (ISSET(SMART_HOME)) {
 	size_t current_x_save = current_x;
-	char *blank_mb = charalloc(mb_cur_max());
-	int blank_mb_len;
 
-	current_x = 0;
-
-	while (current->data[current_x] != '\0') {
-	    blank_mb_len = parse_mbchar(current->data + current_x,
-		blank_mb
-#ifdef NANO_WIDE
-		, NULL
-#endif
-		, NULL);
-
-	    if (!is_blank_mbchar(blank_mb))
-		break;
-
-	    current_x += blank_mb_len;
-	}
-
-	free(blank_mb);
+	current_x = indent_length(current->data);
 
 	if (current_x == current_x_save ||
 		current->data[current_x] == '\0')
diff --git a/src/nano.c b/src/nano.c
index 9c9eb45a84422a866b64cdcea62331a6d0bad1b9..11b5b2ce2ddcc9fa139c684e5ffed4493ecc0a4f 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1330,11 +1330,13 @@ void do_next_word(void)
 {
     size_t pww_save = placewewant;
     const filestruct *current_save = current;
-    char *char_mb = charalloc(mb_cur_max());
+    char *char_mb;
     int char_mb_len;
 
     assert(current != NULL && current->data != NULL);
 
+    char_mb = charalloc(mb_cur_max());
+
     /* Move forward until we find the character after the last letter of
      * the current word. */
     while (current->data[current_x] != '\0') {
@@ -1399,12 +1401,14 @@ void do_prev_word(void)
 {
     size_t pww_save = placewewant;
     const filestruct *current_save = current;
-    char *char_mb = charalloc(mb_cur_max());
+    char *char_mb;
     int char_mb_len;
     bool begin_line = FALSE;
 
     assert(current != NULL && current->data != NULL);
 
+    char_mb = charalloc(mb_cur_max());
+
     /* Move backward until we find the character before the first letter
      * of the current word. */
     while (!begin_line) {
@@ -1633,7 +1637,7 @@ bool do_wrap(filestruct *inptr)
     if (ISSET(AUTOINDENT)) {
 	/* Indentation comes from the next line if wrapping, else from
 	 * this line. */
-	indentation = (wrapping ? wrap_line : inptr->data);
+	indentation = wrapping ? wrap_line : inptr->data;
 	indent_len = indent_length(indentation);
 	if (wrapping)
 	    /* The wrap_line text should not duplicate indentation.
@@ -2296,21 +2300,38 @@ void do_spell(void)
 }
 #endif /* !DISABLE_SPELLER */
 
-#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
+#ifndef NANO_SMALL
 /* The "indentation" of a line is the whitespace between the quote part
  * and the non-whitespace of the line. */
 size_t indent_length(const char *line)
 {
     size_t len = 0;
+    char *blank_mb;
+    int blank_mb_len;
 
     assert(line != NULL);
-    while (is_blank_char(*line)) {
-	line++;
-	len++;
+
+    blank_mb = charalloc(mb_cur_max());
+
+    while (*line != '\0') {
+	blank_mb_len = parse_mbchar(line, blank_mb
+#ifdef NANO_WIDE
+		, NULL
+#endif
+		, NULL);
+
+	if (!is_blank_mbchar(blank_mb))
+	    break;
+
+	line += blank_mb_len;
+	len += blank_mb_len;
     }
+
+    free(blank_mb);
+
     return len;
 }
-#endif /* !NANO_SMALL || !DISABLE_JUSTIFY */
+#endif /* !NANO_SMALL */
 
 #ifndef DISABLE_JUSTIFY
 /* justify_format() replaces Tab by Space and multiple spaces by 1
diff --git a/src/winio.c b/src/winio.c
index 74dbcad9ddffce2a3a2d73784d542a91ca71425f..225c02997b6a99fad3bda92f610705beeecef43b 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1819,26 +1819,8 @@ void do_statusbar_home(void)
 #ifndef NANO_SMALL
     if (ISSET(SMART_HOME)) {
 	size_t statusbar_x_save = statusbar_x;
-	char *blank_mb = charalloc(mb_cur_max());
-	int blank_mb_len;
 
-	statusbar_x = 0;
-
-	while (statusbar_x < statusbar_xend) {
-	    blank_mb_len = parse_mbchar(answer + statusbar_x,
-		blank_mb
-#ifdef NANO_WIDE
-		, NULL
-#endif
-		, NULL);
-
-	    if (!is_blank_mbchar(blank_mb))
-		break;
-
-	    statusbar_x += blank_mb_len;
-	}
-
-	free(blank_mb);
+	statusbar_x = indent_length(answer);
 
 	if (statusbar_x == statusbar_x_save ||
 		statusbar_x == statusbar_xend)
@@ -1904,11 +1886,13 @@ void do_statusbar_cut_text(void)
 #ifndef NANO_SMALL
 void do_statusbar_next_word(void)
 {
-    char *char_mb = charalloc(mb_cur_max());
+    char *char_mb;
     int char_mb_len;
 
     assert(answer != NULL);
 
+    char_mb = charalloc(mb_cur_max());
+
     /* Move forward until we find the character after the last letter of
      * the current word. */
     while (statusbar_x < statusbar_xend) {
@@ -1950,12 +1934,14 @@ void do_statusbar_next_word(void)
 
 void do_statusbar_prev_word(void)
 {
-    char *char_mb = charalloc(mb_cur_max());
+    char *char_mb;
     int char_mb_len;
     bool begin_line = FALSE;
 
     assert(answer != NULL);
 
+    char_mb = charalloc(mb_cur_max());
+
     /* Move backward until we find the character before the first letter
      * of the current word. */
     while (!begin_line) {