commit - 2a7d3cd7fd18be5657ca71a452a73ba70a8530e5
commit + 30e77f6ad14985d6db8d179b7ed73dc4c8cab68a
blob - d338b7cb55c642cdd9c04cf53565845ae158d065
blob + a2ad8c27009958805e6bb47498c2f321dd725a1a
--- tog/tog.c
+++ tog/tog.c
* Write keymap section headers, keys, and key info in km to f.
* Save line offset to *off. If terminal has UTF8 encoding enabled,
* wrap control and symbolic keys in guillemets, else use <>.
- * For example (top=UTF8, bottom=ASCII):
- * Global
- * k ❬C-p❭ ❬Up❭ Move cursor or page up one line
- * Global
- * k <C-p> <Up> Move cursor or page up one line
*/
static const struct got_error *
format_help_line(off_t *off, FILE *f, const struct tog_key_map *km, int width)
int n, len = width;
if (km->keys) {
+ static const char *u8_glyph[] = {
+ "\xe2\x80\xb9", /* U+2039 (utf8 <) */
+ "\xe2\x80\xba" /* U+203A (utf8 >) */
+ };
char *t0, *t, *k;
int cs, s, first = 1;
while ((k = strsep(&t, " ")) != NULL) {
s = strlen(k) > 1; /* control or symbolic key */
n = fprintf(f, "%s%s%s%s%s", first ? " " : "",
- cs && s ? "❬" : s ? "<" : "", k,
- cs && s ? "❭" : s ? ">" : "", t ? " " : "");
+ cs && s ? u8_glyph[0] : s ? "<" : "", k,
+ cs && s ? u8_glyph[1] : s ? ">" : "", t ? " " : "");
if (n < 0) {
free(t0);
return got_error_from_errno("fprintf");