mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Make R_NULL not repaint and document the fact that this means some keybindings need to manually tell fish to repaint
darcs-hash:20070921144426-75c98-7db4351e14733e2c18e44515e8ed78b1f1faea80.gz
This commit is contained in:
parent
954c99a5ad
commit
3692074e7e
3 changed files with 17 additions and 27 deletions
|
@ -1091,7 +1091,11 @@ You can also bind a pice of shellscript to a key using the same
|
||||||
syntax. For example, the Alt-p functionality described above is
|
syntax. For example, the Alt-p functionality described above is
|
||||||
implemented using the following keybinding.
|
implemented using the following keybinding.
|
||||||
|
|
||||||
<pre>"\M-p": if commandline -j|grep -v 'less *$' >/dev/null; commandline -aj "|less;"; end</pre>
|
<pre>"\M-p": if commandline -j|grep -v 'less *$' >/dev/null; commandline -aj "|less;"; end;</pre>
|
||||||
|
|
||||||
|
If such a script produces output, the script needs to finish by
|
||||||
|
calling 'commandline -f repaint' in order to tell fish that a repaint
|
||||||
|
is in order.
|
||||||
|
|
||||||
\subsection killring Copy and paste (Kill Ring)
|
\subsection killring Copy and paste (Kill Ring)
|
||||||
|
|
||||||
|
|
21
input.c
21
input.c
|
@ -1539,7 +1539,7 @@ static wint_t input_exec_binding( mapping *m, const wchar_t *seq )
|
||||||
for( i=0; i<repeat_count; i++ )
|
for( i=0; i<repeat_count; i++ )
|
||||||
dump_functions();
|
dump_functions();
|
||||||
repeat_count = 1;
|
repeat_count = 1;
|
||||||
return R_NULL;
|
return R_REPAINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
case R_SELF_INSERT:
|
case R_SELF_INSERT:
|
||||||
|
@ -1563,13 +1563,13 @@ static wint_t input_exec_binding( mapping *m, const wchar_t *seq )
|
||||||
if( repeat > 0 && repeat <= 9 )
|
if( repeat > 0 && repeat <= 9 )
|
||||||
repeat_count *= repeat;
|
repeat_count *= repeat;
|
||||||
|
|
||||||
return R_NULL;
|
return R_REPAINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
case R_VI_DELETE_TO:
|
case R_VI_DELETE_TO:
|
||||||
{
|
{
|
||||||
first_command = R_VI_DELETE_TO;
|
first_command = R_VI_DELETE_TO;
|
||||||
return R_NULL;
|
return R_REPAINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1610,19 +1610,16 @@ static wint_t input_exec_binding( mapping *m, const wchar_t *seq )
|
||||||
is sent to the parser for evaluation.
|
is sent to the parser for evaluation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
First clear the commandline. Do not issue a linebreak, since
|
|
||||||
many shortcut commands do not procuce output.
|
|
||||||
*/
|
|
||||||
write( 1, "\r", 1 );
|
|
||||||
tputs(clr_eol,1,&writeb);
|
|
||||||
|
|
||||||
eval( m->command, 0, TOP );
|
eval( m->command, 0, TOP );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We still need to return something to the caller, R_NULL
|
We still need to return something to the caller, R_NULL
|
||||||
tells the reader that no key press needs to be handled, but
|
tells the reader that no key press needs to be handled,
|
||||||
it might be a good idea to redraw.
|
and no repaint is needed.
|
||||||
|
|
||||||
|
Bindings that produce output should emit a R_REPAINT
|
||||||
|
function by calling 'commandline -f repaint' to tell
|
||||||
|
fish that a repaint is in order.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return R_NULL;
|
return R_NULL;
|
||||||
|
|
13
reader.c
13
reader.c
|
@ -2447,10 +2447,6 @@ wchar_t *reader_readline()
|
||||||
|
|
||||||
case R_NULL:
|
case R_NULL:
|
||||||
{
|
{
|
||||||
// exec_prompt();
|
|
||||||
write( 1, "\r", 1 );
|
|
||||||
s_reset( &data->screen );
|
|
||||||
repaint();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2905,21 +2901,15 @@ wchar_t *reader_readline()
|
||||||
int line_offset_old;
|
int line_offset_old;
|
||||||
int total_offset_new;
|
int total_offset_new;
|
||||||
|
|
||||||
// debug( 0, L"Move up one line to %d", line_new );
|
|
||||||
|
|
||||||
base_pos_new = parse_util_get_offset_from_line( data->buff,
|
base_pos_new = parse_util_get_offset_from_line( data->buff,
|
||||||
line_new );
|
line_new );
|
||||||
/* debug( 0, L"Old cursor offset is %d, new base offset is %d",
|
|
||||||
data->buff_pos,
|
|
||||||
base_pos_new );
|
|
||||||
*/
|
|
||||||
base_pos_old = parse_util_get_offset_from_line( data->buff,
|
base_pos_old = parse_util_get_offset_from_line( data->buff,
|
||||||
line_old );
|
line_old );
|
||||||
|
|
||||||
|
|
||||||
indent_old = data->indent[base_pos_old];
|
indent_old = data->indent[base_pos_old];
|
||||||
indent_new = data->indent[base_pos_new];
|
indent_new = data->indent[base_pos_new];
|
||||||
// debug( 0, L"Old indent %d, new indent %d", indent_old, indent_new );
|
|
||||||
|
|
||||||
line_offset_old = data->buff_pos - parse_util_get_offset_from_line( data->buff,
|
line_offset_old = data->buff_pos - parse_util_get_offset_from_line( data->buff,
|
||||||
line_old );
|
line_old );
|
||||||
|
@ -2928,7 +2918,6 @@ wchar_t *reader_readline()
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue