📄 default.c
字号:
/* * New editor name: TDE, the Thomson-Davis Editor. * Author: Frank Davis * Date: June 5, 1991 * * This modification of Douglas Thomson's code is released into the * public domain, Frank Davis. You may distribute it freely. * * Set up default dispatch table. * * If you want to change the default key assignments - it's really easy. All * you have to do is set the appropriate array element to the desired function * and then recompile the source code. The available functions are in the * define.h file. * * If you change the default key assignments, you should also change the help * screen to show what function the new keys are assigned to. * * The key code returned by pressing a function key is added to 256. This is * done because it makes it easy to allow the ASCII and Extended ASCII * characters to get thru as normal characters and to trap the function keys * because they are greater than 256. See function getfunc( ) in query.c. * * jmh 980525: made it a C file. * jmh 980727: added a function to create default two-key combinations. * jmh 020816: totally modified the key layout. Keys are based on scan * codes, also allowing the viewer keys to be mapped directly. */#include "tdestr.h"#include "define.h"#include "tdefunc.h"KEY_FUNC key_func = {{ /* Unshifted keys */ RestoreLine, /* Esc */ 0, /* 1 */ 0, /* 2 */ 0, /* 3 */ 0, /* 4 */ 0, /* 5 */ 0, /* 6 */ 0, /* 7 */ 0, /* 8 */ 0, /* 9 */ 0, /* 0 */ 0, /* - */ Status, /* = */ BackSpace, /* Backspace */ Tab, /* Tab */ Quit, /* q */ 0, /* w */ PanDn, /* e */ Repeat, /* r */ 0, /* t */ PanUp, /* y */ HalfScreenUp, /* u */ 0, /* i */ 0, /* o */ 0, /* p */ HalfScreenLeft, /* [ */ HalfScreenRight, /* ] */ Rturn, /* Enter */ 0, /* (Control) */ 0, /* a */ UserScreen, /* s */ HalfScreenDown, /* d */ ScreenDown, /* f */ JumpToPosition, /* g */ PanLeft, /* h */ PanDn, /* j */ PanUp, /* k */ PanRight, /* l */ 0, /* ; */ TwoCharKey, /* ' */ PreviousPosition, /* ` */ 0, /* (LeftShift) */ 0, /* \ */ 0, /* z */ 0, /* x */ 0, /* c */ ToggleReadOnly, /* v */ ScreenUp, /* b */ RepeatRegXForward, /* n */ TwoCharKey, /* m */ RepeatFindBackward, /* , */ RepeatFindForward, /* . */ RegXForward, /* / */ 0, /* (RightShift) */ 0, /* Grey* */ 0, /* (Alt) */ ScreenDown, /* SpaceBar */ 0, /* (CapsLock) */ Help, /* F1 */ Save, /* F2 */ Quit, /* F3 */ File, /* F4 */ RepeatFindForward, /* F5 */ RepeatFindBackward, /* F6 */ RepeatRegXForward, /* F7 */ SplitVertical, /* F8 */ SplitHorizontal, /* F9 */ NextWindow, /* F10 */ Rturn, /* GreyEnter */ 0, /* Grey/ */ BegOfLine, /* Home */ LineUp, /* Up */ ScreenUp, /* PgUp */ ScrollUpLine, /* Grey- */ CharLeft, /* Left */ CenterWindow, /* Center (KeyPad5) */ CharRight, /* Right */ ScrollDnLine, /* Grey+ */ EndOfLine, /* End */ LineDown, /* Down */ ScreenDown, /* PgDn */ ToggleOverWrite, /* Ins */ DeleteChar, /* Del */ 0, /* (PrtSc) */ 0, /* (F11Alt) */ 0, /* Left\ */ RepeatDiff, /* F11 */ RepeatGrep, /* F12 */},{ /* Shift keys */ SetBreakPoint, /* Shift+Esc */ Shell, /* ! */ 0, /* @ */ 0, /* # */ 0, /* $ */ 0, /* % */ 0, /* ^ */ 0, /* & */ 0, /* * */ 0, /* ( */ 0, /* ) */ 0, /* _ */ 0, /* + */ BackSpace, /* Shift+Backspace */ BackTab, /* Shift+Tab */ QuitAll, /* Q */ 0, /* W */ EditFile, /* E */ RedrawScreen, /* R */ 0, /* T */ 0, /* Y */ 0, /* U */ 0, /* I */ 0, /* O */ 0, /* P */ ScreenLeft, /* { */ ScreenRight, /* } */ NextLine, /* Shift+Enter */ 0, /* (Shift+Control) */ 0, /* A */ 0, /* S */ 0, /* D */ EndOfFile, /* F */ EndOfFile, /* G */ Help, /* H */ 0, /* J */ 0, /* K */ 0, /* L */ TwoCharKey, /* : */ 0, /* " */ 0, /* ~ */ 0, /* (Shift+LeftShift) */ 0, /* | */ 0, /* Z */ 0, /* X */ 0, /* C */ 0, /* V */ TopOfFile, /* B */ RepeatRegXBackward, /* N */ 0, /* M */ FindBackward, /* < */ FindForward, /* > */ RegXBackward, /* ? */ 0, /* (Shift+RightShift) */ 0, /* Shift+Grey* */ 0, /* (Shift+Alt) */ 0, /* Shift+SpaceBar */ 0, /* (Shift+CapsLock) */ SaveMacro, /* Shift+F1 */ SaveAs, /* Shift+F2 */ LoadMacro, /* Shift+F3 */ EditFile, /* Shift+F4 */ FindForward, /* Shift+F5 */ FindBackward, /* Shift+F6 */ RegXForward, /* Shift+F7 */ ReplaceString, /* Shift+F8 */ SizeWindow, /* Shift+F9 */ PreviousWindow, /* Shift+F10 */ Statistics, /* Shift+GreyEnter */ 0, /* Shift+Grey/ */ StartOfLine, /* Shift+Home */ LineUp, /* Shift+Up */ HalfScreenUp, /* Shift+PgUp */ ScrollUpLine, /* Shift+Grey- */#if defined( __UNIX__ ) WordLeft, /* Shift+Left */ CenterWindow, /* Shift+Center */ WordRight, /* Shift+Right */#else StreamCharLeft, /* Shift+Left */ CenterWindow, /* Shift+Center */ StreamCharRight, /* Shift+Right */#endif ScrollDnLine, /* Shift+Grey+ */ EndOfLine, /* Shift+End */ LineDown, /* Shift+Down */ HalfScreenDown, /* Shift+PgDn */ PasteFromClipboard, /* Shift+Ins */ CutToClipboard, /* Shift+Del */ 0, /* (Shift+PrtSc) */ 0, /* (Alternative Shift+F11) */ 0, /* Left| */ DefineDiff, /* Shift+F11 */ DefineGrep, /* Shift+F12 */},{ /* Ctrl keys */ ClearAllMacros, /* Ctrl+Esc */ 0, /* Ctrl+1 */ DateTimeStamp, /* Ctrl+2 */ 0, /* Ctrl+3 */ 0, /* Ctrl+4 */ 0, /* Ctrl+5 */#if 0 //defined( __UNIX__ ) UnMarkBlock, /* Ctrl+6 */#else RedrawScreen, /* Ctrl+6 */#endif 0, /* Ctrl+7 */ 0, /* Ctrl+8 */ 0, /* Ctrl+9 */ 0, /* Ctrl+0 */ SplitLine, /* Ctrl+- */ PopupRuler, /* Ctrl+= */ WordDeleteBack, /* Ctrl+Backspace */ SetTabs, /* Ctrl+Tab */#if 0 //defined( __UNIX__ ) ToggleEol, /* Ctrl+Q */ ToggleSync, /* Ctrl+W */ BlockExpandTabs, /* Ctrl+E */ RecordMacro, /* Ctrl+R */ ToggleTabInflate, /* Ctrl+T */ DeleteLine, /* Ctrl+Y */ Undo, /* Ctrl+U */ Tab, /* Ctrl+I */ OverlayBlock, /* Ctrl+O */ RedrawScreen, /* Ctrl+P */ AbortCommand, /* Ctrl+[ */ ParenBalance, /* Ctrl+] */ BegNextLine, /* Ctrl+Enter */ 0, /* (Ctrl+Control) */ AddLine, /* Ctrl+A */ SortBoxBlock, /* Ctrl+S */ DeleteLine, /* Ctrl+D */ FillBlock, /* Ctrl+F */ DeleteBlock, /* Ctrl+G */ BackSpace, /* Ctrl+H */ MoveBlock, /* Ctrl+J */ TwoCharKey, /* Ctrl+K */ MarkLine, /* Ctrl+L */ 0, /* Ctrl+; */ 0, /* Ctrl+' */ 0, /* Ctrl+` */ 0, /* (Ctrl+LeftShift) */ PullDown, /* Ctrl+\ */ ToggleTrailing, /* Ctrl+Z */ MarkStream, /* Ctrl+X */ CopyBlock, /* Ctrl+C */ ToggleOverWrite, /* Ctrl+V */ MarkBox, /* Ctrl+B */ NumberBlock, /* Ctrl+N */ Rturn, /* Ctrl+M */#else FileAll, /* Ctrl+Q */ ScrollUpLine, /* Ctrl+W */ LineUp, /* Ctrl+E */ ScreenUp, /* Ctrl+R */ WordDelete, /* Ctrl+T */ DeleteLine, /* Ctrl+Y */ RetrieveLine, /* Ctrl+U */ Tab, /* Ctrl+I */ 0, /* Ctrl+O */ Pause, /* Ctrl+P */ AbortCommand, /* Ctrl+[ */ ParenBalance, /* Ctrl+] */ BegNextLine, /* Ctrl+Enter */ 0, /* (Ctrl+Control) */ WordLeft, /* Ctrl+A */ CharLeft, /* Ctrl+S */ CharRight, /* Ctrl+D */ WordRight, /* Ctrl+F */ DeleteChar, /* Ctrl+G */ BackSpace, /* Ctrl+H */ Help, /* Ctrl+J */ TwoCharKey, /* Ctrl+K */ ToggleSyntax, /* Ctrl+L */ 0, /* Ctrl+; */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -