To: vim_dev@googlegroups.com Subject: Patch 8.0.0823 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0823 Problem: Cannot paste text into a terminal window. Solution: Make CTRL-W " work. Files: src/terminal.c *** ../vim-8.0.0822/src/terminal.c 2017-07-30 19:38:16.962463378 +0200 --- src/terminal.c 2017-07-30 21:40:05.666466531 +0200 *************** *** 36,42 **** * that buffer, attributes come from the scrollback buffer tl_scrollback. * * TODO: - * - Make CTRL-W "" paste register content to the job? * - in bash mouse clicks are inserting characters. * - mouse scroll: when over other window, scroll that window. * - For the scrollback buffer store lines in the buffer, only attributes in --- 36,41 ---- *************** *** 67,72 **** --- 66,72 ---- * mouse in the Terminal window for copy/paste. * - when 'encoding' is not utf-8, or the job is using another encoding, setup * conversions. + * - update ":help function-list" for terminal functions. * - In the GUI use a terminal emulator for :!cmd. */ *************** *** 865,870 **** --- 865,914 ---- } /* + * Handle CTRL-W "": send register contents to the job. + */ + static void + term_paste_register(int prev_c UNUSED) + { + int c; + list_T *l; + listitem_T *item; + long reglen = 0; + int type; + + #ifdef FEAT_CMDL_INFO + if (add_to_showcmd(prev_c)) + if (add_to_showcmd('"')) + out_flush(); + #endif + c = term_vgetc(); + #ifdef FEAT_CMDL_INFO + clear_showcmd(); + #endif + + /* CTRL-W "= prompt for expression to evaluate. */ + if (c == '=' && get_expr_register() != '=') + return; + + l = (list_T *)get_reg_contents(c, GREG_LIST); + if (l != NULL) + { + type = get_reg_type(c, ®len); + for (item = l->lv_first; item != NULL; item = item->li_next) + { + char_u *s = get_tv_string(&item->li_tv); + + channel_send(curbuf->b_term->tl_job->jv_channel, PART_IN, + s, STRLEN(s), NULL); + if (item->li_next != NULL || type == MLINE) + channel_send(curbuf->b_term->tl_job->jv_channel, PART_IN, + (char_u *)"\r", 1, NULL); + } + list_free(l); + } + } + + /* * Returns TRUE if the current window contains a terminal and we are sending * keys to the job. */ *************** *** 912,917 **** --- 956,963 ---- if (c == (termkey == 0 ? Ctrl_W : termkey)) { + int prev_c = c; + #ifdef FEAT_CMDL_INFO if (add_to_showcmd(c)) out_flush(); *************** *** 930,940 **** /* "CTRL-W .": send CTRL-W to the job */ c = Ctrl_W; } ! else if (termkey == 0 && c == 'N') { term_enter_terminal_mode(); return FAIL; } else if (termkey == 0 || c != termkey) { stuffcharReadbuff(Ctrl_W); --- 976,991 ---- /* "CTRL-W .": send CTRL-W to the job */ c = Ctrl_W; } ! else if (c == 'N') { term_enter_terminal_mode(); return FAIL; } + else if (c == '"') + { + term_paste_register(prev_c); + continue; + } else if (termkey == 0 || c != termkey) { stuffcharReadbuff(Ctrl_W); *** ../vim-8.0.0822/src/version.c 2017-07-30 21:37:54.635396169 +0200 --- src/version.c 2017-07-30 21:39:56.402532260 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 823, /**/ -- Luxury. We used to have to get out of the lake at three o'clock in the morning, clean the lake, eat a handful of hot gravel, go to work at the mill every day for tuppence a month, come home, and Dad would beat us around the head and neck with a broken bottle, if we were LUCKY! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///