view console/libgnt/gntkeys.c @ 14876:70623f0d5cdc

[gaim-migrate @ 17645] Use terminfo/termcap information (from ncurses) as much as possible. There still need to be some manual 'refinement' based on $TERM. I'll see if I can get rid of those. Also, I am probably going to allow users to provide information that terminfo can't provide, like the keycode for ctrl+up etc. Let me know if any of the keybinding doesn't work. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 01 Nov 2006 03:38:23 +0000
parents ae4cbed1b309
children c01f62c83647
line wrap: on
line source

#include "gntkeys.h"

#include <string.h>

const char *term;

void gnt_keys_refine(char *text)
{
	if (*text == 27 && *(text + 1) == '[' && *(text + 3) == '\0' &&
			(*(text + 2) >= 'A' || *(text + 2) <= 'D')) {
		if (term == NULL)
			term = getenv("TERM");
		/* Apparently this is necessary for urxvt and screen */
		if (strcmp(term, "screen") == 0 || strcmp(term, "rxvt-unicode") == 0)
			*(text + 1) = 'O';
	}
}