diff options
author | axel <axel@liljencrantz.se> | 2006-08-24 20:43:54 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2006-08-24 20:43:54 +1000 |
commit | 37f5db2bf9b721517b59a2700afa0b7b53a0b133 (patch) | |
tree | 16a7c5eed945124484d0372479779f6f59e12ccc /reader.c | |
parent | 8a97bffd0220cb6c5412e8d2bca63d46997bed0d (diff) |
Use terminfo to look up tab width instead of assuming 8 character tabs when calculating prompt width
darcs-hash:20060824104354-ac50b-bfb6428411a9c3f6e7a8df980b1005fdd1842a10.gz
Diffstat (limited to 'reader.c')
-rw-r--r-- | reader.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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, |