From 963c238ff8d3f734bd852669d379e951f4fc7649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 31 Jan 2017 09:10:07 +0100 Subject: vis: add workaround for broken color handling in Terminal.app Terminal.app sets $TERM=xterm-256color and ships a corresponding terminfo description advocating that it is capable of color changes to the 256 color palette when in fact it can not. We introduce a new boolean option "change-256colors" which is true by default but can be used to disable color changes. It is automatically set if Terminal.app is detected using $TERM_PROGRAM. This should fix display artifacts as described in #456. --- sam.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sam.c') diff --git a/sam.c b/sam.c index 95b2690..b232726 100644 --- a/sam.c +++ b/sam.c @@ -302,6 +302,7 @@ enum { OPTION_COLOR_COLUMN, OPTION_HORIZON, OPTION_SAVE_METHOD, + OPTION_CHANGE_256COLORS, }; static const OptionDef options[] = { @@ -385,6 +386,12 @@ static const OptionDef options[] = { OPTION_TYPE_STRING, OPTION_FLAG_WINDOW, "Save method to use for current file 'auto', 'atomic' or 'inplace'", }, + [OPTION_CHANGE_256COLORS] = { + { "change-256colors" }, + OPTION_TYPE_BOOL, OPTION_FLAG_NONE, + "Change 256 color palette to support 24bit colors", + }, + }; bool sam_init(Vis *vis) { -- cgit v1.2.3