line.c

来自「teco编辑器源码」· C语言 代码 · 共 30 行

C
30
字号
#include <ctype.h>
#include <stdio.h>
#include <string.h>

line()
{
#include "teco.h"

	int iter;				/* Iteration  < > count */
	if (number < 1) while (1) {		/* Position back  */
		if (!bufptx) return;		/*  ...all done   */
		if (toascii(buffer[bufptx--]) == 13) {
			if (! number++) {	/* Start new line *
				++bufptx;
				if (toascii(buffer[bufptx+1]) == 10) {
					++bufptx;
				}
				return;
			}
		}
	}
	if (number > 0) while (1) {		/* Position front */
		if (bufptx+1 >= bufptr) return;
		if (toascii(buffer[++bufptx]) == 13) {
			if (toascii(buffer[bufptx+1]) == 10) ++bufptx;
			if (! --number) return;
		}
	}
}

⌨️ 快捷键说明

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