diff -ur mc-4.8.10.orig/lib/tty/key.c mc-4.8.10/lib/tty/key.c
old
|
new
|
|
92 | 92 | int old_esc_mode_timeout = 1000000; /* settable via env */ |
93 | 93 | int use_8th_bit_as_meta = 0; |
94 | 94 | |
| 95 | gboolean bracketed_pasting_in_progress = FALSE; |
| 96 | |
95 | 97 | /* This table is a mapping between names and the constants we use |
96 | 98 | * We use this to allow users to define alternate definitions for |
97 | 99 | * certain keys that may be missing from the terminal database |
… |
… |
|
275 | 277 | static key_define_t mc_default_keys[] = { |
276 | 278 | {ESC_CHAR, ESC_STR, MCKEY_ESCAPE}, |
277 | 279 | {ESC_CHAR, ESC_STR ESC_STR, MCKEY_NOACTION}, |
| 280 | {MCKEY_BRACKETED_PASTING_START, ESC_STR "[200~", MCKEY_NOACTION}, |
| 281 | {MCKEY_BRACKETED_PASTING_END, ESC_STR "[201~", MCKEY_NOACTION}, |
278 | 282 | {0, NULL, MCKEY_NOACTION}, |
279 | 283 | }; |
280 | 284 | |
… |
… |
|
2148 | 2152 | return (event->type != 0) ? EV_MOUSE : EV_NONE; |
2149 | 2153 | } |
2150 | 2154 | |
| 2155 | if (c == MCKEY_BRACKETED_PASTING_START) { |
| 2156 | bracketed_pasting_in_progress = TRUE; |
| 2157 | return EV_NONE; |
| 2158 | } else if (c == MCKEY_BRACKETED_PASTING_END) { |
| 2159 | bracketed_pasting_in_progress = FALSE; |
| 2160 | return EV_NONE; |
| 2161 | } |
| 2162 | |
2151 | 2163 | return c; |
2152 | 2164 | } |
2153 | 2165 | |
… |
… |
|
2250 | 2262 | } |
2251 | 2263 | |
2252 | 2264 | /* --------------------------------------------------------------------------------------------- */ |
| 2265 | |
| 2266 | void |
| 2267 | enable_bracketed_paste (void) |
| 2268 | { |
| 2269 | printf (ESC_STR "[?2004h"); |
| 2270 | fflush (stdout); |
| 2271 | } |
| 2272 | |
| 2273 | /* --------------------------------------------------------------------------------------------- */ |
| 2274 | |
| 2275 | void |
| 2276 | disable_bracketed_paste (void) |
| 2277 | { |
| 2278 | printf (ESC_STR "[?2004l"); |
| 2279 | fflush (stdout); |
| 2280 | bracketed_pasting_in_progress = FALSE; |
| 2281 | } |
| 2282 | |
| 2283 | /* --------------------------------------------------------------------------------------------- */ |
diff -ur mc-4.8.10.orig/lib/tty/key.h mc-4.8.10/lib/tty/key.h
old
|
new
|
|
36 | 36 | /* Return code for the extended mouse sequence */ |
37 | 37 | #define MCKEY_EXTENDED_MOUSE -3 |
38 | 38 | |
| 39 | /* Return code for brackets of bracketed paste mode */ |
| 40 | #define MCKEY_BRACKETED_PASTING_START -4 |
| 41 | #define MCKEY_BRACKETED_PASTING_END -5 |
| 42 | |
39 | 43 | /*** enums ***************************************************************************************/ |
40 | 44 | |
41 | 45 | /*** structures declarations (and typedefs of structures)*****************************************/ |
… |
… |
|
61 | 65 | extern int use_8th_bit_as_meta; |
62 | 66 | extern int mou_auto_repeat; |
63 | 67 | |
| 68 | extern gboolean bracketed_pasting_in_progress; |
| 69 | |
64 | 70 | /*** declarations of public functions ************************************************************/ |
65 | 71 | |
66 | 72 | gboolean define_sequence (int code, const char *seq, int action); |
… |
… |
|
101 | 107 | void numeric_keypad_mode (void); |
102 | 108 | void application_keypad_mode (void); |
103 | 109 | |
| 110 | /* Bracketed paste mode */ |
| 111 | void enable_bracketed_paste (void); |
| 112 | void disable_bracketed_paste (void); |
| 113 | |
104 | 114 | /*** inline functions ****************************************************************************/ |
105 | 115 | |
106 | 116 | static inline gboolean |
diff -ur mc-4.8.10.orig/lib/tty/tty-ncurses.c mc-4.8.10/lib/tty/tty-ncurses.c
old
|
new
|
|
218 | 218 | tty_shutdown (void) |
219 | 219 | { |
220 | 220 | disable_mouse (); |
| 221 | disable_bracketed_paste (); |
221 | 222 | tty_reset_shell_mode (); |
222 | 223 | tty_noraw_mode (); |
223 | 224 | tty_keypad (FALSE); |
diff -ur mc-4.8.10.orig/lib/tty/tty-slang.c mc-4.8.10/lib/tty/tty-slang.c
old
|
new
|
|
347 | 347 | char *op_cap; |
348 | 348 | |
349 | 349 | disable_mouse (); |
| 350 | disable_bracketed_paste (); |
350 | 351 | tty_reset_shell_mode (); |
351 | 352 | tty_noraw_mode (); |
352 | 353 | tty_keypad (FALSE); |
diff -ur mc-4.8.10.orig/src/editor/edit.c mc-4.8.10/src/editor/edit.c
old
|
new
|
|
3457 | 3457 | if (option_auto_para_formatting) |
3458 | 3458 | { |
3459 | 3459 | edit_double_newline (edit); |
3460 | | if (option_return_does_auto_indent) |
| 3460 | if (option_return_does_auto_indent && !bracketed_pasting_in_progress) |
3461 | 3461 | edit_auto_indent (edit); |
3462 | 3462 | format_paragraph (edit, FALSE); |
3463 | 3463 | } |
3464 | 3464 | else |
3465 | 3465 | { |
3466 | 3466 | edit_insert (edit, '\n'); |
3467 | | if (option_return_does_auto_indent) |
| 3467 | if (option_return_does_auto_indent && !bracketed_pasting_in_progress) |
3468 | 3468 | edit_auto_indent (edit); |
3469 | 3469 | } |
3470 | 3470 | break; |
diff -ur mc-4.8.10.orig/src/editor/editwidget.c mc-4.8.10/src/editor/editwidget.c
old
|
new
|
|
1065 | 1065 | ret = edit_dialog_command_execute (h, command); |
1066 | 1066 | } |
1067 | 1067 | |
| 1068 | if (!is_idle()) |
| 1069 | widget_want_idle (w, TRUE); |
1068 | 1070 | return ret; |
1069 | 1071 | } |
1070 | 1072 | |
… |
… |
|
1080 | 1082 | edit_dlg_deinit (); |
1081 | 1083 | return MSG_HANDLED; |
1082 | 1084 | |
| 1085 | case MSG_IDLE: |
| 1086 | widget_want_idle (w, FALSE); |
| 1087 | return send_message (h->current->data, NULL, MSG_IDLE, 0, NULL); |
| 1088 | |
1083 | 1089 | default: |
1084 | 1090 | return dlg_default_callback (w, sender, msg, parm, data); |
1085 | 1091 | } |
… |
… |
|
1151 | 1157 | edit_clean (e); |
1152 | 1158 | return MSG_HANDLED; |
1153 | 1159 | |
| 1160 | case MSG_IDLE: |
| 1161 | edit_update_screen (e); |
| 1162 | return MSG_HANDLED; |
| 1163 | |
1154 | 1164 | default: |
1155 | 1165 | return widget_default_callback (w, sender, msg, parm, data); |
1156 | 1166 | } |
diff -ur mc-4.8.10.orig/src/execute.c mc-4.8.10/src/execute.c
old
|
new
|
|
88 | 88 | tty_raw_mode (); |
89 | 89 | channels_up (); |
90 | 90 | enable_mouse (); |
| 91 | enable_bracketed_paste (); |
91 | 92 | if (mc_global.tty.alternate_plus_minus) |
92 | 93 | application_keypad_mode (); |
93 | 94 | } |
… |
… |
|
107 | 108 | |
108 | 109 | channels_down (); |
109 | 110 | disable_mouse (); |
| 111 | disable_bracketed_paste (); |
110 | 112 | |
111 | 113 | tty_reset_shell_mode (); |
112 | 114 | tty_keypad (FALSE); |
… |
… |
|
455 | 457 | |
456 | 458 | channels_down (); |
457 | 459 | disable_mouse (); |
| 460 | disable_bracketed_paste (); |
458 | 461 | if (clear_before_exec) |
459 | 462 | clr_scr (); |
460 | 463 | if (mc_global.tty.alternate_plus_minus) |
… |
… |
|
518 | 521 | } |
519 | 522 | |
520 | 523 | enable_mouse (); |
| 524 | enable_bracketed_paste (); |
521 | 525 | channels_up (); |
522 | 526 | if (mc_global.tty.alternate_plus_minus) |
523 | 527 | application_keypad_mode (); |
diff -ur mc-4.8.10.orig/src/main.c mc-4.8.10/src/main.c
old
|
new
|
|
381 | 381 | w/o Shift button in subshell in the native console */ |
382 | 382 | init_mouse (); |
383 | 383 | |
| 384 | /* Done after do_enter_ca_mode (tty_init) because in VTE bracketed mode is |
| 385 | separate for the normal and alternate screens */ |
| 386 | enable_bracketed_paste (); |
| 387 | |
384 | 388 | /* subshell_prompt is NULL here */ |
385 | 389 | mc_prompt = (geteuid () == 0) ? "# " : "$ "; |
386 | 390 | |