mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Use terminfo to look up tab width instead of assuming 8 character tabs when calculating prompt width
darcs-hash:20060824104354-ac50b-bfb6428411a9c3f6e7a8df980b1005fdd1842a10.gz
This commit is contained in:
parent
8a97bffd02
commit
37f5db2bf9
1 changed files with 8 additions and 1 deletions
9
reader.c
9
reader.c
|
@ -810,7 +810,13 @@ static int calc_prompt_width( array_list_t *arr )
|
||||||
}
|
}
|
||||||
else if( next[j] == L'\t' )
|
else if( next[j] == L'\t' )
|
||||||
{
|
{
|
||||||
res=(res+8)&~7;
|
/*
|
||||||
|
Assume tab stops every 8 characters if undefined
|
||||||
|
*/
|
||||||
|
if( init_tabs <= 0 )
|
||||||
|
init_tabs = 8;
|
||||||
|
|
||||||
|
res=( (res/init_tabs)+1 )*init_tabs;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -894,6 +900,7 @@ static void write_cmdline()
|
||||||
|
|
||||||
void reader_init()
|
void reader_init()
|
||||||
{
|
{
|
||||||
|
|
||||||
tcgetattr(0,&shell_modes); /* get the current terminal modes */
|
tcgetattr(0,&shell_modes); /* get the current terminal modes */
|
||||||
memcpy( &saved_modes,
|
memcpy( &saved_modes,
|
||||||
&shell_modes,
|
&shell_modes,
|
||||||
|
|
Loading…
Reference in a new issue