type.c

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

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

type()
{
#include "teco.h"

	int tmp;				/* First  scratch */
	int wrk;				/* Second scratch */

	tmp=bufptx;				/* Save context   */
	if (number < 1) while (1) {		/* Position back  */
		if (!tmp) {
			while (++tmp <= bufptx) {
				echo(buffer[tmp]);
			}
			return;			/* All done  type */
		}
		if (toascii(buffer[--tmp]) == 13) {
			if (! number++){/* Start new line */
				if (toascii(buffer[++tmp]) == 10){
					tmp++;
				}
				while(tmp <= bufptx) {
					echo(buffer[tmp++]);
				}
				return;		/* All done  type */
			}
		}
	}
	if (number > 0) while (1) {		/* Type out stuff */
		if (tmp > bufptr) {		/* Type out stuff */
			wrk=bufptx;
			while (++wrk <= bufptr) {
				echo(buffer[wrk]);
			}
			return;			/* All done  type */
		}
		if (toascii(buffer[++tmp]) == 13) {
			if (toascii(buffer[tmp]) == 10) ++tmp;
			if (! --number) {
				wrk=bufptx;
				while (wrk++ < tmp) {
					echo(buffer[wrk]);
				}
				return;		/* All done  type */
			}
		}
	}
}

⌨️ 快捷键说明

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