comparison src/channel.c @ 17557:4a22102fda8f v8.1.1776

patch 8.1.1776: text added with a job isn't displayed commit https://github.com/vim/vim/commit/4641a122f2ffb820ec6d05526532ab38930c5286 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 29 22:10:23 2019 +0200 patch 8.1.1776: text added with a job isn't displayed Problem: Text added with a job to another buffer isn't displayed. Solution: Update topline after adding a line. (closes https://github.com/vim/vim/issues/4745)
author Bram Moolenaar <Bram@vim.org>
date Mon, 29 Jul 2019 22:15:04 +0200
parents d04de6c49f59
children ff097edaae89
comparison
equal deleted inserted replaced
17556:854411a7be7d 17557:4a22102fda8f
2535 { 2535 {
2536 win_T *wp; 2536 win_T *wp;
2537 2537
2538 FOR_ALL_WINDOWS(wp) 2538 FOR_ALL_WINDOWS(wp)
2539 { 2539 {
2540 if (wp->w_buffer == buffer 2540 if (wp->w_buffer == buffer)
2541 && (save_write_to 2541 {
2542 ? wp->w_cursor.lnum == lnum + 1 2542 int move_cursor = save_write_to
2543 : (wp->w_cursor.lnum == lnum 2543 ? wp->w_cursor.lnum == lnum + 1
2544 && wp->w_cursor.col == 0))) 2544 : (wp->w_cursor.lnum == lnum
2545 { 2545 && wp->w_cursor.col == 0);
2546 ++wp->w_cursor.lnum; 2546
2547 save_curwin = curwin; 2547 // If the cursor is at or above the new line, move it one line
2548 curwin = wp; 2548 // down. If the topline is outdated update it now.
2549 curbuf = curwin->w_buffer; 2549 if (move_cursor || wp->w_topline > buffer->b_ml.ml_line_count)
2550 scroll_cursor_bot(0, FALSE); 2550 {
2551 curwin = save_curwin; 2551 if (move_cursor)
2552 curbuf = curwin->w_buffer; 2552 ++wp->w_cursor.lnum;
2553 save_curwin = curwin;
2554 curwin = wp;
2555 curbuf = curwin->w_buffer;
2556 scroll_cursor_bot(0, FALSE);
2557 curwin = save_curwin;
2558 curbuf = curwin->w_buffer;
2559 }
2553 } 2560 }
2554 } 2561 }
2555 redraw_buf_and_status_later(buffer, VALID); 2562 redraw_buf_and_status_later(buffer, VALID);
2556 channel_need_redraw = TRUE; 2563 channel_need_redraw = TRUE;
2557 } 2564 }