mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Implement a minimal 'dumb terminal mode'. This mode is used to at least get the relevant information on-screen when using a dumb terminal, though the interface is pretty crippled.
darcs-hash:20070801190754-ac50b-4a07ba05455f3ff55e337a78320dc4302cd3502c.gz
This commit is contained in:
parent
782a739736
commit
88199d6b51
1 changed files with 35 additions and 12 deletions
23
screen.c
23
screen.c
|
@ -754,6 +754,12 @@ static void s_update( screen_t *scr, wchar_t *prompt )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int is_dumb()
|
||||||
|
{
|
||||||
|
return ( !cursor_up || !cursor_down || !cursor_left || !cursor_right );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void s_write( screen_t *s,
|
void s_write( screen_t *s,
|
||||||
wchar_t *prompt,
|
wchar_t *prompt,
|
||||||
|
@ -774,6 +780,23 @@ void s_write( screen_t *s,
|
||||||
CHECK( c, );
|
CHECK( c, );
|
||||||
CHECK( indent, );
|
CHECK( indent, );
|
||||||
|
|
||||||
|
if( is_dumb() )
|
||||||
|
{
|
||||||
|
char *prompt_narrow = wcs2str( prompt );
|
||||||
|
char *buffer_narrow = wcs2str( b );
|
||||||
|
|
||||||
|
write( 1, "\r", 1 );
|
||||||
|
write( 1, prompt_narrow, strlen( prompt_narrow ) );
|
||||||
|
write( 1, buffer_narrow, strlen( buffer_narrow ) );
|
||||||
|
|
||||||
|
free( prompt_narrow );
|
||||||
|
free( buffer_narrow );
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
prompt_width = calc_prompt_width( prompt );
|
prompt_width = calc_prompt_width( prompt );
|
||||||
screen_width = common_get_width();
|
screen_width = common_get_width();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue