On 2018-12-05 14:12:32 +0100, Vincent Lefevre wrote: > I suspect a bug in doSelectionFormat() in button.c that makes xterm > think that there was a bracketed paste, whose consequence is to > generate the "ESC [ 2 0 1 ~ .". > > If I remove > > #if OPT_READLINE > mydata->paste_brackets = screen->paste_brackets; > SCREEN_FLAG_unset(screen, paste_brackets); > #endif > > then I no longer get the "\33[201~". There's another issue, but > that's a start.
Replacing mydata->paste_brackets = screen->paste_brackets; by mydata->paste_brackets = 0; seems to solve the problem for exec-formatted. But doSelectionFormat is also used by insert-formatted. I propose the attached patch, which doesn't change the behavior for insert-formatted. But I don't know about the SCREEN_FLAG_unset(screen, paste_brackets); line. Perhaps #if OPT_PASTE64 mydata->base64_paste = screen->base64_paste; screen->base64_paste = 0; #endif needs to be modified in a similar way, I don't know. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Index: xterm-337/button.c =================================================================== --- xterm-337.orig/button.c +++ xterm-337/button.c @@ -4943,7 +4943,8 @@ doSelectionFormat(XtermWidget xw, XEvent *event, String *params, Cardinal *num_params, - FormatSelect format_select) + FormatSelect format_select, + int paste) { TScreen *screen = TScreenOf(xw); InternalSelect *mydata = &(screen->internal_select); @@ -4958,7 +4959,7 @@ doSelectionFormat(XtermWidget xw, screen->base64_paste = 0; #endif #if OPT_READLINE - mydata->paste_brackets = screen->paste_brackets; + mydata->paste_brackets = paste ? screen->paste_brackets : 0; SCREEN_FLAG_unset(screen, paste_brackets); #endif @@ -5402,7 +5403,7 @@ HandleExecFormatted(Widget w, TRACE_EVENT("HandleExecFormatted", event, params, num_params); if ((xw = getXtermWidget(w)) != 0 && (*num_params > 1)) { - doSelectionFormat(xw, w, event, params, num_params, reallyExecFormatted); + doSelectionFormat(xw, w, event, params, num_params, reallyExecFormatted, 0); } } @@ -5468,7 +5469,7 @@ HandleInsertFormatted(Widget w, TRACE_EVENT("HandleInsertFormatted", event, params, num_params); if ((xw = getXtermWidget(w)) != 0 && (*num_params > 1)) { - doSelectionFormat(xw, w, event, params, num_params, reallyInsertFormatted); + doSelectionFormat(xw, w, event, params, num_params, reallyInsertFormatted, 1); } }