예제 #1
0
/// Add specified key binding.
bool builtin_bind_t::add(const wchar_t *seq, const wchar_t *const *cmds, size_t cmds_len,
                         const wchar_t *mode, const wchar_t *sets_mode, bool terminfo, bool user,
                         io_streams_t &streams) {
    if (terminfo) {
        wcstring seq2;
        if (get_terminfo_sequence(seq, &seq2, streams)) {
            input_mapping_add(seq2.c_str(), cmds, cmds_len, mode, sets_mode, user);
        } else {
            return true;
        }

    } else {
        input_mapping_add(seq, cmds, cmds_len, mode, sets_mode, user);
    }

    return false;
}
예제 #2
0
파일: input.c 프로젝트: cardmagic/lucash
int input_init()
{
	if( is_init )
		return 1;
	
	is_init = 1;

	input_common_init( &interrupt_handler );

	if( setupterm( 0, STDOUT_FILENO, 0) == ERR )
	{
		debug( 0, _( L"Could not set up terminal" ) );
		exit(1);
	}
	output_set_term( env_get( L"TERM" ) );
	
	input_terminfo_init();

	/*
	  If we have no keybindings, add a few simple defaults
	*/
	if( !al_get_count( &mappings ) )
	{
		input_mapping_add( L"", L"self-insert" );
		input_mapping_add( L"\n", L"execute" );
		input_mapping_add( L"\t", L"complete" );
		input_mapping_add( L"\x3", L"commandline \"\"" );
		input_mapping_add( L"\x4", L"exit" );
		input_mapping_add( L"\x5", L"bind" );
	}

	return 1;
}