patch 8.2.0936: some terminals misinterpret the code for getting cursor style

Problem:    Some terminals misinterpret the code for getting cursor style.
Solution:   Send a sequence to the terminal and check the result. (IWAMOTO
            Kouichi, closes #2126)  Merged with current code.
diff --git a/src/testdir/term_util.vim b/src/testdir/term_util.vim
index 2d66f38..df7cfa5 100644
--- a/src/testdir/term_util.vim
+++ b/src/testdir/term_util.vim
@@ -44,6 +44,8 @@
 " Returns the buffer number of the terminal.
 "
 " Options is a dictionary, these items are recognized:
+" "keep_t_u7" - when 1 do not make t_u7 empty (resetting t_u7 avoids clearing
+"               parts of line 2 and 3 on the display)
 " "rows" - height of the terminal window (max. 20)
 " "cols" - width of the terminal window (max. 78)
 " "statusoff" - number of lines the status is offset from default
@@ -74,7 +76,13 @@
   let cols = get(a:options, 'cols', 75)
   let statusoff = get(a:options, 'statusoff', 1)
 
-  let cmd = GetVimCommandCleanTerm() .. a:arguments
+  if get(a:options, 'keep_t_u7', 0)
+    let reset_u7 = ''
+  else
+    let reset_u7 = ' --cmd "set t_u7=" '
+  endif
+
+  let cmd = GetVimCommandCleanTerm() .. reset_u7 .. a:arguments
 
   let options = {
 	\ 'curwin': 1,