From 01d0c54f05bdfc6a5aede03d86f8df120ca1145d Mon Sep 17 00:00:00 2001 From: David Shaw Date: Wed, 21 Jan 2004 21:25:43 +0000 Subject: [PATCH] * keyedit.c (print_and_check_one_sig, keyedit_menu): Use the COLUMNS environment variable (if any) to hint how wide the terminal is. Disabled on _WIN32. Suggested by Janusz A. Urbanowicz. --- g10/ChangeLog | 7 +++++++ g10/keyedit.c | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 03e3efd61..66566385b 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,10 @@ +2004-01-21 David Shaw + + * keyedit.c (print_and_check_one_sig, keyedit_menu): Use the + COLUMNS environment variable (if any) to hint how wide the + terminal is. Disabled on _WIN32. Suggested by Janusz + A. Urbanowicz. + 2004-01-20 David Shaw * keylist.c (set_attrib_fd): Open attribute fd in binary diff --git a/g10/keyedit.c b/g10/keyedit.c index 5ecec5941..50383b9e3 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -71,6 +71,7 @@ static int enable_disable_key( KBNODE keyblock, int disable ); static void menu_showphoto( KBNODE keyblock ); static int update_trust=0; +static int columns=80; #define CONTROL_D ('D' - 'A' + 1) @@ -164,7 +165,7 @@ print_and_check_one_sig( KBNODE keyblock, KBNODE node, else { size_t n; char *p = get_user_id( sig->keyid, &n ); - tty_print_utf8_string2( p, n, 40 ); + tty_print_utf8_string2( p, n, columns-37 ); m_free(p); } tty_printf("\n"); @@ -1188,6 +1189,15 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands, goto leave; } +#ifndef _WIN32 + if(getenv("COLUMNS")) + { + columns=atoi(getenv("COLUMNS")); + if(columns<80 || columns>255) + columns=80; + } +#endif + if( sign_mode ) { commands = NULL; append_to_strlist( &commands, sign_mode == 1? "sign":