[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fall back to one colum "help" printout in non-C locales
From: |
Nguyễn Thái Ngọc Duy |
Subject: |
[PATCH] Fall back to one colum "help" printout in non-C locales |
Date: |
Mon, 10 Sep 2012 11:44:49 +0700 |
---
We could at least support 2-column layout for UTF-8 later. This is
still useful as fallback for non-UTF8 locales.
Comments?
builtins/help.def | 17 +++++++++++++++++
1 tập tin đã bị thay đổi, 17 được thêm vào(+)
diff --git a/builtins/help.def b/builtins/help.def
index 8fb0e2b..3e7239a 100644
--- a/builtins/help.def
+++ b/builtins/help.def
@@ -342,6 +342,23 @@ Use `man -k' or `info' to find out more about commands not
in this list.\n\
A star (*) next to a name means that the command is disabled.\n\
\n"));
+ /*
+ * Cheap trick to detect if we are not on C locale. Avoid 2-column
+ * layout because we may not (yet) reliably calculate the string
+ * width, now that one byte does not necessarily mean one column any
+ * more.
+ */
+ if (strcmp(shell_builtins[0].short_doc, _(shell_builtins[0].short_doc)))
+ {
+ for (i = 0; i < num_shell_builtins; i++)
+ {
+ printf("%c %s\n",
+ shell_builtins[i].flags & BUILTIN_ENABLED ? ' ' : '*',
+ _(shell_builtins[i].short_doc));
+ }
+ return;
+ }
+
t = get_string_value ("COLUMNS");
width = (t && *t) ? atoi (t) : 80;
if (width <= 0)
--
1.7.12.289.g0ce9864
- [PATCH] Fall back to one colum "help" printout in non-C locales,
Nguyễn Thái Ngọc Duy <=