From 6be3807caecf823994290c74865cbaefc212e8a5 Mon Sep 17 00:00:00 2001 From: axel Date: Sun, 17 Sep 2006 09:05:32 +1000 Subject: [PATCH] Fix issue with ^W and other shortcurs sometimes not deleting anything darcs-hash:20060916230532-ac50b-395d34e2c67d2be3d634638265a98239442fd6cd.gz --- reader.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/reader.c b/reader.c index a810db5b3..c086ba5ac 100644 --- a/reader.c +++ b/reader.c @@ -2006,7 +2006,10 @@ static void move_word( int dir, int erase ) end_buff_pos--; } - + + /* + Remove all whitespace characters before finding a word + */ while( 1 ) { wchar_t c; @@ -2022,16 +2025,28 @@ static void move_word( int dir, int erase ) break; } - c = data->buff[end_buff_pos]; - - if( !iswspace( c ) ) + /* + Always eat at least one character + */ + if( end_buff_pos != data->buff_pos ) { - break; + + c = data->buff[end_buff_pos]; + + if( !iswspace( c ) ) + { + break; + } } end_buff_pos+=step; + + } + /* + Remove until we find a character that is not alphanumeric + */ while( 1 ) { wchar_t c; @@ -2056,7 +2071,7 @@ static void move_word( int dir, int erase ) whitespace, but do for all other non-alphabetic characters */ - if( iswspace( c ) ) + if( iswspace( c ) /* && ( abs( end_buff_pos-data->buff_pos ) > 1 ) */) end_buff_pos -= step; break; }