regedit: Use color only when available.
authorAndreas Schneider <asn@samba.org>
Fri, 26 Oct 2012 17:52:08 +0000 (19:52 +0200)
committerMichael Adam <obnox@samba.org>
Mon, 29 Apr 2013 13:02:19 +0000 (15:02 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Mon Apr 29 15:02:19 CEST 2013 on sn-devel-104

source3/utils/regedit.c

index 824bc3f86f347df78054c5d137a2f1ff34a82f3f..bd9765e5db830fc3401de4ece91925e39f5368fe 100644 (file)
@@ -438,13 +438,20 @@ static void display_window(TALLOC_CTX *mem_ctx, struct registry_context *ctx)
 {
        struct regedit *regedit;
        struct tree_node *root;
+       bool colors;
        int key;
 
        initscr();
-       start_color();
+
        cbreak();
        noecho();
 
+       colors = has_colors();
+       if (colors) {
+               start_color();
+               use_default_colors();
+       }
+
        regedit = talloc_zero(mem_ctx, struct regedit);
        SMB_ASSERT(regedit != NULL);
        regedit_main = regedit;