diff --git a/ChangeLog b/ChangeLog
index b0fdf24baf577244492e153d2a57dc45dc0692c9..21912e58217c2095ca7aaaa8e165260d7617efb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -315,6 +315,10 @@ CVS code -
   get_history_completion()
 	- Make parameters const where possible. (DLR)
 - text.c:
+  do_tab()
+	- Make sure that we insert the correct number of spaces if the
+	  TABS_TO_SPACES flag is set and placewewant is greater than the
+	  current column position of the cursor. (DLR)
   do_enter()
 	- Don't update the edit window until we set placewewant. (DLR)
   break_line()
diff --git a/src/text.c b/src/text.c
index 8b8bb24f7a08d88f7d3ce78fd86d7a72b5dabe1f..30e62182e225736ea30da8ffb0346a522e7bee5d 100644
--- a/src/text.c
+++ b/src/text.c
@@ -163,7 +163,7 @@ void do_tab(void)
 #ifndef NANO_SMALL
     if (ISSET(TABS_TO_SPACES)) {
 	char *output;
-	size_t output_len = 0, new_pww = openfile->placewewant;
+	size_t output_len = 0, new_pww = xplustabs();
 
 	do {
 	    new_pww++;