📄 xterm-patch
字号:
+ else if (row == -1)+ row = -1;+ else if (row < 0)+ row = 224 + row;++ if (col > 207)+ col = 207;+ else if (col < -16)+ col = 208;+ else if (col == -1)+ col = -1;+ else if (col < 0)+ col = 224 + col;+ + } else {+ /* Limit to screen dimensions */+ if (row < 0)+ row = 0;+ else if (row > screen->max_row)+ row = screen->max_row;+ else if (row > MOUSE_LIMIT)+ row = MOUSE_LIMIT;++ if (col < 0)+ col = 0;+ else if (col > screen->max_col)+ col = screen->max_col;+ else if (col > MOUSE_LIMIT)+ col = MOUSE_LIMIT;+ } /* Build key sequence starting with \E[M */ if (screen->control_eight_bits) {diff -Naur xterm-200/charproc.c xterm-200-new/charproc.c--- xterm-200/charproc.c 2005-02-06 16:42:38.000000000 -0500+++ xterm-200-new/charproc.c 2005-04-06 11:32:53.000000000 -0400@@ -1098,6 +1098,20 @@ static struct ParseState myState; +extern Widget current_widget;+extern XEvent *current_event;+extern String *current_params;+extern Cardinal *current_num_params;++char *select_args[]=+{+ "PRIMARY",+ "CUT_BUFFER0",+ 0+};++extern int base64_paste;+ static Boolean doparsing(unsigned c, struct ParseState *sp) {@@ -1121,7 +1135,19 @@ do { #if OPT_WIDE_CHARS- if (screen->wide_chars++ /* Feed wide characters into state machine when we're+ reading in a selection */+ if (sp->parsestate == take_table) {+ if (c < 256)+ sp->nextstate = sp->parsestate[E2A(c)];+ else+ sp->nextstate = CASE_TAKE;+ goto just_take_it;+ }++ /* Jhallen: this code was very very slow, so I put in the (c >= 0x300) */+ if (c >= 0x300 && screen->wide_chars && my_wcwidth((int) c) == 0) { int prev, precomposed; @@ -1366,6 +1392,8 @@ string_used = 0; } + just_take_it:+ TRACE(("parse %04X -> %d %s\n", c, sp->nextstate, which_table(sp->parsestate))); switch (sp->nextstate) {@@ -1654,6 +1682,38 @@ sp->parsestate = sp->groundtable; break; + case CASE_PASTE: {+ int cmd = param[0];+ TRACE(("CASE_PASTE - cut & paste\n"));+ if (cmd < 2)+ cmd = 0;+ if (cmd == 0) {+ TRACE(("CASE_PASTE - paste selection\n"));+ /* Paste current selection */+ base64_paste = 1; /* Tells _GetSelection data is base64 encoded */+ _GetSelection(current_widget, 0, select_args, 2, NULL);+ /* _GetSelection clears base64_paste */+ sp->parsestate = sp->groundtable;+ } else if (cmd == 2) {+ TRACE(("CASE_PASTE - taking selection data\n"));+ ClearSelectionBuffer();+ sp->parsestate = take_table;+ } else+ sp->parsestate = sp->groundtable;+ break;+ }++ case CASE_TAKE: {+ AppendToSelectionBuffer(c);+ sp->parsestate = take_table;+ break;+ }++ case CASE_TAKE_DONE:+ CompleteSelection();+ sp->parsestate = sp->groundtable;+ break;+ case CASE_ECH: TRACE(("CASE_ECH - erase char\n")); /* ECH */@@ -3877,6 +3937,12 @@ set_keyboard_type(keyboardIsVT220, func == bitset); break; #endif+ case SET_PASTE_IN_BRACKET:+ screen->paste_brackets = (func == bitset);+ break;+ case SET_OUT_OF_FRAME:+ screen->out_of_frame = (func == bitset);+ break; #if OPT_READLINE case SET_BUTTON1_MOVE_POINT: set_mouseflag(click1_moves);@@ -3887,9 +3953,6 @@ case SET_DBUTTON3_DELETE: set_mouseflag(dclick3_deletes); break;- case SET_PASTE_IN_BRACKET:- set_mouseflag(paste_brackets);- break; case SET_PASTE_QUOTE: set_mouseflag(paste_quotes); break;@@ -3993,6 +4056,12 @@ CursorSave(termw); } break;+ case SET_PASTE_IN_BRACKET:+ DoSM(DP_PASTE_BRACKETS, screen->paste_brackets);+ break;+ case SET_OUT_OF_FRAME:+ DoSM(DP_OUT_OF_FRAME, screen->out_of_frame);+ break; #if OPT_READLINE case SET_BUTTON1_MOVE_POINT: SCREEN_FLAG_save(screen, click1_moves);@@ -4003,9 +4072,6 @@ case SET_DBUTTON3_DELETE: SCREEN_FLAG_save(screen, dclick3_deletes); break;- case SET_PASTE_IN_BRACKET:- SCREEN_FLAG_save(screen, paste_brackets);- break; case SET_PASTE_QUOTE: SCREEN_FLAG_save(screen, paste_quotes); break;@@ -4156,6 +4222,11 @@ CursorRestore(termw); } break;+ case SET_PASTE_IN_BRACKET:+ DoRM(DP_PASTE_BRACKETS, screen->paste_brackets);+ break;+ case SET_OUT_OF_FRAME:+ DoRM(DP_OUT_OF_FRAME, screen->out_of_frame); #if OPT_READLINE case SET_BUTTON1_MOVE_POINT: SCREEN_FLAG_restore(screen, click1_moves);@@ -4166,9 +4237,6 @@ case SET_DBUTTON3_DELETE: SCREEN_FLAG_restore(screen, dclick3_deletes); break;- case SET_PASTE_IN_BRACKET:- SCREEN_FLAG_restore(screen, paste_brackets);- break; case SET_PASTE_QUOTE: SCREEN_FLAG_restore(screen, paste_quotes); break;diff -Naur xterm-200/ctlseqs.ms xterm-200-new/ctlseqs.ms--- xterm-200/ctlseqs.ms 2005-01-13 20:50:00.000000000 -0500+++ xterm-200-new/ctlseqs.ms 2005-04-06 11:45:04.000000000 -0400@@ -792,6 +792,8 @@ \*(Ps = \*1\*0\*5\*3 \(-> Set SCO function-key mode. \*(Ps = \*1\*0\*6\*0 \(-> Set legacy keyboard emulation (X11R6). \*(Ps = \*1\*0\*6\*1 \(-> Set Sun/PC keyboard emulation of VT220 keyboard.+ \*(Ps = \*2\*0\*0\*4 \(-> Set bracketed paste mode.+ \*(Ps = \*2\*0\*0\*7 \(-> Allow mouse coordinates beyond frame. . .IP \\*(Cs\\*(Pm\\*s\\*i Media Copy (MC)@@ -869,6 +871,8 @@ \*(Ps = \*1\*0\*5\*3 \(-> Reset SCO function-key mode. \*(Ps = \*1\*0\*6\*0 \(-> Reset legacy keyboard emulation (X11R6). \*(Ps = \*1\*0\*6\*1 \(-> Reset Sun/PC keyboard emulation of VT220 keyboard.+ \*(Ps = \*2\*0\*0\*4 \(-> Reset bracketed paste mode.+ \*(Ps = \*2\*0\*0\*7 \(-> Mouse coordinates constrained within frame. . .IP \\*(Cs\\*(Pm\\*s\\*m Character Attributes (SGR)@@ -1086,6 +1090,15 @@ \*(Pc is the character to use. \*(Pt\*;\*(Pl\*;\*(Pb\*;\*(Pr denotes the rectangle. .+.IP \\*(Cs\\*?\\*(Ps\\*s\\*P+Cut and Paste.+ \*(Ps = \*1 \(-> Paste (default). The current selection is sent to the program in Base64:+ESC [ ? 202 ~ <base64-data> ESC.+ \*(Ps = \*2 \(-> Select. Give Base64 encoded selection+data to Xterm. Base64 encoded data is sent to the XTerm following this command. The Data+is terminated with a single ESC. This data becomes the new selection, which is then+available for pasting by other applications.+. .IP \\*(Cs\\*(Ps\\*s\\*;\\*(Pu\\*s\\*(qu\\*z Enable Locator Reporting (DECELR) .br@@ -1563,6 +1576,14 @@ to make the details of switching independent of the application that requests the switch. .SH+Bracketed Paste Mode+.ds RH Bracketed Paste Mode+.LP+When bracketed paste mode is set, pasted text is bracketed with control+sequences so that the program can differentiate pasted text from typed-in+text. When bracketed paste mode is set, the program will receive: ESC [ 200 ~,+followed by the pasted text, followed by ESC [ 201 ~.+.SH Mouse Tracking .ds RH Mouse Tracking .LP@@ -1592,6 +1613,7 @@ #define SET_VT200_HIGHLIGHT_MOUSE 1001 #define SET_BTN_EVENT_MOUSE 1002 #define SET_ANY_EVENT_MOUSE 1003+#define SET_OUT_OF_FRAME 2007 .DE .LP The motion reporting modes are strictly \fIxterm\fP extensions, and are not@@ -1605,6 +1627,13 @@ For example, \*! specifies the value 1. The upper left character position on the terminal is denoted as 1,1. +If OUT_OF_FRAME mode is enabled, and the mouse goes beyond the window frame,+coordinates beyond the frame are sent to the program. Coordinate values 1 -+208 are sent as usual, as byte values between 33 and 240. The coordinate+value 0 (the first cell above or to the left of the frame) is sent as SPACE+(32). The coordinate values -15 through -1 are sent as byte values 241+through 255.+ X10 compatibility mode sends an escape sequence only on button press, encoding the location and the mouse button pressed. It is enabled by specifying parameter 9 to DECSET.diff -Naur xterm-200/misc.c xterm-200-new/misc.c--- xterm-200/misc.c 2005-01-29 17:17:32.000000000 -0500+++ xterm-200-new/misc.c 2005-03-27 17:29:23.000000000 -0500@@ -228,6 +228,11 @@ return (c); } +Widget current_widget;+XEvent *current_event;+String *current_params;+Cardinal *current_num_params;+ /* ARGSUSED */ void HandleKeyPressed(Widget w GCC_UNUSED,@@ -238,9 +243,14 @@ TScreen *screen = &term->screen; TRACE(("Handle 7bit-key\n"));+ current_widget = w;+ current_event = event;+ current_params = params;+ current_num_params = nparams; #ifdef ACTIVEWINDOWINPUTONLY if (w == CURRENT_EMU(screen)) #endif+ Input(&term->keyboard, screen, &event->xkey, False); } diff -Naur xterm-200/paste xterm-200-new/paste--- xterm-200/paste 1969-12-31 19:00:00.000000000 -0500+++ xterm-200-new/paste 2005-04-06 11:46:10.000000000 -0400@@ -0,0 +1 @@+[?Pdiff -Naur xterm-200/ptyx.h xterm-200-new/ptyx.h--- xterm-200/ptyx.h 2005-01-13 20:50:03.000000000 -0500+++ xterm-200-new/ptyx.h 2005-03-28 22:48:06.000000000 -0500@@ -1108,6 +1108,8 @@ #if OPT_TOOLBAR DP_TOOLBAR, #endif+ DP_PASTE_BRACKETS,+ DP_OUT_OF_FRAME, DP_LAST } SaveModes; @@ -1269,11 +1271,12 @@ unsigned long event_mask; unsigned short send_mouse_pos; /* user wants mouse transition */ /* and position information */+ unsigned paste_brackets;+ unsigned out_of_frame; #if OPT_READLINE unsigned click1_moves; unsigned paste_moves; unsigned dclick3_deletes;- unsigned paste_brackets; unsigned paste_quotes; unsigned paste_literal_nl; #endif /* OPT_READLINE */diff -Naur xterm-200/select xterm-200-new/select--- xterm-200/select 1969-12-31 19:00:00.000000000 -0500+++ xterm-200-new/select 2005-04-06 11:47:39.000000000 -0400@@ -0,0 +1,2 @@+[?2PSGVsbG8sIHdvcmxkIQo=+diff -Naur xterm-200/xcharmouse.h xterm-200-new/xcharmouse.h--- xterm-200/xcharmouse.h 2002-08-24 14:54:39.000000000 -0400+++ xterm-200-new/xcharmouse.h 2005-03-28 22:39:35.000000000 -0500@@ -50,6 +50,8 @@ #define SET_PASTE_IN_BRACKET 2004 /* Surround paste by escapes */ #define SET_PASTE_QUOTE 2005 /* Quote each char during paste */ #define SET_PASTE_LITERAL_NL 2006 /* Paste "\n" as C-j */+#define SET_OUT_OF_FRAME 2007 /* Give mouse coords even when cursor+ is outside of frame */ #if OPT_DEC_LOCATOR diff -Naur xterm-200/xterm.h xterm-200-new/xterm.h--- xterm-200/xterm.h 2005-01-13 20:50:03.000000000 -0500+++ xterm-200-new/xterm.h 2005-03-30 22:35:45.000000000 -0500@@ -603,6 +603,9 @@ extern void DisownSelection (XtermWidget termw); extern void HandleGINInput PROTO_XT_ACTIONS_ARGS; extern void HandleInsertSelection PROTO_XT_ACTIONS_ARGS;++extern void _GetSelection (Widget w, Time ev_time, String *params, Cardinal num_params, Atom *targets);+ extern void HandleKeyboardSelectEnd PROTO_XT_ACTIONS_ARGS; extern void HandleKeyboardSelectStart PROTO_XT_ACTIONS_ARGS; extern void HandleKeyboardStartExtend PROTO_XT_ACTIONS_ARGS;@@ -630,6 +633,10 @@ extern Bool iswide(int i); #endif +extern void ClearSelectionBuffer ();+extern void AppendToSelectionBuffer (unsigned c);+extern void CompleteSelection ();+ /* charproc.c */ extern int VTInit (void); extern int v_write (int f, Char *d, unsigned len);@@ -1052,4 +1059,6 @@ } #endif ++ #endif /* included_xterm_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -