Example #1
0
static void
cmd_quote(key_info_t key_info, keys_info_t *keys_info)
{
	const int pos = check_mark_directory(view, key_info.multi);
	if(pos >= 0)
	{
		goto_pos(pos);
	}
}
Example #2
0
static void
cmd_quote(key_info_t key_info, keys_info_t *keys_info)
{
	int pos;
	pos = check_mark_directory(view, key_info.multi);
	if(pos < 0)
		return;
	goto_pos(pos);
}
Example #3
0
static int
resolve_mark(char mark)
{
	int result;

	result = check_mark_directory(curr_view, mark);
	if(result < 0)
		status_bar_errorf("Trying to use an invalid mark: '%c", mark);
	return result;
}
Example #4
0
void
enter_visual_mode(VisualSubmodes sub_mode)
{
	const int ub = check_mark_directory(curr_view, '<');
	const int lb = check_mark_directory(curr_view, '>');

	if(sub_mode == VS_RESTORE && (ub < 0 || lb < 0))
	{
		return;
	}

	view = curr_view;
	start_pos = view->list_pos;
	vle_mode_set(VISUAL_MODE, VMT_PRIMARY);

	switch(sub_mode)
	{
		case VS_NORMAL:
			amend_type = AT_NONE;
			flist_sel_stash(view);
			backup_selection_flags(view);
			select_first_one();
			break;
		case VS_RESTORE:
			amend_type = AT_NONE;
			flist_sel_stash(view);
			backup_selection_flags(view);
			restore_previous_selection();
			break;
		case VS_AMEND:
			amend_type = AT_APPEND;
			backup_selection_flags(view);
			select_first_one();
			break;
	}

	redraw_view(view);
}
Example #5
0
/* Initiates leaving of command-line mode and reverting related changes in other
 * parts of the interface. */
static void
cmd_ctrl_c(key_info_t key_info, keys_info_t *keys_info)
{
	stop_completion();
	werase(status_bar);
	wnoutrefresh(status_bar);

	if(input_stat.line != NULL)
	{
		char *mbstr = to_multibyte(input_stat.line);
		save_input_to_history(keys_info, mbstr);
		free(mbstr);

		input_stat.line[0] = L'\0';
	}
	if(sub_mode != FILTER_SUBMODE)
	{
		input_line_changed();
	}

	leave_cmdline_mode();

	if(prev_mode == VISUAL_MODE)
	{
		if(!input_stat.search_mode)
		{
			leave_visual_mode(curr_stats.save_msg, 1, 1);
			move_to_list_pos(curr_view, check_mark_directory(curr_view, '<'));
		}
	}
	if(sub_mode == CMD_SUBMODE)
	{
		curr_stats.save_msg = exec_commands("", curr_view, GET_COMMAND);
	}
	else if(sub_mode == FILTER_SUBMODE)
	{
		local_filter_cancel(curr_view);
		curr_view->top_line = input_stat.old_top;
		curr_view->list_pos = input_stat.old_pos;
		redraw_current_view();
	}
}
Example #6
0
void
leave_visual_mode(int save_msg, int goto_top, int clear_selection)
{
	if(goto_top)
	{
		int ub = check_mark_directory(view, '<');
		if(ub != -1)
			view->list_pos = ub;
	}

	if(clear_selection)
	{
		reset_search_results(view);
		restore_selection_flags(view);
		redraw_view(view);
	}

	curr_stats.save_msg = save_msg;
	if(vle_mode_is(VISUAL_MODE))
	{
		vle_mode_set(NORMAL_MODE, VMT_PRIMARY);
	}
}
Example #7
0
File: cmdline.c Project: sklnd/vifm
static void
cmd_ctrl_c(key_info_t key_info, keys_info_t *keys_info)
{
	stop_completion();
	werase(status_bar);
	wnoutrefresh(status_bar);

	if(input_stat.line != NULL)
		input_stat.line[0] = L'\0';
	input_line_changed();

	leave_cmdline_mode();

	if(prev_mode == VISUAL_MODE)
	{
		leave_visual_mode(curr_stats.save_msg, 1, 1);
		move_to_list_pos(curr_view, check_mark_directory(curr_view, '<'));
	}
	if(sub_mode == CMD_SUBMODE)
	{
		int save_hist = !keys_info->mapped;
		curr_stats.save_msg = exec_commands("", curr_view, save_hist, GET_COMMAND);
	}
}