patch 8.1.1281: cannot specify a count with :chistory

Problem:    Cannot specify a count with :chistory.
Solution:   Add a count to :chistory and :lhistory. (Yegappan Lakshmanan,
            closes #4344)
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index 9e420b3..37577f7 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -336,8 +336,8 @@
 			RANGE|BUFNAME|COUNT|EXTRA|TRLBAR,
 			ADDR_OTHER),
 EX(CMD_chistory,	"chistory",	qf_history,
-			TRLBAR,
-			ADDR_NONE),
+			RANGE|COUNT|TRLBAR,
+			ADDR_UNSIGNED),
 EX(CMD_clist,		"clist",	qf_list,
 			BANG|EXTRA|TRLBAR|CMDWIN,
 			ADDR_NONE),
@@ -828,8 +828,8 @@
 			EXTRA|NOTRLCOM|NEEDARG,
 			ADDR_NONE),
 EX(CMD_lhistory,	"lhistory",	qf_history,
-			TRLBAR,
-			ADDR_NONE),
+			RANGE|COUNT|TRLBAR,
+			ADDR_UNSIGNED),
 EX(CMD_ll,		"ll",		ex_cc,
 			RANGE|COUNT|TRLBAR|BANG,
 			ADDR_QUICKFIX),
diff --git a/src/quickfix.c b/src/quickfix.c
index b4497ae..6157650 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -3742,6 +3742,27 @@
     qf_info_T	*qi = qf_cmd_get_stack(eap, FALSE);
     int		i;
 
+    if (eap->addr_count > 0)
+    {
+	if (qi == NULL)
+	{
+	    emsg(_(e_loclist));
+	    return;
+	}
+
+	// Jump to the specified quickfix list
+	if (eap->line2 > 0 && eap->line2 <= qi->qf_listcount)
+	{
+	    qi->qf_curlist = eap->line2 - 1;
+	    qf_msg(qi, qi->qf_curlist, "");
+	    qf_update_buffer(qi, NULL);
+	}
+	else
+	    emsg(_(e_invrange));
+
+	return;
+    }
+
     if (qf_stack_empty(qi))
 	msg(_("No entries"));
     else
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim
index ae3aec5..54c10ad 100644
--- a/src/testdir/test_quickfix.vim
+++ b/src/testdir/test_quickfix.vim
@@ -1831,9 +1831,23 @@
   call assert_equal('  error list 2 of 3; 2 ' . common, res[1])
   call assert_equal('> error list 3 of 3; 3 ' . common, res[2])
 
+  " Test for changing the quickfix lists
+  call assert_equal(3, g:Xgetlist({'nr' : 0}).nr)
+  exe '1' . a:cchar . 'hist'
+  call assert_equal(1, g:Xgetlist({'nr' : 0}).nr)
+  exe '3' . a:cchar . 'hist'
+  call assert_equal(3, g:Xgetlist({'nr' : 0}).nr)
+  call assert_fails('-2' . a:cchar . 'hist', 'E16:')
+  call assert_fails('4' . a:cchar . 'hist', 'E16:')
+
   call g:Xsetlist([], 'f')
   let l = split(execute(a:cchar . 'hist'), "\n")
   call assert_equal('No entries', l[0])
+  if a:cchar == 'c'
+    call assert_fails('4chist', 'E16:')
+  else
+    call assert_fails('4lhist', 'E776:')
+  endif
 
   " An empty list should still show the stack history
   call g:Xsetlist([])
diff --git a/src/version.c b/src/version.c
index 0ba9dd1..f137b83 100644
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1281,
+/**/
     1280,
 /**/
     1279,