comparison src/cmds.c @ 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 498c1590b4a8
children 0cd7f6f42138
comparison
equal deleted inserted replaced
19657:940d50684d68 19658:063c22255157
394 unsigned char c2 = FETCH_BYTE (PT); 394 unsigned char c2 = FETCH_BYTE (PT);
395 /* A column the cursor should be placed at after this insertion. 395 /* A column the cursor should be placed at after this insertion.
396 The correct value should be calculated only when necessary. */ 396 The correct value should be calculated only when necessary. */
397 int target_clm = 0; 397 int target_clm = 0;
398 398
399 /* Overwriting in binary-mode always substitute C2 by C. But, 399 /* Overwriting in binary-mode always replaces C2 by C.
400 overwriting in textual-mode does this substitution in the 400 Overwriting in textual-mode doesn't always do that.
401 case that C is not NEWLINE and C2 is not NEWLINE nor TAB. If 401 It inserts newlines in the usual way,
402 C2 is TAB, the substitution is done only when C2 is currently 402 and inserts any character at end of line
403 expanded to 0 column, or more than 20 columns, or more than 403 or before a tab if it doesn't use the whole width of the tab. */
404 the width of C. */
405 if (EQ (overwrite, Qoverwrite_mode_binary) 404 if (EQ (overwrite, Qoverwrite_mode_binary)
406 || (c != '\n' 405 || (c != '\n'
407 && c2 != '\n' 406 && c2 != '\n'
408 && (target_clm = current_column() + WIDTH_BY_CHAR_HEAD (str[0]), 407 && ! (c2 == '\t'
409 (c2 != '\t' 408 && XINT (current_buffer->tab_width) > 0
410 || XINT (current_buffer->tab_width) <= 0 409 && XFASTINT (current_buffer->tab_width) < 20
411 || XFASTINT (current_buffer->tab_width) > 20 410 && ((NILP (current_buffer->enable_multibyte_characters)
412 || !(target_clm % XFASTINT (current_buffer->tab_width)))))) 411 ? (target_clm = current_column () + 1)
412 : (target_clm = current_column () + WIDTH_BY_CHAR_HEAD (str[0]))),
413 target_clm % XFASTINT (current_buffer->tab_width)))))
413 { 414 {
414 int pos = PT; 415 int pos = PT;
415 416
416 if (target_clm == 0) 417 if (target_clm == 0)
417 number_to_delete = forward_point (1) - PT; 418 number_to_delete = forward_point (1) - PT;