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:
axel 2006-08-24 20:43:54 +10:00
parent 8a97bffd02
commit 37f5db2bf9

View file

@ -810,7 +810,13 @@ static int calc_prompt_width( array_list_t *arr )
}
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
{
@ -894,6 +900,7 @@ static void write_cmdline()
void reader_init()
{
tcgetattr(0,&shell_modes); /* get the current terminal modes */
memcpy( &saved_modes,
&shell_modes,