mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-10 20:20:38 +02:00
commit bash-20050324 snapshot
This commit is contained in:
+17
-55
@@ -767,10 +767,8 @@ _rl_insert_char (count, c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX == 1 || rl_byte_oriented)
|
||||
{
|
||||
#endif
|
||||
/* We are inserting a single character.
|
||||
If there is pending input, then make a string of all of the
|
||||
pending characters that are bound to rl_insert, and insert
|
||||
@@ -786,14 +784,12 @@ _rl_insert_char (count, c)
|
||||
str[0] = c;
|
||||
rl_insert_text (str);
|
||||
}
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
}
|
||||
else
|
||||
{
|
||||
rl_insert_text (incoming);
|
||||
stored_count = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -999,43 +995,17 @@ _rl_rubout_char (count, key)
|
||||
return -1;
|
||||
}
|
||||
|
||||
orig_point = rl_point;
|
||||
if (count > 1 || rl_explicit_arg)
|
||||
{
|
||||
orig_point = rl_point;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
rl_backward_char (count, key);
|
||||
else
|
||||
#endif
|
||||
rl_backward_byte (count, key);
|
||||
rl_backward_char (count, key);
|
||||
rl_kill_text (orig_point, rl_point);
|
||||
}
|
||||
else
|
||||
else if (MB_CUR_MAX == 1 || rl_byte_oriented)
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX == 1 || rl_byte_oriented)
|
||||
{
|
||||
#endif
|
||||
c = rl_line_buffer[--rl_point];
|
||||
rl_delete_text (rl_point, rl_point + 1);
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
}
|
||||
else
|
||||
{
|
||||
int orig_point;
|
||||
|
||||
orig_point = rl_point;
|
||||
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
|
||||
c = rl_line_buffer[rl_point];
|
||||
rl_delete_text (rl_point, orig_point);
|
||||
}
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
|
||||
/* I don't think that the hack for end of line is needed for
|
||||
multibyte chars (and it doesn't work for those chars, anyway). */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX == 1 || rl_byte_oriented)
|
||||
#endif
|
||||
c = rl_line_buffer[--rl_point];
|
||||
rl_delete_text (rl_point, orig_point);
|
||||
/* The erase-at-end-of-line hack is of questionable merit now. */
|
||||
if (rl_point == rl_end && ISPRINT (c) && _rl_last_c_pos)
|
||||
{
|
||||
int l;
|
||||
@@ -1043,6 +1013,11 @@ _rl_rubout_char (count, key)
|
||||
_rl_erase_at_end_of_line (l);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
|
||||
rl_delete_text (rl_point, orig_point);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1067,11 +1042,9 @@ rl_delete (count, key)
|
||||
if (count > 1 || rl_explicit_arg)
|
||||
{
|
||||
int orig_point = rl_point;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
rl_forward_char (count, key);
|
||||
else
|
||||
#endif
|
||||
rl_forward_byte (count, key);
|
||||
|
||||
r = rl_kill_text (orig_point, rl_point);
|
||||
@@ -1081,11 +1054,8 @@ rl_delete (count, key)
|
||||
else
|
||||
{
|
||||
int new_point;
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
new_point = _rl_find_next_mbchar (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
|
||||
else
|
||||
new_point = rl_point + 1;
|
||||
|
||||
|
||||
new_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
|
||||
return (rl_delete_text (rl_point, new_point));
|
||||
}
|
||||
}
|
||||
@@ -1336,11 +1306,11 @@ rl_transpose_chars (count, key)
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
char *dummy;
|
||||
int i, prev_point;
|
||||
int i;
|
||||
#else
|
||||
char dummy[2];
|
||||
#endif
|
||||
int char_length;
|
||||
int char_length, prev_point;
|
||||
|
||||
if (count == 0)
|
||||
return 0;
|
||||
@@ -1355,20 +1325,12 @@ rl_transpose_chars (count, key)
|
||||
|
||||
if (rl_point == rl_end)
|
||||
{
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
|
||||
else
|
||||
--rl_point;
|
||||
rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_NONZERO);
|
||||
count = 1;
|
||||
}
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
prev_point = rl_point;
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
|
||||
else
|
||||
#endif
|
||||
rl_point--;
|
||||
rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_NONZERO);
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
char_length = prev_point - rl_point;
|
||||
|
||||
Reference in New Issue
Block a user