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

📄 input.c

📁 minix软件源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
			switch (*key)			{#ifndef NO_EXTENSIONS			  case ctrl('O'): /* special movement mapped keys */				*key = getkey(0);				switch (*key)				{				  case 'h':	m = m_left(cursor, 0L);		break;				  case 'j':				  case 'k':	m = m_updnto(cursor, 0L, *key);	break;				  case 'l':	m = cursor + 1;			break;				  case 'B':				  case 'b':	m = m_bword(cursor, 0L, *key);	break;				  case 'W':				  case 'w':	m = m_fword(cursor, 0L, *key, '\0');	break;				  case '^':	m = m_front(cursor, 0L);	break;				  case '$':	m = m_rear(cursor, 0L);		break;				  case ctrl('B'):				  case ctrl('F'):						m = m_scroll(cursor, 0L, *key); break;				  case 'x':#ifndef NO_VISIBLE						if (V_from)							beep();						else#endif						ChangeText						{							m = v_xchar(cursor, 0L, 'x');						}						break;				  case 'i':	m = to = from = cursor;						when = WHEN_VIINP + WHEN_VIREP - when;										break;				  case 'K':					pfetch(markline(cursor));					changes++; /* <- after this, we can alter ptext */					ptext[markidx(cursor)] = 0;					for (scan = ptext + markidx(cursor) - 1;					     scan >= ptext && isalnum(*scan);					     scan--)					{					}					scan++;					m = (*scan ? v_keyword(scan, cursor, 0L) : cursor);					break;# ifndef NO_VISIBLE				  case 'v':				  case 'V':					if (V_from)						V_from = MARK_UNSET;					else						V_from = cursor;					m = from = to = cursor;					V_linemd = (*key == 'V');					break;				  case 'd':				  case 'y':				  case '\\':					/* do nothing if unmarked */					if (!V_from)					{						msg("You must mark the text first");						beep();						break;					}					/* "from" must come before "to" */					if (V_from < cursor)					{						from = V_from;						to = cursor;					}					else					{						from = cursor;						to = V_from;					}					/* we don't need V_from anymore */					V_from = MARK_UNSET;					if (V_linemd)					{						/* adjust for line mode */						from &= ~(BLKSIZE - 1);						to |= (BLKSIZE - 1);					}					else					{						/* in character mode, we must						 * worry about deleting the newline						 * at the end of the last line						 */						pfetch(markline(to));						if (markidx(to) == plen)							to |= (BLKSIZE - 1);					}					to++;					switch (*key)					{					  case 'y':						cut(from, to);						break;					  case 'd':						ChangeText						{							cut(from, to);							delete(from, to);						}						cursor = from;						break;#ifndef NO_POPUP					  case '\\':						ChangeText						{							cursor = v_popup(from, to);						}						break;#endif					}					m = from = to = cursor;					break;				  case 'p':				  case 'P':					V_from = MARK_UNSET;					ChangeText					{						m = from = to = cursor = paste(cursor, (*key == 'p'), FALSE);					}					break;# endif /* !NO_VISIBLE */				  default:	m = MARK_UNSET;				}				/* adjust the moved cursor */				if (m != cursor)				{					m = adjmove(cursor, m, (*key == 'j' || *key == 'k' ? 0x20 : 0));					if (*key == '$' || (*key == 'l' && m <= cursor))					{						m++;					}				}				/* if the cursor is reasonable, use it */				if (m == MARK_UNSET)				{					beep();				}				else				{					from = to = cursor = m;				}				break;			  case ctrl('Z'):				if (getkey(0) == ctrl('Z'))				{					quit = TRUE;					goto BreakBreak;				}				break;#endif			  case ctrl('['):				/* if last line contains only whitespace, then remove whitespace */				if (*o_autoindent)				{					pfetch(markline(cursor));					for (scan = ptext; isspace(*scan); scan++)					{					}					if (scan > ptext && !*scan)					{						cursor &= ~(BLKSIZE - 1L);						if (to < cursor + plen)						{							to = cursor + plen;						}					}				}				goto BreakBreak;			  case ctrl('U'):				if (markline(cursor) == markline(from))				{					cursor = from;				}				else				{					cursor &= ~(BLKSIZE - 1);				}				break;			  case ctrl('D'):			  case ctrl('T'):				if (to > cursor)				{					delete(cursor, to);				}				mark[27] = cursor;				cmd_shift(cursor, cursor, *key == ctrl('D') ? CMD_SHIFTL : CMD_SHIFTR, TRUE, "");				if (mark[27])				{					cursor = mark[27];				}				else				{					cursor = m_front(cursor, 0L);				}				to = cursor;				break;			  case '\b':				if (cursor <= from)				{					beep();				}				else if (markidx(cursor) == 0)				{					cursor -= BLKSIZE;					pfetch(markline(cursor));					cursor += plen;				}				else				{					cursor--;				}				break;			  case ctrl('W'):				m = m_bword(cursor, 1L, 'b');				if (markline(m) == markline(cursor) && m >= from)				{					cursor = m;					if (from > cursor)					{						from = cursor;					}				}				else				{					beep();				}				break;			  case '\n':#if OSK			  case '\l':#else				  			  case '\r':#endif				build = tmpblk.c;				*build++ = '\n';				if (*o_autoindent)				{					/* figure out indent for next line */					pfetch(markline(cursor));					for (scan = ptext; *scan == ' ' || *scan == '\t'; )					{						*build++ = *scan++;					}					/* remove indent from this line, if blank */					if ((scan - ptext) >= markidx(cursor) && plen > 0)					{						to = cursor &= ~(BLKSIZE - 1);						delete(cursor, cursor + plen);					}				}				*build = 0;				if (cursor >= to && when != WHEN_VIREP)				{					add(cursor, tmpblk.c);				}				else				{					change(cursor, to, tmpblk.c);				}				redraw(cursor, TRUE);				to = cursor = (cursor & ~(BLKSIZE - 1))						+ BLKSIZE						+ (int)(build - tmpblk.c) - 1;				break;			  case ctrl('A'):			  case ctrl('P'):				if (cursor < to)				{					delete(cursor, to);				}				if (*key == ctrl('A'))				{					cutname('.');				}				to = cursor = paste(cursor, FALSE, TRUE) + 1L;				break;			  case ctrl('V'):				if (cursor >= to && when != WHEN_VIREP)				{					add(cursor, "^");				}				else				{					change(cursor, to, "^");					to = cursor + 1;				}				redraw(cursor, TRUE);				*key = getkey(0);				if (*key == '\n')				{					/* '\n' too hard to handle */#if OSK					*key = '\l';#else					*key = '\r';#endif				}				change(cursor, cursor + 1, key);				cursor++;				if (cursor > to)				{					to = cursor;				}				break;			  case ctrl('L'):			  case ctrl('R'):				redraw(MARK_UNSET, FALSE);				break;			  default:				if (cursor >= to && when != WHEN_VIREP)				{					add(cursor, key);					cursor++;					to = cursor;				}				else				{					pfetch(markline(cursor));					if (markidx(cursor) == plen)					{						add(cursor, key);					}					else					{#ifndef NO_DIGRAPH						*key = digraph(ptext[markidx(cursor)], *key);#endif						change(cursor, cursor + 1, key);					}					cursor++;				}#ifndef NO_SHOWMATCH				/* show matching "({[" if necessary */				if (*o_showmatch && strchr(")}]", *key))				{					redraw(cursor, TRUE);					m = m_match(cursor - 1, 0L);					if (markline(m) >= topline					 && markline(m) <= botline)					{						redraw(m, TRUE);						refresh();						sleep(1);					}				}#endif			} /* end switch(*key) */		} /* end for(;;) */BreakBreak:;		/* delete any excess characters */		if (cursor < to)		{#ifndef NO_EXTENSIONS			/* if we aren't in the middle of a change, start one! */			if (!inchg)			{				beforedo(FALSE);				inchg = TRUE;			}#endif			delete(cursor, to);		}	} /* end if doingdot else */	/* put the new text into a cut buffer for possible reuse */	if (!doingdot)	{		blksync();		cutname('.');		cut(from, cursor);	}	/* move to last char that we inputted, unless it was newline */	if (markidx(cursor) != 0)	{		cursor--;	}	redraw(cursor, FALSE);#ifndef NO_EXTENSIONS	if (quit)	{		/* if this is a nested "do", then cut it short */		abortdo();		/* exit, unless we can't write out the file */		cursor = v_xit(cursor, 0L, 'Z');	}#endif	rptlines = 0L;	return cursor;}

⌨️ 快捷键说明

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