Remove readline legacy input function 'winch' and replace its functionality with an event handler function. Once again make the null keybinding do nothing. There are various sitauations where you want to perform a repaint at just the right time, and more or less by luck it worked very well to do this on null, but this really shouldn't happen and no longer does. Hopefully if new repainting issues turn up, they can be fixed at the root instead of once again reapplying this broken bandaid.

darcs-hash:20070930225354-75c98-8e2b518aa0ef694cee889c1c599ff4f158d9eb7f.gz
This commit is contained in:
liljencrantz 2007-10-01 08:53:54 +10:00
parent 5870ee7723
commit 4b85eb32d7
6 changed files with 30 additions and 24 deletions

View file

@ -134,7 +134,6 @@ static const wchar_t *name_arr[] =
L"kill-word",
L"backward-kill-word",
L"dump-functions",
L"winch",
L"history-token-search-backward",
L"history-token-search-forward",
L"self-insert",
@ -216,7 +215,6 @@ static const wchar_t code_arr[] =
R_KILL_WORD,
R_BACKWARD_KILL_WORD,
R_DUMP_FUNCTIONS,
R_WINCH,
R_HISTORY_TOKEN_SEARCH_BACKWARD,
R_HISTORY_TOKEN_SEARCH_FORWARD,
R_SELF_INSERT,
@ -346,7 +344,7 @@ static int interrupt_handler()
return 3;
}
return R_WINCH;
return R_NULL;
}
int input_init()

View file

@ -38,7 +38,6 @@ enum
R_KILL_WORD,
R_BACKWARD_KILL_WORD,
R_DUMP_FUNCTIONS,
R_WINCH,
R_HISTORY_TOKEN_SEARCH_BACKWARD,
R_HISTORY_TOKEN_SEARCH_FORWARD,
R_SELF_INSERT,

View file

@ -679,12 +679,11 @@ void repaint()
parser_test( data->buff, data->indent, 0, 0 );
s_write( &data->screen,
(wchar_t *)data->prompt_buff.buff,
data->buff,
data->color,
data->indent,
data->buff_pos );
(wchar_t *)data->prompt_buff.buff,
data->buff,
data->color,
data->indent,
data->buff_pos );
}
@ -2339,7 +2338,7 @@ wchar_t *reader_readline()
exec_prompt();
reader_super_highlight_me_plenty( data->buff_pos, 0 );
s_reset( &data->screen, 0 );
s_reset( &data->screen, 1 );
repaint();
/*
@ -2465,7 +2464,6 @@ wchar_t *reader_readline()
case R_NULL:
{
repaint();
break;
}
@ -2473,13 +2471,7 @@ wchar_t *reader_readline()
{
exec_prompt();
write( 1, "\r", 1 );
s_reset( &data->screen, 1 );
repaint();
break;
}
case R_WINCH:
{
s_reset( &data->screen, 0 );
repaint();
break;
}

View file

@ -658,7 +658,7 @@ static void s_update( screen_t *scr, wchar_t *prompt )
need_clear = 1;
s_move( scr, &output, 0, 0 );
scr->actual_width = screen_width;
s_reset( scr, 1 );
s_reset( scr, 0 );
}
if( wcscmp( prompt, (wchar_t *)scr->actual_prompt.buff ) )
@ -918,6 +918,8 @@ void s_write( screen_t *s,
void s_reset( screen_t *s, int reset_cursor )
{
CHECK( s, );
int prev_line = s->actual_cursor[1];
s_reset_arr( &s->actual );
s->actual_cursor[0] = s->actual_cursor[1] = 0;
sb_clear( &s->actual_prompt );
@ -931,6 +933,8 @@ void s_reset( screen_t *s, int reset_cursor )
*/
fstat( 1, &s->prev_buff_1 );
fstat( 2, &s->prev_buff_2 );
write( 1, "\r", 1 );
s->actual_cursor[1] = prev_line;
}
}

View file

@ -102,9 +102,19 @@ void s_write( screen_t *s,
int cursor_pos );
/**
This function resets the screen buffers internal knowledge about
the contents of the screen. Use this function when some other
function than s_write has written to the screen.
This function resets the screen buffers internal knowledge about
the contents of the screen. Use this function when some other
function than s_write has written to the screen.
\param s the screen to reset
\param reset_cursor whether the line on which the curor has changed should be assumed to have changed. If \c reset_cursor is set to 0, the library will attempt to make sure that the screen area does not seem to move up or down on repaint.
If reset_cursor is incorreclt set to 0, this may result in screen
contents being erased. If it is incorrectly set to one, it may
result in one or more lines of garbage on screen on the next
repaint. If this happens during a loop, such as an interactive
resizing, there will be one line of garbage for every repaint,
which will quicly fill the screen.
*/
void s_reset( screen_t *s, int reset_cursor );

View file

@ -195,6 +195,9 @@ function __fish_config_interactive -d "Initializations that should be performed
eval $fish_key_bindings
end ^/dev/null
function __fish_winch_handler --on-signal winch
commandline -f repaint
end
end