⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mark.c

📁 aee是一种易使用的文本编辑器。你可以不用说明书来使用它。它提供终端接口和本地的X-windows接口。它的特性包括即弹的菜单
💻 C
📖 第 1 页 / 共 2 页
字号:
	}	if (pst_pos != 1)		slct_dlt();	else if (curr_buff->position < curr_buff->curr_line->line_length)	{		if ((cpste_line->max_length - cpste_line->line_length) < 5)			pst_pnt = resiz_line(10, cpste_line, pst_pos);		pste1 = pst_pnt;		tpst_pos = pst_pos;		while (tpst_pos < cpste_line->line_length)		{			tpst_pos++;			pste1++;		}		pste1++;		cpste_line->line_length++;		while (pst_pnt < pste1)		{			pste2= pste1 - 1;			*pste1= *pste2;			pste1--;		}		*pst_pnt = *curr_buff->pointer;	}}void fast_right()	/* move right one character and select (mark) but do not display	*/{	if (curr_buff->position < curr_buff->curr_line->line_length)	{		if ((pst_pos == cpste_line->line_length) && (*pst_pnt == (char) NULL) && (curr_buff->position < curr_buff->curr_line->line_length))		{			if ((cpste_line->max_length - cpste_line->line_length) < 5)				pst_pnt = resiz_line(10, cpste_line, pst_pos);			*pst_pnt = *curr_buff->pointer;			pst_pnt++;			pst_pos++;			cpste_line->line_length++;			*pst_pnt = (char) NULL;		}		else if (curr_buff->position < curr_buff->curr_line->line_length)			slct_dlt();		curr_buff->scr_pos += len_char(*curr_buff->pointer, curr_buff->scr_pos);		curr_buff->pointer++;		curr_buff->position++;	}	else if (curr_buff->curr_line->next_line != NULL)	{		if (curr_buff->curr_line->changed && curr_buff->journalling)			write_journal(curr_buff, curr_buff->curr_line);		curr_buff->curr_line = curr_buff->curr_line->next_line;		curr_buff->pointer = curr_buff->curr_line->line;		curr_buff->position = 1;			curr_buff->scr_pos = 0;	}}void fast_line(direct)	/* move to the previous or next line while selecting text but do not display */char *direct;	/* direction of movement	*/{	if (*direct == 'u')	{		curr_buff->absolute_lin--;		while (curr_buff->position > 1)			fast_left();		fast_left();		if (cpste_line->prev_line == NULL)		{			pste_tmp = txtalloc();			pste_tmp->prev_line = NULL;			pste_tmp->next_line = cpste_line;			cpste_line->prev_line = pste_tmp;			pste_tmp->line = pst_pnt= pst_line = xalloc(curr_buff->curr_line->max_length);			fpste_line = cpste_line = pste_tmp;			pste_tmp->line_length = 1;			pste_tmp->max_length = curr_buff->curr_line->max_length;			*pst_pnt = (char) NULL;			pst_pos = 1;		}		else		{			free(cpste_line->line);			cpste_line = cpste_line->prev_line;			free(cpste_line->next_line);			cpste_line->next_line = NULL;			pst_pnt = pst_line = cpste_line->line;			pst_pos = 1;			while (pst_pos < cpste_line->line_length)			{				pst_pos++;				pst_pnt++;			}		}	}	else	{		curr_buff->absolute_lin++;		while (curr_buff->position < curr_buff->curr_line->line_length)			fast_right();		fast_right();		if (cpste_line->next_line == NULL)		{			pste_tmp = txtalloc();			pst_pnt = pst_line = pste_tmp->line = xalloc(curr_buff->curr_line->max_length);			*pst_pnt = (char) NULL;			pst_pos = 1;			pste_tmp->line_length = 1;			pste_tmp->max_length = curr_buff->curr_line->max_length;			cpste_line->next_line = pste_tmp;			pste_tmp->next_line = NULL;			pste_tmp->prev_line = cpste_line;			cpste_line = pste_tmp;		}		else		{			free(pst_line);			fpste_line = cpste_line = cpste_line->next_line;			pst_pnt = pst_line = cpste_line->line;			pst_pos = 1;			free(cpste_line->prev_line);			cpste_line->prev_line = NULL;		}	}}int slct(flag)	/* initiate process for selecting (marking) text	*/int flag;{	if (!mark_text)	{		mark_text = flag;		cpste_line = fpste_line = txtalloc();		cpste_line->line = pst_line = pst_pnt = xalloc(10);		pst_pos = cpste_line->line_length = 1;		*pst_pnt = (char) NULL;		cpste_line->max_length = 10;		cpste_line->prev_line = NULL;		cpste_line->next_line = NULL;		cpste_line->line_number	 = 1;	}	else	{		wmove(com_win,0,0);		wclrtoeol(com_win);		wprintw(com_win, mark_alrdy_actv_str);		wrefresh(com_win);		wmove(curr_buff->win, curr_buff->scr_vert, curr_buff->scr_horz);		clr_cmd_line = TRUE;	}	return(0);}	void slct_dlt()	/* delete character in buffer	*/{	if ((pst_pos == cpste_line->line_length) && (pst_pos != 1))	{		pst_pos--;		cpste_line->line_length--;		pst_pnt--;		*pst_pnt = (char) NULL;	}	else if (pst_pos != cpste_line->line_length)	{		pste1 = pste2 = pst_pnt;		value = pst_pos;		pste1++;		while (value < cpste_line->line_length)		{			*pste2 = *pste1;			pste1++;			pste2++;			value++;		}		*pste2 = *pste1;		cpste_line->line_length--;	}}void slct_right()	/* select text while moving right and display	*/{	int tmpi;	if ((pst_pos == cpste_line->line_length) && 		(curr_buff->position != curr_buff->curr_line->line_length))	{		if ((cpste_line->max_length - cpste_line->line_length) < 5)			pst_pnt = resiz_line(10, cpste_line, pst_pos);		*pst_pnt = *curr_buff->pointer;		pst_pnt++;		*pst_pnt = (char) NULL;		pst_pos++;		cpste_line->line_length++;		wmove(curr_buff->win, curr_buff->scr_vert, curr_buff->scr_horz);		wstandout(curr_buff->win);		if ((*curr_buff->pointer < 32) || (*curr_buff->pointer > 126))			tmpi = out_char(curr_buff->win, *curr_buff->pointer, curr_buff->scr_pos, curr_buff->scr_vert, 0);		else			waddch(curr_buff->win, *curr_buff->pointer);		wstandend(curr_buff->win);	}	else if (curr_buff->position < curr_buff->curr_line->line_length)	{		slct_dlt();		pste1 = curr_buff->pointer;		wmove(curr_buff->win, curr_buff->scr_vert, curr_buff->scr_horz);		if ((*pste1 < 32) || (*pste1 > 126))			tmpi = out_char(curr_buff->win, *pste1, curr_buff->scr_pos, curr_buff->scr_vert, 0);		else			waddch(curr_buff->win, *pste1);	}/*	wmove(curr_buff->win, curr_buff->scr_vert, curr_buff->scr_horz);*/}void slct_left()	/* select text while moving left and display	*/{	int tmpi;	if (pst_pos != 1)	{		slct_dlt();		pste1 = curr_buff->pointer;		wmove(curr_buff->win, curr_buff->scr_vert, curr_buff->scr_horz);		if ((*pste1 < 32) || (*pste1 > 126))			tmpi = out_char(curr_buff->win, *pste1, curr_buff->scr_pos, curr_buff->scr_vert, 0);		else			waddch(curr_buff->win, *pste1);	}	else if (curr_buff->position < curr_buff->curr_line->line_length)	{		if ((cpste_line->max_length - cpste_line->line_length) < 5)			pst_pnt = resiz_line(10, cpste_line, pst_pos);		pste1 = pst_pnt;		tmpi = pst_pos;		while (tmpi < cpste_line->line_length)		{			tmpi++;			pste1++;		}		pste1++;		while (pst_pnt < pste1)		{			pste2= pste1 - 1;			*pste1= *pste2;			pste1--;		}		*pst_pnt = *curr_buff->pointer;		cpste_line->line_length++;		wstandout(curr_buff->win);		if ((*curr_buff->pointer < 32) || (*curr_buff->pointer > 126))			tmpi += out_char(curr_buff->win, *curr_buff->pointer, curr_buff->scr_pos, curr_buff->scr_vert, 0);		else			waddch(curr_buff->win, *pste1);		wstandend(curr_buff->win);	}	wmove(curr_buff->win, curr_buff->scr_vert, curr_buff->scr_horz);}void slct_line(direct)	/* move to the previous or next line	*/char *direct;	/* direction	*/{	if (*direct == 'u')	{		if (cpste_line->prev_line == NULL)		{			pste_tmp = txtalloc();			pste_tmp->prev_line = NULL;			pste_tmp->next_line = cpste_line;			cpste_line->prev_line = pste_tmp;			pste_tmp->line = pst_pnt= pst_line = xalloc(curr_buff->curr_line->max_length);			pste_tmp->line_length = 1;			pste_tmp->max_length = curr_buff->curr_line->max_length;			fpste_line = cpste_line = pste_tmp;			*pst_pnt = (char) NULL;			pst_pos = 1;			slct_left();		}		else		{			free(cpste_line->line);			cpste_line = cpste_line->prev_line;			free(cpste_line->next_line);			cpste_line->next_line = NULL;			pst_pnt = pst_line = cpste_line->line;			pst_pos = 1;			while (pst_pos < cpste_line->line_length)			{				pst_pos++;				pst_pnt ++;			}		}	}	else	{		if (cpste_line->next_line == NULL)		{			pste_tmp = txtalloc();			pst_pnt = pst_line = pste_tmp->line = xalloc(curr_buff->curr_line->max_length);			*pst_pnt = (char) NULL;			pst_pos = 1;			pste_tmp->line_length = 1;			pste_tmp->max_length = curr_buff->curr_line->max_length;			cpste_line->next_line = pste_tmp;			pste_tmp->next_line = NULL;			pste_tmp->prev_line = cpste_line;			cpste_line = pste_tmp;		}		else		{			free(pst_line);			fpste_line = cpste_line = cpste_line->next_line;			pst_pnt = pst_line = cpste_line->line;			pst_pos = 1;			free(cpste_line->prev_line);			cpste_line->prev_line = NULL;			wmove(curr_buff->win, curr_buff->scr_vert,curr_buff->scr_horz);		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -