X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=c3a04c5b0335cbf4ffbd8891c29c012f34c1ceba;hb=eeae9b0ceef9e2fec4cb4f1132748c302e5ac702;hp=3321c3116666fecb49bc95859b83beb067cb772a;hpb=eae31a532e1c3249abe3fe0dbce286cac263832f;p=st.git diff --git a/st.c b/st.c index 3321c31..c3a04c5 100644 --- a/st.c +++ b/st.c @@ -132,6 +132,7 @@ enum term_mode { MODE_FOCUS = 65536, MODE_MOUSEX10 = 131072, MODE_MOUSEMANY = 262144, + MODE_BRCKTPASTE = 524288, MODE_MOUSE = MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\ |MODE_MOUSEMANY, }; @@ -961,7 +962,7 @@ selcopy(void) { * st. * FIXME: Fix the computer world. */ - if(y < sel.ne.y && !((gp-1)->mode & ATTR_WRAP)) + if(y < sel.ne.y && x > 0 && !((gp-1)->mode & ATTR_WRAP)) *ptr++ = '\n'; /* @@ -1013,7 +1014,11 @@ selnotify(XEvent *e) { *repl++ = '\r'; } + if(IS_SET(MODE_BRCKTPASTE)) + ttywrite("\033[200~", 6); ttywrite((const char *)data, nitems * format / 8); + if(IS_SET(MODE_BRCKTPASTE)) + ttywrite("\033[201~", 6); XFree(data); /* number of 32-bit chunks returned */ ofs += nitems * format / 32; @@ -1868,6 +1873,9 @@ tsetmode(bool priv, bool set, int *args, int narg) { case 1048: tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); break; + case 2004: /* 2004: bracketed paste mode */ + MODBIT(term.mode, set, MODE_BRCKTPASTE); + break; /* Not implemented mouse modes. See comments there. */ case 1001: /* mouse highlight mode; can hang the terminal by design when implemented. */