亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? undo.c

?? STEVIE文本文件編緝器的C 語言源程序
?? C
字號:
/* $Header: /nw2/tony/src/stevie/src/RCS/undo.c,v 1.7 89/08/06 09:51:06 tony Exp $
 *
 * Undo facility
 *
 * The routines in this file comprise a general undo facility for use
 * throughout the rest of the editor. The routine u_save() is called
 * before each edit operation to save the current contents of the lines
 * to be editted. Later, u_undo() can be called to return those lines
 * to their original state. The routine u_clear() should be called
 * whenever a new file is going to be editted to clear the undo buffer.
 */

#include "stevie.h"

/*
 * The next two variables mark the boundaries of the changed section
 * of the file. Lines BETWEEN the lower and upper bounds are changed
 * and originally contained the lines pointed to by u_lines. To undo
 * the last change, insert the lines in u_lines between the lower and
 * upper bounds.
 */
static	LINE	*u_lbound = NULL; /* line just prior to first changed line */
static	LINE	*u_ubound = NULL; /* line just after the last changed line */

static	LINE	*u_lline  = NULL; /* bounds of the saved lines */
static	LINE	*u_uline  = NULL;

static	int	u_col;
static	bool_t	u_valid = FALSE;  /* is the undo buffer valid */

/*
 * Local forward declarations
 */
static	LINE	*copyline();
static	void	u_lsave();
static	void	u_lfree();

/*
 * u_save(l, u) - save the current contents of part of the file
 *
 * The lines between 'l' and 'u' are about to be changed. This routine
 * saves their current contents into the undo buffer. The range l to u
 * is not inclusive because when we do an open, for example, there aren't
 * any lines in between. If no lines are to be saved, then l->next == u.
 */
void
u_save(l, u)
LINE	*l, *u;
{
	LINE	*nl;			/* copy of the current line */

	/*
	 * If l or u is null, there's an error. We don't return an
	 * indication to the caller. They should find the problem
	 * while trying to perform whatever edit is being requested
	 * (e.g. a join on the last line).
	 */
	if (l == NULL || u == NULL)
		return;

	u_clear();			/* clear the buffer, first */

	u_lsave(l, u);		/* save to the "line undo" buffer, if needed */

	u_lbound = l;
	u_ubound = u;

	if (l->next != u) {		/* there are lines in the middle */
		l = l->next;
		u = u->prev;

		u_lline = nl = copyline(l);	/* copy the first line */
		while (l != u) {
			nl->next = copyline(l->next);
			nl->next->prev = nl;
			l = l->next;
			nl = nl->next;
		}
		u_uline = nl;
	} else
		u_lline = u_uline = NULL;

	u_valid = TRUE;
	u_col = Cursvcol;
}

/*
 * u_saveline() - save the current line in the undo buffer
 */
void
u_saveline()
{
	u_save(Curschar->linep->prev, Curschar->linep->next);
}

/*
 * u_undo() - effect an 'undo' operation
 *
 * The last edit is undone by restoring the modified section of the file
 * to its original state. The lines we're going to trash are copied to
 * the undo buffer so that even an 'undo' can be undone. Rings the bell
 * if the undo buffer is empty.
 */
void
u_undo()
{
	LINE	*tl, *tu;

	if (!u_valid) {
		beep();
		return;
	}

	/*
	 * Get the first line of the thing we're undoing on the screen.
	 */
	Curschar->linep = u_lbound->next;
	Curschar->index = 0;			/* for now */
	if (Curschar->linep == Fileend->linep)
		Curschar->linep = Curschar->linep->prev;
	cursupdate();

	/*
	 * Save pointers to what's in the file now.
	 */
	if (u_lbound->next != u_ubound) {	/* there are lines to get */
		tl = u_lbound->next;
		tu = u_ubound->prev;
		tl->prev = NULL;
		tu->next = NULL;
	} else
		tl = tu = NULL;			/* no lines between bounds */

	/*
	 * Link the undo buffer into the right place in the file.
	 */
	if (u_lline != NULL) {		/* there are lines in the undo buf */

		/*
		 * If the top line of the screen is being undone, we need to
		 * fix up Topchar to point to the new line that will be there.
		 */
		if (u_lbound->next == Topchar->linep)
			Topchar->linep = u_lline;

		u_lbound->next = u_lline;
		u_lline->prev  = u_lbound;
		u_ubound->prev = u_uline;
		u_uline->next  = u_ubound;
	} else {			/* no lines... link the bounds */
		if (u_lbound->next == Topchar->linep)
			Topchar->linep = u_ubound;
		if (u_lbound == Filetop->linep)
			Topchar->linep = u_ubound;
			
		u_lbound->next = u_ubound;
		u_ubound->prev = u_lbound;
	}

	/*
	 * If we swapped the top line, patch up Filemem appropriately.
	 */
	if (u_lbound == Filetop->linep)
		Filemem->linep = Filetop->linep->next;

	/*
	 * Now save the old stuff in the undo buffer.
	 */
	u_lline = tl;
	u_uline = tu;

	renum();		/* have to renumber everything */

	/*
	 * Put the cursor on the first line of the 'undo' region.
	 */
	Curschar->linep = u_lbound->next;
	Curschar->index = 0;
	if (Curschar->linep == Fileend->linep)
		Curschar->linep = Curschar->linep->prev;
	*Curschar = *coladvance(Curschar, u_col);
	cursupdate();
	updatescreen();		/* now show the change */

	u_lfree();		/* clear the "line undo" buffer */
}

/*
 * u_clear() - clear the undo buffer
 *
 * This routine is called to clear the undo buffer at times when the
 * pointers are about to become invalid, such as when a new file is
 * about to be editted.
 */
void
u_clear()
{
	LINE	*l, *nextl;

	if (!u_valid)		/* nothing to do */
		return;

	for (l = u_lline; l != NULL ;l = nextl) {
		nextl = l->next;
		free(l->s);
		free((char *)l);
	}

	u_lbound = u_ubound = u_lline = u_uline = NULL;
	u_valid = FALSE;
}

/*
 * The following functions and data implement the "line undo" feature
 * performed by the 'U' command.
 */

static	LINE	*u_line;		/* pointer to the line we last saved */
static	LINE	*u_lcopy = NULL;	/* local copy of the original line */

/*
 * u_lfree() - free the line save buffer
 */
static	void
u_lfree()
{
	if (u_lcopy != NULL) {
		free(u_lcopy->s);
		free((char *)u_lcopy);
		u_lcopy = NULL;
	}
	u_line = NULL;
}

/*
 * u_lsave() - save the current line if necessary
 */
static	void
u_lsave(l, u)
LINE	*l, *u;
{

	if (l->next != u->prev) {	/* not changing exactly one line */
		u_lfree();
		return;
	}

	if (l->next == u_line)		/* more edits on the same line */
		return;

	u_lfree();
	u_line = l->next;
	u_lcopy = copyline(l->next);
}

/*
 * u_lundo() - undo the current line (the 'U' command)
 */
void
u_lundo()
{
	if (u_lcopy != NULL) {
		free(Curschar->linep->s);
		Curschar->linep->s = u_lcopy->s;
		Curschar->linep->size = u_lcopy->size;
		free((char *)u_lcopy);
	} else
		beep();
	Curschar->index = 0;

	cursupdate();
	updatescreen();		/* now show the change */

	u_lcopy = NULL;	/* can't undo this kind of undo */
	u_line = NULL;
}

/*
 * u_lcheck() - clear the "line undo" buffer if we've moved to a new line
 */
void
u_lcheck()
{
	if (Curschar->linep != u_line)
		u_lfree();
}

/*
 * copyline(l) - copy the given line, and return a pointer to the copy
 */
static LINE *
copyline(l)
LINE	*l;
{
	LINE	*nl;		/* the new line */

	nl = newline(strlen(l->s));
	strcpy(nl->s, l->s);

	return nl;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av电影免费在线播放| 国产在线播精品第三| 91精品国产91热久久久做人人| 极品少妇一区二区三区精品视频| 国产精品剧情在线亚洲| 欧美一区欧美二区| 色综合天天综合网国产成人综合天| 日本不卡的三区四区五区| 日韩一区中文字幕| 久久久影视传媒| 欧美人xxxx| 91国产成人在线| 国产精品一区二区在线观看不卡 | 国产999精品久久久久久| 天天影视网天天综合色在线播放| 国产精品护士白丝一区av| 欧美成人精品高清在线播放| 色偷偷久久人人79超碰人人澡| 美女网站在线免费欧美精品| 亚洲午夜av在线| 国产偷国产偷精品高清尤物| 欧美另类久久久品| 91蜜桃免费观看视频| 日本欧美肥老太交大片| 亚洲欧美区自拍先锋| 亚洲精品在线观看视频| 欧美性色综合网| 成人福利电影精品一区二区在线观看| 视频一区二区国产| 日韩毛片视频在线看| 国产视频一区在线播放| 欧美一二区视频| 日韩精品中文字幕一区二区三区 | 日韩美女视频一区| 欧美日韩国产一二三| 在线一区二区三区四区五区 | 97精品超碰一区二区三区| 精品一区二区三区免费| 午夜视频一区二区| 亚洲精品久久7777| 中文字幕一区二区三区不卡在线| 久久亚洲二区三区| 日韩精品中文字幕一区二区三区| 欧美亚洲国产怡红院影院| 成人h动漫精品| 国产精品99精品久久免费| 麻豆国产欧美一区二区三区| 日韩高清一区在线| 午夜a成v人精品| 亚洲电影一区二区| 亚洲中国最大av网站| 亚洲另类中文字| 亚洲精品日韩综合观看成人91| 国产精品久久久久三级| 欧美成人官网二区| 欧美亚洲国产一区在线观看网站| 欧美三级视频在线观看| 在线看国产一区二区| 91香蕉视频黄| 色诱亚洲精品久久久久久| 91色视频在线| 色老汉av一区二区三区| 91日韩一区二区三区| 色综合久久久久网| 欧美网站一区二区| 色婷婷精品大在线视频| 色乱码一区二区三区88| 在线一区二区三区四区| 欧美日韩一区 二区 三区 久久精品 | 一二三区精品福利视频| 国产精品麻豆一区二区| 国产婷婷色一区二区三区四区| 国产午夜精品福利| 成人欧美一区二区三区视频网页| 亚洲成人免费在线| 日日摸夜夜添夜夜添国产精品| 日韩不卡一区二区三区| 国产一区二区三区不卡在线观看 | 成人免费视频caoporn| 成人国产精品免费| 91久久线看在观草草青青| 精品污污网站免费看| 日韩午夜电影在线观看| 欧美精品一区二区高清在线观看| 久久久噜噜噜久久中文字幕色伊伊| 国产三级一区二区三区| 日本一区二区在线不卡| 一区二区三区视频在线看| 午夜视频在线观看一区二区 | 蓝色福利精品导航| 麻豆精品一区二区av白丝在线| 国产成人av一区二区| 日本丶国产丶欧美色综合| 日韩欧美色电影| 国产精品国模大尺度视频| 亚洲香肠在线观看| 国产乱理伦片在线观看夜一区| av在线不卡网| 欧美一卡在线观看| 一区二区中文视频| 久久99蜜桃精品| 在线视频你懂得一区二区三区| 欧美一级午夜免费电影| 国产精品乱人伦中文| 日本亚洲视频在线| 91小宝寻花一区二区三区| 日韩久久久精品| 一区二区三区四区在线免费观看 | 国产在线精品一区在线观看麻豆| 99久久夜色精品国产网站| 欧美丰满嫩嫩电影| 国产欧美一区在线| 青娱乐精品视频在线| av在线不卡免费看| 欧美成人国产一区二区| 一区二区免费视频| 国产91精品在线观看| 欧美美女激情18p| 亚洲欧洲精品天堂一级| 看电视剧不卡顿的网站| 欧美大尺度电影在线| 亚洲免费av网站| 国产精品一区二区不卡| 欧美一级片在线看| 一区二区日韩av| www.99精品| 久久久99精品免费观看不卡| 天堂资源在线中文精品| www.欧美精品一二区| 中文字幕国产精品一区二区| 久久电影网站中文字幕| 欧美高清视频不卡网| 亚洲精品视频免费看| 92精品国产成人观看免费 | 国产精品麻豆一区二区| 国产一区二区三区精品视频| 欧美精品18+| 亚洲在线成人精品| 丁香啪啪综合成人亚洲小说 | 亚洲国产日产av| 91丨porny丨中文| 中文在线资源观看网站视频免费不卡| 久久国产麻豆精品| 日韩视频在线你懂得| 免费在线看成人av| 欧美精品欧美精品系列| 亚洲成人精品在线观看| 欧美亚男人的天堂| 亚洲亚洲精品在线观看| 91麻豆国产福利在线观看| 中文字幕一区二区不卡| 成人免费看的视频| 国产精品高清亚洲| 99久久精品一区| 亚洲精品欧美专区| 在线观看三级视频欧美| 亚洲精品国产精品乱码不99| 91高清视频在线| 亚洲国产成人精品视频| 精品视频一区 二区 三区| 亚洲不卡一区二区三区| 欧美色综合网站| 日日夜夜精品视频天天综合网| 欧美丝袜丝交足nylons图片| 亚洲图片欧美一区| 欧美高清性hdvideosex| 久久99蜜桃精品| 中文字幕+乱码+中文字幕一区| av在线不卡观看免费观看| 亚洲女同一区二区| 欧美日韩美少妇| 蜜桃av一区二区| 久久伊人中文字幕| 成a人片国产精品| 久久精品免费观看| 久久精品一区四区| 91麻豆精品视频| 丝袜诱惑亚洲看片| 精品国产精品网麻豆系列| 岛国一区二区三区| 亚洲一二三四在线| 欧美成人精品福利| 成人丝袜视频网| 亚洲国产另类精品专区| 日韩一级精品视频在线观看| 国产高清不卡一区| 亚洲激情欧美激情| 日韩色在线观看| 不卡av在线免费观看| 亚洲国产精品欧美一二99| 日韩精品一区二区三区在线观看| 粉嫩aⅴ一区二区三区四区五区| 亚洲视频在线一区| 欧美大肚乱孕交hd孕妇| 国产一区二区三区四区五区美女 | 婷婷开心激情综合| 久久午夜羞羞影院免费观看| 91丨porny丨国产入口| 久久激情五月婷婷| 中文字幕亚洲综合久久菠萝蜜|