"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vi_mode.c" between
readline-7.0-rc1.tar.gz and readline-7.0-rc2.tar.gz

About: GNU Readline library - get a line from a user with editing. Release candidate.

vi_mode.c  (readline-7.0-rc1):vi_mode.c  (readline-7.0-rc2)
/* vi_mode.c -- A vi emulation mode for Bash. /* vi_mode.c -- A vi emulation mode for Bash.
Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */ Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
/* Copyright (C) 1987-2015 Free Software Foundation, Inc. /* Copyright (C) 1987-2016 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing. for reading lines of text with interactive input and history editing.
Readline is free software: you can redistribute it and/or modify Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
Readline is distributed in the hope that it will be useful, Readline is distributed in the hope that it will be useful,
skipping to change at line 1623 skipping to change at line 1623
end = rl_end; end = rl_end;
rl_kill_text (rl_point, end); rl_kill_text (rl_point, end);
if (rl_point > 0 && rl_point == rl_end) if (rl_point > 0 && rl_point == rl_end)
rl_backward_char (1, key); rl_backward_char (1, key);
return (0); return (0);
} }
/* This does what Posix specifies vi-mode C-w to do: using whitespace and
punctuation characters as the word boundaries. */
#define vi_unix_word_boundary(c) (whitespace(c) || ispunct(c))
int
rl_vi_unix_word_rubout (count, key)
int count, key;
{
int orig_point;
if (rl_point == 0)
rl_ding ();
else
{
orig_point = rl_point;
if (count <= 0)
count = 1;
while (count--)
{
/* This isn't quite what ksh93 does but it seems to match what the
Posix description of sh specifies, with a few accommodations
for sequences of whitespace characters between words and at
the end of the line. */
/* Skip over whitespace at the end of the line as a special case */
if (rl_point > 0 && (rl_line_buffer[rl_point] == 0) &&
whitespace (rl_line_buffer[rl_point - 1]))
while (--rl_point > 0 && whitespace (rl_line_buffer[rl_point]))
;
/* If we're at the start of a word, move back to word boundary so we
move back to the `preceding' word */
if (rl_point > 0 && (vi_unix_word_boundary (rl_line_buffer[rl_point]) =
= 0) &&
vi_unix_word_boundary (rl_line_buffer[rl_point - 1]))
rl_point--;
/* If we are at a word boundary (whitespace/punct), move backward
past a sequence of word boundary characters. If we are at the
end of a word (non-word boundary), move back to a word boundary */
if (rl_point > 0 && vi_unix_word_boundary (rl_line_buffer[rl_point]))
while (rl_point && vi_unix_word_boundary (rl_line_buffer[rl_point - 1
]))
rl_point--;
else if (rl_point > 0 && vi_unix_word_boundary (rl_line_buffer[rl_point
]) == 0)
while (rl_point && (vi_unix_word_boundary (rl_line_buffer[rl_point -
1]) == 0))
rl_point--;
}
rl_kill_text (orig_point, rl_point);
}
return 0;
}
int int
rl_vi_back_to_indent (count, key) rl_vi_back_to_indent (count, key)
int count, key; int count, key;
{ {
rl_beg_of_line (1, key); rl_beg_of_line (1, key);
while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point])) while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point]))
rl_point++; rl_point++;
return (0); return (0);
} }
 End of changes. 2 change blocks. 
1 lines changed or deleted 60 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS