patch 8.2.2686: status line is not updated when going to cmdline mode

Problem:    Status line is not updated when going to cmdline mode.
Solution:   Redraw status lines if 'statusline' is set and going to status
            line mode. (based on patch from Justin M. Keyes et al.,
            closes #8044)
diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim
index f6c05f6..bbf7ddf 100644
--- a/src/testdir/test_statusline.vim
+++ b/src/testdir/test_statusline.vim
@@ -448,6 +448,27 @@
   call delete('XTest_statusline')
 endfunc
 
+func Test_statusline_using_mode()
+  CheckScreendump
+
+  let lines =<< trim END
+    set laststatus=2
+    let &statusline = '-%{mode()}-'
+  END
+  call writefile(lines, 'XTest_statusline')
+
+  let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 5, 'cols': 50})
+  call VerifyScreenDump(buf, 'Test_statusline_mode_1', {})
+
+  call term_sendkeys(buf, ":")
+  call VerifyScreenDump(buf, 'Test_statusline_mode_2', {})
+
+  " clean up
+  call term_sendkeys(buf, "\<CR>")
+  call StopVimInTerminal(buf)
+  call delete('XTest_statusline')
+endfunc
+
 func Test_statusline_after_split_vsplit()
   only