~kaction/dvtm

d55678de99e09ff50f6839122544a262743415af — Dmitry Bogatov 2 years ago c1bb5d6
Ensure compatibility with v0.15 config

Introduce configuration variable to enable/disable printkeys feature and
preprocessor macro that ensures that if isn't defined, it defaults to
"disabled" state.
2 files changed, 20 insertions(+), 1 deletions(-)

M config.def.h
M dvtm.c
M config.def.h => config.def.h +8 -0
@@ 207,3 207,11 @@ static Action actions[] = {
static char const * const keytable[] = {
	/* add your custom key escape sequences */
};

/* Print dvtm's control sequence as it is typed in status bar, similar
 * to :showcmd in vim.
 *
 * Change 0 to 1 to enable.
 */
#define FEATURE_PRINT_KEYS
static const int config_print_keys = 0;

M dvtm.c => dvtm.c +12 -1
@@ 46,6 46,17 @@ int ESCDELAY;
# define set_escdelay(d) (ESCDELAY = (d))
#endif

/*
 * This feature was introduced in 0.15.1, and this code makes sure that
 * it config file from 0.15 will continue compile as work as before.
 */

#ifndef FEATURE_PRINT_KEYS
static const int compat_print_keys = 0;
#else
static const int compat_print_keys = config_print_keys;
#endif

typedef struct {
	float mfact;
	unsigned int nmaster;


@@ 355,7 366,7 @@ drawbar(void) {
	addstr(layout->symbol);
	attrset(TAG_NORMAL);

	if (keys) {
	if (compat_print_keys && keys) {
		unsigned int keycount = 0;
		while (keycount < MAX_KEYS && keys[keycount]) {
			if (keys[keycount] < ' ')