Пример #1
0
/* Performs postponed updates for the view, if any.  Returns non-zero if
 * something was indeed updated, and zero otherwise. */
static int
process_scheduled_updates_of_view(FileView *view)
{
	if(!window_shows_dirlist(view))
	{
		return 0;
	}

	switch(ui_view_query_scheduled_event(view))
	{
		case UUE_NONE:
			/* Nothing to do. */
			return 0;
		case UUE_REDRAW:
			redraw_view_imm(view);
			return 1;
		case UUE_RELOAD:
			load_saving_pos(view, 1);
			if(view == curr_view && !is_status_bar_multiline())
			{
				ui_ruler_update(view);
			}
			return 1;
		case UUE_FULL_RELOAD:
			load_saving_pos(view, 0);
			return 1;

		default:
			assert(0 && "Unexpected type of scheduled UI event.");
			return 0;
	}
}
Пример #2
0
static void
leave_change_mode(int clean_selection)
{
	*mode = NORMAL_MODE;

	if(clean_selection)
	{
		clean_selected_files(view);
		load_saving_pos(view, 1);
		move_to_list_pos(view, view->list_pos);
	}

	update_all_windows();
}
Пример #3
0
/* Performs postponed updates for the view, if any. */
static void
process_scheduled_updates_of_view(FileView *view)
{
	if(window_shows_dirlist(view))
	{
		/* Order of calls matters as reloading resets redraw request. */

		if(ui_view_is_reload_scheduled(view))
		{
			load_saving_pos(view, !ui_view_is_full_reload_scheduled(view));
		}

		if(ui_view_is_redraw_scheduled(view))
		{
			redraw_view_imm(view);
		}
	}
}
Пример #4
0
/* Performs postponed updates for the view, if any.  Returns non-zero if
 * something was indeed updated, and zero otherwise. */
TSTATIC int
process_scheduled_updates_of_view(view_t *view)
{
	if(!window_shows_dirlist(view))
	{
		return 0;
	}

	switch(ui_view_query_scheduled_event(view))
	{
		case UUE_NONE:
			/* Nothing to do. */
			return 0;
		case UUE_REDRAW:
			redraw_view(view);
			return 1;
		case UUE_RELOAD:
			load_saving_pos(view);
			return 1;
	}

	assert(0 && "Unexpected type of scheduled UI event.");
	return 0;
}
Пример #5
0
static void
cmd_ctrl_m(key_info_t key_info, keys_info_t *keys_info)
{
	/* TODO: refactor this cmd_ctrl_m() function. */
	char* p;

	stop_completion();
	werase(status_bar);
	wnoutrefresh(status_bar);

	if((!input_stat.line || !input_stat.line[0]) && sub_mode == MENU_CMD_SUBMODE)
	{
		leave_cmdline_mode();
		return;
	}

	p = input_stat.line ? to_multibyte(input_stat.line) : NULL;

	leave_cmdline_mode();

	if(prev_mode == VISUAL_MODE && sub_mode != VSEARCH_FORWARD_SUBMODE &&
			sub_mode != VSEARCH_BACKWARD_SUBMODE)
		leave_visual_mode(curr_stats.save_msg, 1, 0);

	save_input_to_history(keys_info, p);

	if(sub_mode == CMD_SUBMODE || sub_mode == MENU_CMD_SUBMODE)
	{
		char* s = (p != NULL) ? p : "";
		while(*s == ' ' || *s == ':')
			s++;
		if(sub_mode == CMD_SUBMODE)
			curr_stats.save_msg = exec_commands(s, curr_view, GET_COMMAND);
		else
			curr_stats.save_msg = exec_commands(s, curr_view, GET_MENU_COMMAND);
	}
	else if(sub_mode == PROMPT_SUBMODE)
	{
		finish_prompt_submode(p);
	}
	else if(sub_mode == FILTER_SUBMODE)
	{
		if(cfg.inc_search)
		{
			local_filter_accept(curr_view);
		}
		else
		{
			local_filter_apply(curr_view, p);
			load_saving_pos(curr_view, 1);
		}
	}
	else if(!cfg.inc_search || prev_mode == VIEW_MODE)
	{
		switch(sub_mode)
		{
			case SEARCH_FORWARD_SUBMODE:
				curr_stats.save_msg = exec_command(p, curr_view, GET_FSEARCH_PATTERN);
				break;
			case SEARCH_BACKWARD_SUBMODE:
				curr_stats.save_msg = exec_command(p, curr_view, GET_BSEARCH_PATTERN);
				break;
			case VSEARCH_FORWARD_SUBMODE:
				curr_stats.save_msg = exec_command(p, curr_view, GET_VFSEARCH_PATTERN);
				break;
			case VSEARCH_BACKWARD_SUBMODE:
				curr_stats.save_msg = exec_command(p, curr_view, GET_VBSEARCH_PATTERN);
				break;
			case VIEW_SEARCH_FORWARD_SUBMODE:
				curr_stats.save_msg = exec_command(p, curr_view, GET_VWFSEARCH_PATTERN);
				break;
			case VIEW_SEARCH_BACKWARD_SUBMODE:
				curr_stats.save_msg = exec_command(p, curr_view, GET_VWBSEARCH_PATTERN);
				break;
			case MENU_SEARCH_FORWARD_SUBMODE:
			case MENU_SEARCH_BACKWARD_SUBMODE:
				curr_stats.need_update = UT_FULL;
				search_menu_list(p, sub_mode_ptr);
				break;

			default:
				assert(0 && "Unknown command line submode.");
				break;
		}
	}
	else if(cfg.inc_search && input_stat.search_mode)
	{
		/* In case of successful search and 'hlsearch' option set, a message like
		 * "n files selected" is printed automatically. */
		if(curr_view->matches == 0 || !cfg.hl_search)
		{
			print_search_msg(curr_view, is_backward_search(sub_mode));
			curr_stats.save_msg = 1;
		}
	}

	free(p);
}