[PATCH V2 6/6] scripts/kconfig/nconf: trunc too long string display in menu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When the string is too long, only show the first COLS/2 bytes wide,
to make sure there is some space to show the menu prompt.

Signed-off-by: Cheng Renquan <crquan@xxxxxxxxx>
---
 scripts/kconfig/nconf.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 4248759..4997ebf 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -887,8 +887,14 @@ static void build_conf(struct menu *menu)
 				break;
 			default:
 				tmp = 2 + strlen(sym_get_string_value(sym));
-				item_make(menu, 's', "    (%s)",
+				if (tmp < COLS/2)
+					item_make(menu, 's', "    (%s)",
 						sym_get_string_value(sym));
+				else {
+					char *s = strndupa(sym_get_string_value(sym), COLS/2);
+					strcpy(s + COLS/2 - 5, " ...");
+					item_make(menu, 's', "    (%s)", s);
+				}
 				tmp = indent - tmp + 4;
 				if (tmp < 0)
 					tmp = 0;
-- 
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux