To: vim_dev@googlegroups.com Subject: Patch 8.0.1261 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1261 Problem: Program in terminal window gets NL instead of CR. (Lifepillar) Solution: Check the tty setup more often. (closes #1998) Files: src/terminal.c *** ../vim-8.0.1260/src/terminal.c 2017-10-30 21:56:18.619439283 +0100 --- src/terminal.c 2017-11-04 20:11:04.910958619 +0100 *************** *** 38,43 **** --- 38,45 ---- * in tl_scrollback are no longer used. * * TODO: + * - Termdebug: issue #2154 might be avoided by adding -quiet to gdb? + * patch by Christian, 2017 Oct 23. * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito * Higashi, 2017 Sep 19) * - double click in Window toolbar starts Visual mode (but not always?). *************** *** 51,58 **** * Also: #2223 * - implement term_setsize() * - Termdebug does not work when Vim build with mzscheme. gdb hangs. - * - Termdebug: issue #2154 might be avoided by adding -quiet to gdb? - * patch by Christian, 2017 Oct 23. * - MS-Windows GUI: WinBar has tearoff item * - MS-Windows GUI: still need to type a key after shell exits? #1924 * - What to store in a session file? Shell at the prompt would be OK to --- 53,58 ---- *************** *** 1535,1540 **** --- 1535,1543 ---- int c; int termkey = 0; int ret; + #ifdef UNIX + int tty_fd = curbuf->b_term->tl_job->jv_channel->ch_part[get_tty_part(curbuf->b_term)].ch_fd; + #endif /* Remember the terminal we are sending keys to. However, the terminal * might be closed while waiting for a character, e.g. typing "exit" in a *************** *** 1547,1581 **** position_cursor(curwin, &curbuf->b_term->tl_cursor_pos); may_set_cursor_props(curbuf->b_term); ! #ifdef UNIX { ! int part = get_tty_part(curbuf->b_term); ! int fd = curbuf->b_term->tl_job->jv_channel->ch_part[part].ch_fd; ! if (isatty(fd)) { ttyinfo_T info; /* Get the current backspace and enter characters of the pty. */ ! if (get_tty_info(fd, &info) == OK) { term_backspace_char = info.backspace; term_enter_char = info.enter; term_nl_does_cr = info.nl_does_cr; } } - } #endif - while (blocking || vpeekc() != NUL) - { - /* TODO: skip screen update when handling a sequence of keys. */ - /* Repeat redrawing in case a message is received while redrawing. */ - while (must_redraw != 0) - if (update_screen(0) == FAIL) - break; - update_cursor(curbuf->b_term, FALSE); - c = term_vgetc(); if (!term_use_loop()) /* job finished while waiting for a character */ --- 1550,1584 ---- position_cursor(curwin, &curbuf->b_term->tl_cursor_pos); may_set_cursor_props(curbuf->b_term); ! while (blocking || vpeekc() != NUL) { ! /* TODO: skip screen update when handling a sequence of keys. */ ! /* Repeat redrawing in case a message is received while redrawing. */ ! while (must_redraw != 0) ! if (update_screen(0) == FAIL) ! break; ! update_cursor(curbuf->b_term, FALSE); ! #ifdef UNIX ! /* ! * The shell or another program may change the tty settings. Getting ! * them for every typed character is a bit of overhead, but it's needed ! * for the first CR typed, e.g. when Vim starts in a shell. ! */ ! if (isatty(tty_fd)) { ttyinfo_T info; /* Get the current backspace and enter characters of the pty. */ ! if (get_tty_info(tty_fd, &info) == OK) { term_backspace_char = info.backspace; term_enter_char = info.enter; term_nl_does_cr = info.nl_does_cr; } } #endif c = term_vgetc(); if (!term_use_loop()) /* job finished while waiting for a character */ *** ../vim-8.0.1260/src/version.c 2017-11-04 19:24:24.754197129 +0100 --- src/version.c 2017-11-04 20:03:07.225567016 +0100 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1261, /**/ -- "Software is like sex... it's better when it's free." -- Linus Torvalds, initiator of the free Linux OS Makes me wonder what FSF stands for...? /// 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 ///