From 37f5db2bf9b721517b59a2700afa0b7b53a0b133 Mon Sep 17 00:00:00 2001 From: axel Date: Thu, 24 Aug 2006 20:43:54 +1000 Subject: [PATCH] Use terminfo to look up tab width instead of assuming 8 character tabs when calculating prompt width darcs-hash:20060824104354-ac50b-bfb6428411a9c3f6e7a8df980b1005fdd1842a10.gz --- reader.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reader.c b/reader.c index b5e8ff7a6..53af9f071 100644 --- a/reader.c +++ b/reader.c @@ -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,