diff options
author | Philip Withnall <pwithnall@endlessos.org> | 2022-06-09 13:02:47 +0100 |
---|---|---|
committer | Philip Withnall <pwithnall@endlessos.org> | 2022-06-09 13:04:49 +0100 |
commit | 91ff469f7efb0cc71f4da392e42e941b484c70ce (patch) | |
tree | ef35687be3228e7f067d5961cc56f9e55d018e96 /gobject/gobject-query.c | |
parent | 17a1c29850ccef7a33fade49a6ace3915688f2e9 (diff) | |
download | glib-91ff469f7efb0cc71f4da392e42e941b484c70ce.tar.gz |
gobject-query: Use proper Unicode tree drawing characters
This makes the output a lot nicer to read:
```
│
├void
│
├GInterface
│ │
│ └GTypePlugin
│
├gchar
⋮
```
rather than
```
|
`void
|
`GInterface
|
`GTypePlugin
|
`gchar
⋮
```
It includes a change to correctly use vertical tees at the top level by
correctly setting the sibling node rather than always setting it to
zero.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Diffstat (limited to 'gobject/gobject-query.c')
-rw-r--r-- | gobject/gobject-query.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gobject/gobject-query.c b/gobject/gobject-query.c index 698630fc7..653955e68 100644 --- a/gobject/gobject-query.c +++ b/gobject/gobject-query.c @@ -34,9 +34,9 @@ static gboolean recursion = TRUE; #define O_SPACE " " #define O_ESPACE "" -#define O_BRANCH "+" -#define O_VLINE "|" -#define O_LLEAF "`" +#define O_BRANCH "├" +#define O_VLINE "│" +#define O_LLEAF "└" #define O_KEY_FILL "_" static void @@ -204,9 +204,13 @@ main (gint argc, for (i = 0; i <= G_TYPE_FUNDAMENTAL_MAX; i += G_TYPE_MAKE_FUNDAMENTAL (1)) { const gchar *name = g_type_name (i); + GType sibling = i + G_TYPE_MAKE_FUNDAMENTAL (1); + + if (sibling > G_TYPE_FUNDAMENTAL_MAX || g_type_name (sibling) == NULL) + sibling = 0; if (name) - show_nodes (i, 0, iindent); + show_nodes (i, sibling, iindent); } } |