changeset 19658:063c22255157

(internal_self_insert): Only set TARGET_CLM when C2 is tab. When multibyte characters are disabled, use 1 as the width of the inserted character.
author Richard M. Stallman <rms@gnu.org>
date Mon, 01 Sep 1997 17:54:25 +0000
parents 940d50684d68
children 315acc2627fe
files src/cmds.c
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/cmds.c	Mon Sep 01 17:14:48 1997 +0000
+++ b/src/cmds.c	Mon Sep 01 17:54:25 1997 +0000
@@ -396,20 +396,21 @@
          The correct value should be calculated only when necessary.  */
       int target_clm = 0;
 
-      /* Overwriting in binary-mode always substitute C2 by C.  But,
-	 overwriting in textual-mode does this substitution in the
-	 case that C is not NEWLINE and C2 is not NEWLINE nor TAB.  If
-	 C2 is TAB, the substitution is done only when C2 is currently
-	 expanded to 0 column, or more than 20 columns, or more than
-	 the width of C.  */
+      /* Overwriting in binary-mode always replaces C2 by C.
+	 Overwriting in textual-mode doesn't always do that.
+	 It inserts newlines in the usual way,
+	 and inserts any character at end of line
+	 or before a tab if it doesn't use the whole width of the tab.  */
       if (EQ (overwrite, Qoverwrite_mode_binary)
 	  || (c != '\n'
 	      && c2 != '\n'
-	      && (target_clm = current_column() + WIDTH_BY_CHAR_HEAD (str[0]),
-		  (c2 != '\t'
-		   || XINT (current_buffer->tab_width) <= 0
-		   || XFASTINT (current_buffer->tab_width) > 20
-		   || !(target_clm % XFASTINT (current_buffer->tab_width))))))
+	      && ! (c2 == '\t'
+		    && XINT (current_buffer->tab_width) > 0
+		    && XFASTINT (current_buffer->tab_width) < 20
+		    && ((NILP (current_buffer->enable_multibyte_characters)
+			 ? (target_clm = current_column () + 1)
+			 : (target_clm = current_column () + WIDTH_BY_CHAR_HEAD (str[0]))),
+			target_clm % XFASTINT (current_buffer->tab_width)))))
 	{
 	  int pos = PT;