Example #1
0
File: cmdline.c Project: sklnd/vifm
void
enter_cmdline_mode(CMD_LINE_SUBMODES cl_sub_mode, const wchar_t *cmd, void *ptr)
{
	const wchar_t *prompt;

	sub_mode_ptr = ptr;
	sub_mode = cl_sub_mode;

	if(sub_mode == CMD_SUBMODE || sub_mode == MENU_CMD_SUBMODE)
		prompt = L":";
	else if(sub_mode == SEARCH_FORWARD_SUBMODE
			|| sub_mode == VSEARCH_FORWARD_SUBMODE
			|| sub_mode == MENU_SEARCH_FORWARD_SUBMODE
			|| sub_mode == VIEW_SEARCH_FORWARD_SUBMODE)
		prompt = L"/";
	else if(sub_mode == SEARCH_BACKWARD_SUBMODE
			|| sub_mode == VSEARCH_BACKWARD_SUBMODE
			|| sub_mode == MENU_SEARCH_BACKWARD_SUBMODE
			|| sub_mode == VIEW_SEARCH_BACKWARD_SUBMODE)
		prompt = L"?";
	else
		prompt = L"E";

	prepare_cmdline_mode(prompt, cmd, complete_cmd);
}
Example #2
0
void
enter_cmdline_mode(CMD_LINE_SUBMODES cl_sub_mode, const wchar_t *cmd, void *ptr)
{
	const wchar_t *prompt;

	sub_mode_ptr = ptr;
	sub_mode = cl_sub_mode;
	sub_mode_allows_ee = 0;

	if(sub_mode == CMD_SUBMODE || sub_mode == MENU_CMD_SUBMODE)
	{
		prompt = L":";
	}
	else if(sub_mode == FILTER_SUBMODE)
	{
		prompt = L"=";
	}
	else if(is_forward_search(sub_mode))
	{
		prompt = L"/";
	}
	else if(is_backward_search(sub_mode))
	{
		prompt = L"?";
	}
	else
	{
		assert(0 && "Unknown command line submode.");
		prompt = L"E";
	}

	prepare_cmdline_mode(prompt, cmd, complete_cmd);
}
Example #3
0
File: cmdline.c Project: sklnd/vifm
void
enter_prompt_mode(const wchar_t *prompt, const char *cmd, prompt_cb cb,
		complete_cmd_func complete)
{
	wchar_t *buf;

	sub_mode_ptr = cb;
	sub_mode = PROMPT_SUBMODE;

	buf = to_wide(cmd);
	if(buf == NULL)
		return;

	prepare_cmdline_mode(prompt, buf, complete);
	free(buf);
}
Example #4
0
void
enter_prompt_mode(const wchar_t prompt[], const char cmd[], prompt_cb cb,
		complete_cmd_func complete, int allow_ee)
{
	wchar_t *buf;

	sub_mode_ptr = cb;
	sub_mode = PROMPT_SUBMODE;
	sub_mode_allows_ee = allow_ee;

	buf = to_wide(cmd);
	if(buf == NULL)
		return;

	prepare_cmdline_mode(prompt, buf, complete);
	free(buf);
}