From 5b4786110120840af5440f47873167bf07627984 Mon Sep 17 00:00:00 2001 From: Egmont Koblinger Date: Tue, 1 Oct 2013 13:58:37 +0400 Subject: [PATCH] Support bracketed paste mode of xterm in mcedit. Signed-off-by: Andrew Borodin --- src/editor/edit.c | 4 ++-- src/editor/editwidget.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/editor/edit.c b/src/editor/edit.c index 1c80466a9..cef8a8bb8 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -3457,14 +3457,14 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion) if (option_auto_para_formatting) { edit_double_newline (edit); - if (option_return_does_auto_indent) + if (option_return_does_auto_indent && !bracketed_pasting_in_progress) edit_auto_indent (edit); format_paragraph (edit, FALSE); } else { edit_insert (edit, '\n'); - if (option_return_does_auto_indent) + if (option_return_does_auto_indent && !bracketed_pasting_in_progress) edit_auto_indent (edit); } break; diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c index d7730861f..76db53372 100644 --- a/src/editor/editwidget.c +++ b/src/editor/editwidget.c @@ -1065,6 +1065,15 @@ edit_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, v ret = edit_dialog_command_execute (h, command); } + /* + * Due to the "end of bracket" escape the editor sees input with is_idle() == false + * (expects more characters) and hence doesn't yet refresh the screen, but then + * no further characters arrive (there's only an "end of bracket" which is swallowed + * by tty_get_event()), so you end up with a screen that's not refreshed after pasting. + * So let's trigger an IDLE signal. + */ + if (!is_idle ()) + widget_want_idle (w, TRUE); return ret; } @@ -1080,6 +1089,11 @@ edit_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, v edit_dlg_deinit (); return MSG_HANDLED; + case MSG_IDLE: + widget_want_idle (w, FALSE); + edit_update_screen ((WEdit *) h->current->data); + return MSG_HANDLED; + default: return dlg_default_callback (w, sender, msg, parm, data); }