Пример #1
0
/* Sets view port parameters to appropriate for current submode state. */
static void
set_view_port(void)
{
	if(prev_mode == MENU_MODE)
	{
		load_menu_pos();
		return;
	}

	if(sub_mode != FILTER_SUBMODE || !is_line_edited())
	{
		curr_view->top_line = input_stat.old_top;
		curr_view->list_pos = input_stat.old_pos;
	}

	if(prev_mode == VISUAL_MODE)
	{
		update_visual_mode();
	}
}
Пример #2
0
static void
input_line_changed(void)
{
	static wchar_t *previous;

	if(!cfg.inc_search || !input_stat.search_mode)
		return;

	if(prev_mode != MENU_MODE)
	{
		curr_view->top_line = input_stat.old_top;
		curr_view->list_pos = input_stat.old_pos;
	}
	else
	{
		load_menu_pos();
	}

	if(input_stat.line == NULL || input_stat.line[0] == L'\0')
	{
		if(cfg.hl_search)
		{
			clean_selected_files(curr_view);
			draw_dir_list(curr_view, curr_view->top_line);
			move_to_list_pos(curr_view, curr_view->list_pos);
		}
		free(previous);
		previous = NULL;
	}
	else if(previous == NULL || wcscmp(previous, input_stat.line) != 0)
	{
		char *p;

		free(previous);
		previous = my_wcsdup(input_stat.line);

		p = to_multibyte(input_stat.line);

		if(sub_mode == SEARCH_FORWARD_SUBMODE)
			exec_command(p, curr_view, GET_FSEARCH_PATTERN);
		else if(sub_mode == SEARCH_BACKWARD_SUBMODE)
			exec_command(p, curr_view, GET_BSEARCH_PATTERN);
		else if(sub_mode == MENU_SEARCH_FORWARD_SUBMODE ||
				sub_mode == MENU_SEARCH_BACKWARD_SUBMODE)
			search_menu_list(p, sub_mode_ptr);
		else if(sub_mode == VSEARCH_FORWARD_SUBMODE)
			exec_command(p, curr_view, GET_VFSEARCH_PATTERN);
		else if(sub_mode == VSEARCH_BACKWARD_SUBMODE)
			exec_command(p, curr_view, GET_VBSEARCH_PATTERN);

		free(p);
	}

	if(prev_mode != MENU_MODE)
	{
		draw_dir_list(curr_view, curr_view->top_line);
		move_to_list_pos(curr_view, curr_view->list_pos);
	}
	else
	{
		menu_redraw();
	}
}