Beispiel #1
0
void
resize_history(size_t new_len)
{
	const int old_len = MAX(cfg.history_len, 0);
	const int delta = (int)new_len - old_len;

	if(new_len == 0)
	{
		disable_history();
		return;
	}

	if(delta < 0)
	{
		decrease_history(new_len, -delta);
	}

	reallocate_history(new_len);

	if(delta > 0)
	{
		zero_new_history_items(old_len, delta);
	}

	cfg.history_len = new_len;

	if(old_len == 0)
	{
		save_view_history(&lwin, NULL, NULL, -1);
		save_view_history(&rwin, NULL, NULL, -1);
	}
}
Beispiel #2
0
void
cfg_resize_histories(int new_len)
{
	const int old_len = MAX(cfg.history_len, 0);
	const int delta = new_len - old_len;

	if(new_len <= 0)
	{
		disable_history();
		return;
	}

	if(delta < 0)
	{
		decrease_history(new_len, -delta);
	}

	reallocate_history(new_len);

	if(delta > 0)
	{
		zero_new_history_items(old_len, delta);
	}

	cfg.history_len = new_len;

	if(old_len == 0)
	{
		flist_hist_save(&lwin, NULL, NULL, -1);
		flist_hist_save(&rwin, NULL, NULL, -1);
	}
}