patch 8.0.0957: a terminal job can deadlock when sending many keys

Problem:    When term_sendkeys() sends many keys it may get stuck in writing
            to the job.
Solution:   Make the write non-blocking, buffer keys to be sent.
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index fe3d7df..c75d07f 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -450,3 +450,16 @@
   exe buf . 'bwipe!'
   call assert_equal("", bufname(buf))
 endfunction
+
+func Test_terminal_noblock()
+  let buf = term_start(&shell)
+
+  for c in ['a','b','c','d','e','f','g','h','i','j','k']
+    call term_sendkeys(buf, 'echo ' . repeat(c, 5000) . "\<cr>")
+  endfor
+
+  let g:job = term_getjob(buf)
+  call Stop_shell_in_terminal(buf)
+  call term_wait(buf)
+  bwipe
+endfunc