text.c (157184) | text.c (157191) |
---|---|
1/* text.c -- text handling commands for readline. */ 2 3/* Copyright (C) 1987-2005 Free Software Foundation, Inc. 4 5 This file is part of the GNU Readline Library, a library for 6 reading lines of text with interactive input and history editing. 7 8 The GNU Readline Library is free software; you can redistribute it --- 1057 unchanged lines hidden (view full) --- 1066} 1067 1068/* Delete the character under the cursor. Given a numeric argument, 1069 kill that many characters instead. */ 1070int 1071rl_delete (count, key) 1072 int count, key; 1073{ | 1/* text.c -- text handling commands for readline. */ 2 3/* Copyright (C) 1987-2005 Free Software Foundation, Inc. 4 5 This file is part of the GNU Readline Library, a library for 6 reading lines of text with interactive input and history editing. 7 8 The GNU Readline Library is free software; you can redistribute it --- 1057 unchanged lines hidden (view full) --- 1066} 1067 1068/* Delete the character under the cursor. Given a numeric argument, 1069 kill that many characters instead. */ 1070int 1071rl_delete (count, key) 1072 int count, key; 1073{ |
1074 int r; 1075 | |
1076 if (count < 0) 1077 return (_rl_rubout_char (-count, key)); 1078 1079 if (rl_point == rl_end) 1080 { 1081 rl_ding (); 1082 return -1; 1083 } 1084 1085 if (count > 1 || rl_explicit_arg) 1086 { 1087 int orig_point = rl_point; 1088 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 1089 rl_forward_char (count, key); 1090 else 1091 rl_forward_byte (count, key); 1092 | 1074 if (count < 0) 1075 return (_rl_rubout_char (-count, key)); 1076 1077 if (rl_point == rl_end) 1078 { 1079 rl_ding (); 1080 return -1; 1081 } 1082 1083 if (count > 1 || rl_explicit_arg) 1084 { 1085 int orig_point = rl_point; 1086 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 1087 rl_forward_char (count, key); 1088 else 1089 rl_forward_byte (count, key); 1090 |
1093 r = rl_kill_text (orig_point, rl_point); | 1091 rl_kill_text (orig_point, rl_point); |
1094 rl_point = orig_point; | 1092 rl_point = orig_point; |
1095 return r; | |
1096 } 1097 else 1098 { 1099 int new_point; 1100 1101 new_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO); | 1093 } 1094 else 1095 { 1096 int new_point; 1097 1098 new_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO); |
1102 return (rl_delete_text (rl_point, new_point)); | 1099 rl_delete_text (rl_point, new_point); |
1103 } | 1100 } |
1101 return 0; |
|
1104} 1105 1106/* Delete the character under the cursor, unless the insertion 1107 point is at the end of the line, in which case the character 1108 behind the cursor is deleted. COUNT is obeyed and may be used 1109 to delete forward or backward that many characters. */ 1110int 1111rl_rubout_or_delete (count, key) --- 528 unchanged lines hidden --- | 1102} 1103 1104/* Delete the character under the cursor, unless the insertion 1105 point is at the end of the line, in which case the character 1106 behind the cursor is deleted. COUNT is obeyed and may be used 1107 to delete forward or backward that many characters. */ 1108int 1109rl_rubout_or_delete (count, key) --- 528 unchanged lines hidden --- |