global.c

来自「这是我写的一个仿照linux下编辑器vim写的一个简单的全屏文本编辑器」· C语言 代码 · 共 79 行

C
79
字号
#include <sys/stat.h>
#include <libintl.h>
#include "zped.h"



/*define some global variable*/
WINDOW * edit;   /*the window used to edit*/

WINDOW * midwin; /*the window under the edit window used to show
		   the file name and some infomation*/

WINDOW * botwin; /*the window under the middle window used to
		   show the error and so on*/

char *filename = 0;	/*name of the file*/

char searchTarget[MAXLENGTH];	/*the thing to be search*/

int editwinrows = 0;	/*the min rows of the edit window*/

int searchCount = 0;	/*the number of the char in the string*/

int change = 0;		/*check if the file has been changed*/

long current_x = 0; 	/*current position of the x in the editor struct*/

long current_y = 0;	/*current position of the y in the editor struct*/

long search_x = 0;	/* to mark the current_x when searching*/

long search_y = 0;	/*to mark the current_y when searching*/

int Scursor_y = 0;	/*to mark the cursor_y when searching*/

int cursor_y = 0;	/*current position of the y int the editor window*/

int selectLines = 0;	/*the number of the lines selected */

int Cflag = 0;		/*a flag of the colum*/

int Rflag = 0;		/*a flag of the row*/

long totalLine = 1;	/*the total number of lines in the text*/

long startx = 0;		/*the start point when the v mode is on*/

long startp = 0;		/*if startp is smaller than startx than startp is the cursor point*/

long length = 0;		/*the length of the buffer*/

long move_x = 0;	/*when the cursor move up or down it will go to the same x and this is used to remember 				the x*/

Rnode * current_R;	/*the row which is being edited*/

Rnode * fileTop;	/*the top row of the file*/

Rnode * fileBot;		/*the bottom row of the file*/

Rnode * editTop;	/*the top row of the edit window*/

//Rnode * editBot;	/*the bottom row of the edit window*/

Rnode * startLine;	/*the first line that was selected*/

Rnode * endLine;	/*the last line that was selected*/

Rnode * searchRow;	/*the row being searched*/

Rnode * searchTop;	/*to mark the file top when searching*/

Cnode * searchCol;	/*the col being searched*/

Cnode * startPoint;	/*the first colum node which was selected*/

Cnode * endPoint;	/*the last colum node which was selected*/

Bnode * buffer;		/*the head of the buffer list*/

⌨️ 快捷键说明

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