From daeab0518d0391d6726eb9f3195dff3b04734a0d Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Tue, 10 May 2011 05:43:08 +0000
Subject: [PATCH] 2011-05-10 Chris Allegretta <chrisa@asty.org>         *
 text.c (do_enter): Only increment totsize by the auto-indented amount, size
 the previous line's size was           already counted.  Fixes bug reported
 by Robert Spanjaard.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4544 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog  | 4 ++++
 src/text.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 3f8e00d4..0d5c14a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-05-10 Chris Allegretta <chrisa@asty.org>
+        * text.c (do_enter): Only increment totsize by the auto-indented amount, size the previous line's size was
+	  already counted.  Fixes bug reported by Robert Spanjaard.
+
 2011-05-08 Chris Allegretta <chrisa@asty.org>
 	* doc/syntax/Makefile.am: Finally get around to sorting the syntax file list
 
diff --git a/src/text.c b/src/text.c
index 59459c21..ae434ee0 100644
--- a/src/text.c
+++ b/src/text.c
@@ -711,7 +711,7 @@ void do_enter(bool undoing)
 #ifndef NANO_TINY
     if (ISSET(AUTOINDENT)) {
 	strncpy(newnode->data, openfile->current->data, extra);
-	openfile->totsize += mbstrlen(newnode->data);
+	openfile->totsize += extra;
     }
 #endif
     null_at(&openfile->current->data, openfile->current_x);
-- 
GitLab