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

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

?? cut.c

?? 這是我寫的一個仿照linux下編輯器vim寫的一個簡單的全屏文本編輯器
?? C
字號:
#include "zped.h"
#include "myExternal.h"


bool deleMidLine(Rnode * target);


bool selectInit()
{
	long int i = 0;
	long int cursor_x;
	long int number = 0;
	Cnode * temp = current_R->rowHead;
	selectLines = 1;
	startLine = current_R;
	endLine = current_R;
	if(current_R == fileBot) {
		number = current_R->num-1;
	} else {
		number = current_R->num-2;
	}
	if(current_x > number)
		current_x = number;
	if(number <= 0)
		current_x = 0;
	startx = current_x;
	startp = startx;
	while(i < startx) {
		temp = temp->next;
		i++;
	}
	startPoint = temp;
	endPoint = temp;
	cursor_x = whereisX();
	wmove(edit,cursor_y,cursor_x);
	wrefresh(edit);
	return 1;
}



bool select_left()
{
	Cnode * temp;
	long int cursor_x;
	move_x = current_x;
	if(startPoint == endPoint) 
		Cflag = 1;
	if(Cflag == 1) {
		if(current_x > 0) {
			current_x--;
			move_x--;
			startp--;
			cursor_x = whereisX();
			startPoint = startPoint->pre;
			startx = current_x;
			wmove(edit,cursor_y,cursor_x);
		} else {
			return 0;
		}
		return 1;
	} else {
		if(current_x > 0) {
			current_x--;
			move_x--;
			cursor_x = whereisX();
			endPoint = endPoint->pre;
			startx = current_x;
			wmove(edit,cursor_y,cursor_x);
		} else {
			return 0;
		}
		return 1;
	}
	return 1;
}



bool select_right()
{
	long int cursor_x;
	long int number = 0;
	move_x = current_x;
	if(startPoint == endPoint)
		Cflag = 2;
	if(current_R == fileBot) {
		number = current_R->num-1;
	} else {
		number = current_R->num-2;
	}
	if(Cflag == 1) {
		if(number > current_x) {
			current_x++;
			move_x++;
			cursor_x = whereisX();
			startPoint = startPoint->next;
			startx = current_x;
			wmove(edit,cursor_y,cursor_x);
		} else {
			return 0;
		}
		return 1;
	} else {
		if(number > current_x) {
			current_x++;
			move_x++;
			cursor_x = whereisX();
			endPoint = endPoint->next;
			startx = current_x;
			wmove(edit,cursor_y,cursor_x);
		} else {
			return 0;
		}
		return 1;
	}
	return 1;
}



bool select_up()
{
	long int cursor_x;
	long int i = 0;
	bool fflag = false;
	Cnode * temp;
	if(startLine == endLine)
		Rflag = 1;
	if(current_R == fileTop) {
		return 0;
	//} else if(current_R->pre->num == 1) {
	//	return 0;
	} else if(current_R == editTop /*&& totalLine >= LINES-2*/) {
		editTop = editTop->pre;
		current_R = current_R->pre;
	} else  {
		current_R = current_R->pre;
		cursor_y--;
	}
	if(current_R->num-2 < startx) {
		current_x = current_R->num-2;
		if(current_x < 0)
			current_x = 0;
	}
	cursor_x = whereisX();
	current_y--;
	wmove(edit,cursor_y,cursor_x);
	if(Rflag == 1) {
		Cflag = 1;
		selectLines++;
		startLine = startLine->pre;
		startPoint = current_R->rowHead;
		while(i < current_x) {
			startPoint = startPoint->next;
			i++;
		}
	} else {
		Cflag = 2;
		selectLines--;
		endLine = endLine->pre;
		if(endLine == startLine) {
			//endPoint = startPoint;
			endPoint = current_R->rowHead;
			fflag = true;
			while(i < current_x) {
			    if(endPoint == startPoint)
				fflag = false;
			    endPoint = endPoint->next;
			    i++; 
			}
			if(fflag) {
			    Cflag = 1;
			    temp = endPoint;
			    endPoint = startPoint;
			    startPoint = temp;
			} 
		} else {
			endPoint = current_R->rowHead;
			while(i < current_x) {
				endPoint = endPoint->next;
				i++;
			}
		}
	}
	return 1;
}



bool select_down()
{
	long int cursor_x;
	long int number;
	long int i = 0;
	bool fflag = false;
	Cnode * temp;
	if(startLine == endLine)
		Rflag = 2;
	if(current_R == fileBot) {
		return 0;
	} else if (current_R->next->num == 1 && current_R->next == fileBot) {
		return 0;
	} else if (/*current_R == editBot && totalLine >= LINES-2*/cursor_y == LINES - 3) {
		//editBot = editBot->next;
		editTop = editTop->next;
		current_R = current_R->next;
	} else {
		current_R = current_R->next;
		cursor_y++;
	}
	if(current_R == fileBot) {
		number = current_R->num-1;
	} else {
		number = current_R->num-2;
	}
	if(number < startx) 
		current_x = number;
	else
		current_x = startx;
	if(number <= 0)
		current_x = 0;
	cursor_x = whereisX();
	current_y++;
	wmove(edit,cursor_y,cursor_x);
	if(Rflag == 1) {
		Cflag = 1;
		selectLines--;
		startLine = startLine->next;
		if(startLine == endLine) {
			//startPoint = endPoint;
			startPoint = startLine->rowHead;
			while(i < current_x) {
				if(startPoint == endPoint)
				    fflag = true;
				startPoint = startPoint->next;
				i++;
			}
			if(fflag) {
			    Cflag = 2;
			    temp = endPoint;
			    endPoint = startPoint;
			    startPoint = temp;
			}
		} else {
			startPoint = startLine->rowHead;
			while(i < current_x) {
				startPoint = startPoint->next;
				i++;
			}
		}
	} else {
		Cflag = 2;
		selectLines++;
		endLine = endLine->next;
		endPoint = endLine->rowHead;
		i = 0;
		while(i < current_x) {
			endPoint = endPoint->next;
			i++;
		}
	}
	return 1;
}




void freeList(Cnode * target)
{
	Cnode * temp;
	Cnode * next;
	if(target == 0)
		return;
	if(target->next == 0) {
		free(target);
	} else {

		temp = target;
		next = target->next;
		while(next != 0) {
			free(temp);
			temp = next;
			next = next->next;
		}
		free(temp);
	}
}



bool deleStartLine()
{
	Cnode * temp;
	long int i = 1;
	bool empty_line = 0;
	if(startLine == endLine) {
		temp = startPoint;
		while(temp != endPoint) {
			temp = temp->next;
			i++;
		}
		/*if the startPoint is at the front of the line*/
		if(startPoint ->pre == 0) {
			/*if the endPoint is at the fileBot or at the fileTop*/
			if(endPoint->next == 0 && startLine == fileBot) {
				startLine->rowHead = 0;
			} else if(endPoint->next == 0 && startPoint->ch == '\n') {//empty line
				if(startLine == fileTop) {
					startLine = startLine->next;
					fileTop = fileTop->next;
					editTop = fileTop;
					deleMidLine(startLine->pre);
				}
				else {
					startLine = startLine->pre;
					deleMidLine(startLine->next);
				}
				empty_line = true;
			} else {	/*if the endPoint is not at the fileBot*/
				startLine->rowHead = endPoint->next;
				endPoint->next->pre = 0;
			}
		} else {		/*if the startPoint is not at the front of the line*/
			if(endPoint->next == 0) {
				startPoint->pre->next = 0;
			} else {
				startPoint->pre->next = endPoint->next;
				endPoint->next->pre = startPoint->pre;
				//mvwaddch(edit,4,4,'0'+i);
				wrefresh(edit);
			}
		}
		if(!empty_line) {
			endPoint->next = 0;
			wrefresh(edit);
			freeList(startPoint);

			startLine->num = startLine->num - i;
		}
	} else {
		temp = startPoint;
		while(temp->next != 0) {
			temp = temp->next;
			i++;
		}
		/*if the startPoint is at the front of the line*/
		if(startPoint->pre == 0) {
			startLine->rowHead = 0;
		} else if(endPoint->next == 0 && startPoint->ch == '\n') {//empty line
			if(startLine == fileTop) {
				startLine->rowHead = 0;
			} else {
				startLine = startLine->pre;
				empty_line = true;
				deleMidLine(startLine->next);
			}

		} else {		/*if the startPoint is not at the front of the line*/
			startPoint->pre->next = 0;
		}
		if(!empty_line) {
			freeList(startPoint);

			startLine->num = startLine->num - i;
		}
	}
	return 1;
}



bool deleMidLine(Rnode * target)
{
	if(target == editTop)
		editTop = startLine;
	freeList(target->rowHead);
	deleRnode(target);
	totalLine--;
	return 1;
}


bool deleEndLine()
{
	long int i = 1;
	Cnode * temp;
	Cnode * target = endLine->rowHead;
	if(endLine->rowHead->ch == '\n')
		return 0;
	if(endLine == fileBot)
		fileBot = startLine;
	/*if the endPoint is at the fileBot*/
	if(endPoint->next == 0) {
		endLine->num = 0;
		endLine->rowHead = 0;
	} else { 		/*if the endPoint is not at the fileBot*/
		temp = endPoint;
		while(temp->pre != 0) {
			i++;
			temp = temp->pre;
		}
		endLine->num = endLine->num - i;
		endLine->rowHead = endPoint->next;
		endPoint->next->pre = 0;
	}
	totalLine--;
	endPoint->next = 0;
	freeList(target);
	return 1;
}







bool deleSelect()
{
	Cnode * tempp;
	Rnode * temp;
	Rnode * next;
	long int i = 0;
	/*if the startLine is equal to the endLine*/
	if(startLine == endLine) {
		deleStartLine();
	} else if(startLine->next == endLine) {		/*if the startLine is just above the endLine*/
		deleStartLine();
		deleEndLine();
		if(endLine->num == 0) {
			deleRnode(endLine);
		} else {
			if(startLine->num == 0) {
				startLine->rowHead = endLine->rowHead;
				endLine->rowHead->pre = 0;
			} else {
				tempp = startLine->rowHead;
				while(tempp->next != 0)
					tempp = tempp->next;
				tempp->next = endLine->rowHead;
				endLine->rowHead->pre = tempp;
			}
			startLine->num += endLine->num;
			deleRnode(endLine);
		}
	} else {								/*if the startLine is at less one line above the endLine*/
		temp = startLine->next;
		while(temp != endLine) {
			next = temp->next;
			deleMidLine(temp);
			temp = next;
		}
		deleStartLine();
		deleEndLine();
		if(endLine->num == 0) {
			deleRnode(endLine);
		} else {
			if(startLine->num == 0) {
				startLine->rowHead = endLine->rowHead;
				endLine->rowHead->pre = 0;
			} else {
				tempp = startLine->rowHead;
				while(tempp->next != 0)
					tempp = tempp->next;
				tempp->next = endLine->rowHead;
				endLine->rowHead->pre = tempp;
			}
			startLine->num += endLine->num;
			deleRnode(endLine);
		}
	}
	temp = editTop;
	i = 0;
	while(temp != startLine) {
		i++;
		temp = temp->next;
	}
	cursor_y = i;
	temp = fileTop;
	i = 0;
	while(temp != startLine) {
		i++;
		temp = temp->next;
	}
	current_y = i;
	current_R = startLine;
	current_x = MINV(startx,startp);
	move_x = current_x;
	dele_one();
	return 1;
}



bool copyDestroy()
{
	Bnode * Btemp;
	Bnode * Bnext;
	Btemp = buffer;
	if(buffer == 0)
		return 0;
	if(buffer->next == 0)
		free(Btemp);
	else {
		Bnext = Btemp->next;
		while(Bnext) {
			free(Btemp);
			Btemp = Bnext;
			Bnext = Bnext->next;
		}
		free(Btemp);
	}
	buffer = 0;
	length = 0;
	return 1;
}


bool copySelect()
{
	Cnode * Ctemp;
	Rnode * Rtemp;
	Bnode * Btemp;
	Bnode * Bnow;
	int i = 0;
	copyDestroy();
	length = 0;

	if(!(buffer = (Bnode *)malloc(sizeof(Bnode))))
		return 0;
	buffer->next = 0;
	Bnow = buffer;
	/*if the start line is just the end line*/
	if(startLine == endLine) {
		Ctemp = startPoint;
		while(Ctemp != endPoint->next) {
			Bnow->buf[i++] = Ctemp->ch;
			length++;
			Ctemp = Ctemp->next;
			if(i == MAXSIZE) {
				if(!(Btemp = (Bnode *)malloc(sizeof(Bnode))))
					return 0;
				Bnow->next = Btemp;
				Bnow = Btemp;
				Bnow->next = 0;
				i = 0;
			}
		}
	} else if(startLine->next == endLine) {	/* if the start is just abovt the end line*/
		/*deal with the start line*/
		Ctemp = startPoint;
		while(Ctemp != 0) {
			Bnow->buf[i++] = Ctemp->ch;
			length++;
			Ctemp = Ctemp->next;
			if(i == MAXSIZE) {
				if(!(Btemp = (Bnode *)malloc(sizeof(Bnode))))
					return 0;
				Bnow->next = Btemp;
				Bnow = Btemp;
				Bnow->next = 0;
				i = 0;
			}
		}
		/*deal with the end line*/
		Ctemp = endLine->rowHead;
		while(Ctemp != endPoint->next) {
			Bnow->buf[i++] = Ctemp->ch;
			length++;
			Ctemp = Ctemp->next;
			if(i == MAXSIZE) {
				if(!(Btemp = (Bnode *)malloc(sizeof(Bnode))))
					return 0;
				Bnow->next = Btemp;
				Bnow = Btemp;
				Bnow->next = 0;
				i = 0;
			}
		}
	} else {
		/*deal with the end line*/
		Ctemp = startPoint;
		while(Ctemp != 0) {
			Bnow->buf[i++] = Ctemp->ch;
			length++;
			Ctemp = Ctemp->next;
			if(i == MAXSIZE) {
				if(!(Btemp = (Bnode *)malloc(sizeof(Bnode))))
					return 0;
				Bnow->next = Btemp;
				Bnow = Btemp;
				Bnow->next = 0;
				i = 0;
			}
		}
		/*deal with the middle line*/
		Rtemp = startLine->next;
		while(Rtemp != endLine) {
			Ctemp = Rtemp->rowHead;
			while(Ctemp != 0) {
				Bnow->buf[i++] = Ctemp->ch;
				length++;
				Ctemp = Ctemp->next;
				if(i == MAXSIZE) {
					if(!(Btemp = (Bnode *)malloc(sizeof(Bnode))))
						return 0;
					Bnow->next = Btemp;
					Bnow = Btemp;
					Bnow->next = 0;
					i = 0;
				}
			}
			Rtemp = Rtemp->next;
		}
		/*deal with the end line*/
		Ctemp = endLine->rowHead;
		while(Ctemp != endPoint->next) {
			Bnow->buf[i++] = Ctemp->ch;
			length++;
			Ctemp = Ctemp->next;
			if(i == MAXSIZE) {
				if(!(Btemp = (Bnode *)malloc(sizeof(Bnode))))
					return 0;
				Bnow->next = Btemp;
				Bnow = Btemp;
				Bnow->next = 0;
				i = 0;
			}
		}
	}
	return 1;

}




bool pasteSelect()
{
	Bnode * Btemp;
	int i = 0;
	long ll = 0;
	Btemp = buffer;
	while(Btemp != 0 && ll < length) {
		while(i < MAXSIZE && ll <length) {
			add_one(Btemp->buf[i++]);
			ll++;
		}
		Btemp = Btemp->next;
		i = 0;
	}
	return 1;
}


bool cutSelect()
{
	copySelect();
	deleSelect();
	return 1;
}








?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产毛片aaaaa无费看| 国产精品综合av一区二区国产馆| 五月天一区二区| 国产精品99久久久久久有的能看| 欧美在线观看禁18| 久久综合九色综合久久久精品综合| 亚洲免费在线看| 国产不卡视频一区二区三区| 在线电影国产精品| 日韩理论片在线| 国内成人精品2018免费看| 欧美日韩视频在线第一区| 国产精品欧美一区二区三区| 韩国视频一区二区| 这里只有精品电影| 亚洲午夜视频在线| 91蜜桃在线免费视频| 中文字幕亚洲在| 国产精品一区二区三区网站| 欧美一级片免费看| 视频一区在线播放| 欧美无乱码久久久免费午夜一区 | 国模套图日韩精品一区二区 | 亚洲欧洲日韩在线| 国产精品一二三在| 久久伊人中文字幕| 精品一区二区三区日韩| 日韩免费成人网| 免费观看日韩电影| 日韩一本二本av| 久久av资源站| 欧美成人在线直播| 久久99精品国产麻豆不卡| 在线综合亚洲欧美在线视频| 舔着乳尖日韩一区| 欧美精品一卡两卡| 奇米精品一区二区三区在线观看一| 欧美精品免费视频| 日本不卡一二三区黄网| 精品久久久久久综合日本欧美| 美日韩一区二区| 久久综合色天天久久综合图片| 激情综合色综合久久| 久久久久免费观看| 99视频精品免费视频| 亚洲嫩草精品久久| 欧美日韩国产影片| 成人免费看的视频| 国产精品国产三级国产aⅴ入口 | 一区二区三区四区中文字幕| 国产91精品露脸国语对白| 日韩免费看的电影| 精品无人码麻豆乱码1区2区| 国产亚洲综合性久久久影院| 欧美一区二区观看视频| 丝袜诱惑制服诱惑色一区在线观看| 国产一区二区三区观看| 青青草国产精品97视觉盛宴| 亚洲蜜臀av乱码久久精品| 国产欧美一二三区| 久久综合狠狠综合久久综合88| 91精品国产综合久久久蜜臀粉嫩| 91高清视频在线| 91亚洲国产成人精品一区二三| 国产精品18久久久久久久久久久久| 人妖欧美一区二区| 亚洲成a人片综合在线| 亚洲最新视频在线观看| 日韩码欧中文字| 亚洲欧洲日产国码二区| 中文字幕欧美日本乱码一线二线| 精品国产精品网麻豆系列 | 五月天网站亚洲| 亚洲一区二区偷拍精品| 洋洋成人永久网站入口| 一区二区免费看| 亚洲一二三四区| 亚洲国产成人porn| 婷婷成人激情在线网| 七七婷婷婷婷精品国产| 日韩国产精品久久久久久亚洲| 午夜精品福利视频网站| 日韩va亚洲va欧美va久久| 日韩国产欧美一区二区三区| 久久精品国产一区二区| 紧缚奴在线一区二区三区| 国产一区在线不卡| 国产精品系列在线观看| 成人av集中营| 欧美亚洲图片小说| 91精品久久久久久蜜臀| 欧美一二区视频| 久久久综合精品| 国产精品剧情在线亚洲| 亚洲精品视频观看| 午夜成人在线视频| 韩国精品免费视频| 成人蜜臀av电影| 91在线观看下载| 欧美人体做爰大胆视频| 精品国产3级a| 亚洲日本一区二区| 视频一区二区三区中文字幕| 精品一区二区三区影院在线午夜| 成人自拍视频在线| 欧美亚洲国产一区二区三区va | 亚洲日本在线看| 偷拍日韩校园综合在线| 寂寞少妇一区二区三区| 成人动漫一区二区| 欧美日本韩国一区| 久久久久久久久岛国免费| 亚洲欧美视频一区| 久久精品国产99国产| eeuss鲁一区二区三区| 欧美美女一区二区在线观看| 26uuu久久综合| 夜夜爽夜夜爽精品视频| 国产一区激情在线| 欧美性色综合网| 久久久无码精品亚洲日韩按摩| 亚洲男人天堂av网| 国产自产视频一区二区三区| 在线观看一区二区视频| 久久久久久久久蜜桃| 亚洲高清免费视频| 大白屁股一区二区视频| 在线综合亚洲欧美在线视频| 中文字幕一区二区不卡 | 久久综合精品国产一区二区三区| 亚洲精品中文在线影院| 国产一区二区三区免费播放| 欧美视频一区二区三区四区| 欧美韩日一区二区三区四区| 日本中文字幕一区二区有限公司| www..com久久爱| 26uuu亚洲婷婷狠狠天堂| 亚洲妇女屁股眼交7| 成人影视亚洲图片在线| 精品久久一区二区| 亚洲va国产va欧美va观看| 不卡av在线网| 三级久久三级久久久| 99久久综合99久久综合网站| 精品国产伦理网| 日本vs亚洲vs韩国一区三区| 在线观看成人免费视频| 国产精品情趣视频| 国产福利精品导航| 日韩一区二区在线免费观看| 亚洲第一二三四区| 日本电影亚洲天堂一区| 亚洲欧洲成人av每日更新| 国产成人免费在线| 久久噜噜亚洲综合| 韩国av一区二区三区四区 | 色呦呦国产精品| 日本一区二区成人| 国产精品原创巨作av| 日韩免费在线观看| 美女视频一区二区三区| 91精品国产综合久久福利| 亚洲.国产.中文慕字在线| 91黄色在线观看| 亚洲综合自拍偷拍| 一本一本大道香蕉久在线精品| 国产精品国产三级国产aⅴ无密码| 国产中文一区二区三区| 久久久不卡影院| 国产成人av电影| 国产精品久久久久久久久免费相片| 国产不卡免费视频| 国产精品久久久久桃色tv| 成人免费看的视频| 最新热久久免费视频| 色成年激情久久综合| 亚洲午夜激情网页| 欧美人妇做爰xxxⅹ性高电影| 天堂va蜜桃一区二区三区漫画版| 欧美精品色综合| 六月婷婷色综合| 国产欧美一区二区精品忘忧草| 成人ar影院免费观看视频| 国产精品国产三级国产有无不卡 | 欧美色精品天天在线观看视频| 亚洲五码中文字幕| 日韩美一区二区三区| 国产一区二区三区| 亚洲欧洲成人精品av97| 欧美日韩美女一区二区| 看电视剧不卡顿的网站| 国产拍欧美日韩视频二区| av中文字幕不卡| 亚洲sss视频在线视频| 精品国产免费一区二区三区香蕉| 国产精品一级片| 亚洲激情第一区| 日韩精品中午字幕| 波多野结衣中文一区| 天天色图综合网|