Patch 8.2.3801
Problem:    If a terminal shows in two windows, only one is redrawn.
Solution:   Reset the dirty row range only after redrawing all windows.
            (closes #9341)
Files:      src/terminal.c, src/proto/terminal.pro, src/drawscreen.c,
            src/testdir/test_terminal.vim


*** ../vim-8.2.3800/src/terminal.c      2021-12-13 14:26:40.996627748 +0000
--- src/terminal.c      2021-12-13 21:56:21.440141928 +0000
***************
*** 3850,3857 ****
  #endif
                                0);
      }
!     term->tl_dirty_row_start = MAX_ROW;
!     term->tl_dirty_row_end = 0;
  }
  
  /*
--- 3850,3871 ----
  #endif
                                0);
      }
! }
! 
! /*
!  * Called after updating all windows: may reset dirty rows.
!  */
!     void
! term_did_update_window(win_T *wp)
! {
!     term_T    *term = wp->w_buffer->b_term;
! 
!     if (term != NULL && term->tl_vterm != NULL && !term->tl_normal_mode
!                                                      && wp->w_redr_type == 0)
!     {
!       term->tl_dirty_row_start = MAX_ROW;
!       term->tl_dirty_row_end = 0;
!     }
  }
  
  /*
*** ../vim-8.2.3800/src/proto/terminal.pro      2021-12-08 22:13:13.105328552 
+0000
--- src/proto/terminal.pro      2021-12-13 21:22:17.493852006 +0000
***************
*** 26,31 ****
--- 26,32 ----
  void term_check_channel_closed_recently(void);
  int term_do_update_window(win_T *wp);
  void term_update_window(win_T *wp);
+ void term_did_update_window(win_T *wp);
  int term_is_finished(buf_T *buf);
  int term_show_buffer(buf_T *buf);
  void term_change_in_curbuf(void);
*** ../vim-8.2.3800/src/drawscreen.c    2021-12-09 10:50:48.562865618 +0000
--- src/drawscreen.c    2021-12-13 21:26:51.713689908 +0000
***************
*** 342,347 ****
--- 342,354 ----
      update_popups(win_update);
  #endif
  
+ #ifdef FEAT_TERMINAL
+     FOR_ALL_WINDOWS(wp)
+       // If this window contains a terminal, after redrawing all windows, the
+       // dirty row range can be reset.
+       term_did_update_window(wp);
+ #endif
+ 
      after_updating_screen(TRUE);
  
      // Clear or redraw the command line.  Done last, because scrolling may
*** ../vim-8.2.3800/src/testdir/test_terminal.vim       2021-12-09 
10:50:48.566865615 +0000
--- src/testdir/test_terminal.vim       2021-12-13 21:58:09.268043989 +0000
***************
*** 1377,1382 ****
--- 1377,1408 ----
    exe 'bwipe! ' .. newbuf
  endfunc
  
+ func Test_terminal_popup_two_windows()
+   CheckScreendump
+   CheckUnix
+ 
+   " use "sh" instead of "&shell" in the hope it will use a short prompt
+   let lines =<< trim END
+       let termbuf = term_start('sh', #{hidden: v:true, term_finish: 'close'})
+       exe 'buffer ' .. termbuf
+ 
+       let winid = popup_create(termbuf, #{line: 2, minwidth: 30, border: []})
+       sleep 50m
+ 
+       call term_sendkeys(termbuf, "echo 'test'")
+   END
+   call writefile(lines, 'XpopupScript')
+   let buf = RunVimInTerminal('-S XpopupScript', {})
+ 
+   " typed text appears both in normal window and in popup
+   call WaitForAssert({-> assert_match("echo 'test'", term_getline(buf, 1))})
+   call WaitForAssert({-> assert_match("echo 'test'", term_getline(buf, 3))})
+ 
+   call term_sendkeys(buf, "\<CR>exit\<CR>:q\<CR>")
+   call StopVimInTerminal(buf)
+   call delete('XpopupScript')
+ endfunc
+ 
  func Test_terminal_popup_insert_cmd()
    CheckUnix
  
***************
*** 1402,1407 ****
--- 1428,1434 ----
  
  func Test_terminal_dumpwrite_composing()
    CheckRunVimInTerminal
+ 
    let save_enc = &encoding
    set encoding=utf-8
    call assert_equal(1, winnr('$'))
*** ../vim-8.2.3800/src/version.c       2021-12-13 20:37:55.704562928 +0000
--- src/version.c       2021-12-13 21:22:01.361859676 +0000
***************
*** 751,752 ****
--- 751,754 ----
  {   /* Add new patch number below this line */
+ /**/
+     3801,
  /**/

-- 
What a wonderfully exciting cough!  Do you mind if I join you?
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211213215937.86B761C0D69%40moolenaar.net.

Raspunde prin e-mail lui