Minor text formating tweaks

darcs-hash:20051230162919-ac50b-498d690fdec0aaf37c212eedf6b4c584c64f9a5f.gz
This commit is contained in:
axel 2005-12-31 02:29:19 +10:00
parent 8f121dce9c
commit 26de6ba26b
2 changed files with 108 additions and 82 deletions

View file

@ -223,6 +223,7 @@ typedef struct
int block_count( block_t *b )
{
if( b==0)
return 0;
return( block_count(b->outer)+1);

View file

@ -1546,7 +1546,6 @@ static int handle_completions( array_list_t *comp )
}
free( prefix );
repaint();
}
@ -2765,14 +2764,16 @@ wchar_t *reader_readline()
/* yank*/
case R_YANK:
yank_str = kill_yank();
{ yank_str = kill_yank();
insert_str( yank_str );
yank = wcslen( yank_str );
// wcscpy(data->search_buff,data->buff);
break;
}
/* rotate killring*/
case R_YANK_POP:
{
if( yank )
{
for( i=0; i<yank; i++ )
@ -2783,9 +2784,11 @@ wchar_t *reader_readline()
yank = wcslen(yank_str);
}
break;
}
/* Escape was pressed */
case L'\e':
{
if( *data->search_buff )
{
if( data->token_history_pos==-1 )
@ -2804,26 +2807,32 @@ wchar_t *reader_readline()
}
break;
}
/* delete backward*/
case R_BACKWARD_DELETE_CHAR:
{
remove_backward();
break;
}
/* delete forward*/
case R_DELETE_CHAR:
{
remove_forward();
break;
}
/* exit, but only if line is empty */
/* exit, but only if line is empty or the previous keypress was also an exit call */
case R_EXIT:
{
if( data->buff_len == 0 )
{
writestr( L"\n" );
data->end_loop=1;
}
break;
}
/* Newline, evaluate*/
case L'\n':
@ -2856,7 +2865,7 @@ wchar_t *reader_readline()
/* History up */
case R_HISTORY_SEARCH_BACKWARD:
// fwprintf( stderr, L"Search history for \'%ls\' %d long\n", data->search_buff, wcslen(data->search_buff) );
{
if( (last_char != R_HISTORY_SEARCH_BACKWARD) &&
(last_char != R_HISTORY_SEARCH_FORWARD) )
{
@ -2866,9 +2875,11 @@ wchar_t *reader_readline()
handle_history(history_prev_match(data->search_buff));
break;
}
/* History down */
case R_HISTORY_SEARCH_FORWARD:
{
if( (last_char != R_HISTORY_SEARCH_BACKWARD) &&
(last_char != R_HISTORY_SEARCH_FORWARD) )
{
@ -2878,7 +2889,9 @@ wchar_t *reader_readline()
handle_history(history_next_match(data->search_buff));
break;
}
/* Token search for a earlier match */
case R_HISTORY_TOKEN_SEARCH_BACKWARD:
{
int reset=0;
@ -2894,6 +2907,7 @@ wchar_t *reader_readline()
break;
}
/* Token search for a later match */
case R_HISTORY_TOKEN_SEARCH_FORWARD:
{
int reset=0;
@ -2910,7 +2924,6 @@ wchar_t *reader_readline()
}
/* Move left*/
case R_BACKWARD_CHAR:
if( data->buff_pos > 0 )
@ -2930,6 +2943,7 @@ wchar_t *reader_readline()
/* Move right*/
case R_FORWARD_CHAR:
{
if( data->buff_pos < data->buff_len )
{
if( !force_repaint() )
@ -2946,32 +2960,44 @@ wchar_t *reader_readline()
}
}
break;
}
case R_DELETE_LINE:
{
data->buff[0]=0;
data->buff_len=0;
data->buff_pos=0;
repaint();
break;
}
/* kill one word left */
case R_BACKWARD_KILL_WORD:
{
move_word(0,1);
break;
}
/* kill one word right */
case R_KILL_WORD:
{
move_word(1,1);
break;
}
/* move one word left*/
case R_BACKWARD_WORD:
{
move_word(0,0);
break;
}
/* move one word right*/
case R_FORWARD_WORD:
{
move_word( 1,0);
break;
}
case R_CLEAR_SCREEN:
{
@ -2990,7 +3016,6 @@ wchar_t *reader_readline()
case R_END_OF_HISTORY:
{
history_reset();
break;
}