updated for version 7.0187
diff --git a/src/buffer.c b/src/buffer.c
index 83c9690..6d654b2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4758,7 +4758,21 @@
 {
 #if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)
     if (bt_quickfix(buf))
-	return _("[Error List]");
+    {
+	win_T	*win;
+
+	/*
+	 * For location list window, w_llist_ref points to the location list.
+	 * For quickfix window, w_llist_ref is NULL.
+	 */
+	FOR_ALL_WINDOWS(win)
+	    if (win->w_buffer == buf)
+		break;
+	if (win != NULL && win->w_llist_ref != NULL)
+	    return _("[Location List]");
+	else
+	    return _("[Error List]");
+    }
 #endif
 #ifdef FEAT_QUICKFIX
     /* There is no _file_ when 'buftype' is "nofile", b_sfname
diff --git a/src/getchar.c b/src/getchar.c
index 5da7537..ff821cb 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2365,7 +2365,7 @@
 		    colnr_T	col = 0, vcol;
 		    char_u	*ptr;
 
-		    if (p_smd && msg_silent == 0)
+		    if (mode_displayed)
 		    {
 			unshowmode(TRUE);
 			mode_deleted = TRUE;
@@ -2643,7 +2643,7 @@
      */
     if (advance && p_smd && msg_silent == 0 && (State & INSERT))
     {
-	if (c == ESC && !mode_deleted && !no_mapping)
+	if (c == ESC && !mode_deleted && !no_mapping && mode_displayed)
 	{
 	    if (typebuf.tb_len && !KeyTyped)
 		redraw_cmdline = TRUE;	    /* delete mode later */
diff --git a/src/mark.c b/src/mark.c
index d3db4a6..f077b11 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -1004,7 +1004,10 @@
 
 #ifdef FEAT_QUICKFIX
 	/* quickfix marks */
-	qf_mark_adjust(line1, line2, amount, amount_after);
+	qf_mark_adjust(NULL, line1, line2, amount, amount_after);
+	/* location lists */
+	FOR_ALL_WINDOWS(win)
+	    qf_mark_adjust(win, line1, line2, amount, amount_after);
 #endif
 
 #ifdef FEAT_SIGNS
diff --git a/src/normal.c b/src/normal.c
index 4d105e7..9e68b2b 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1714,7 +1714,7 @@
 		setmouse();
 		mouse_dragging = 0;
 # endif
-		if (p_smd && msg_silent == 0)
+		if (mode_displayed)
 		    clear_cmdline = TRUE;   /* unshow visual mode later */
 #ifdef FEAT_CMDL_INFO
 		else
@@ -2779,7 +2779,10 @@
     {
 	if (State & INSERT)
 	    stuffcharReadbuff(Ctrl_O);
-	stuffReadbuff((char_u *)":.cc\n");
+	if (curwin->w_llist_ref == NULL)	/* quickfix window */
+	    stuffReadbuff((char_u *)":.cc\n");
+	else					/* location list window */
+	    stuffReadbuff((char_u *)":.ll\n");
 	got_click = FALSE;		/* ignore drag&release now */
     }
 #endif
@@ -2948,8 +2951,9 @@
     }
 
     /* If Visual mode changed show it later. */
-    if (p_smd && msg_silent == 0
-		  && (VIsual_active != old_active || VIsual_mode != old_mode))
+    if ((!VIsual_active && old_active && mode_displayed)
+	    || (VIsual_active && p_smd && msg_silent == 0
+				 && (!old_active || VIsual_mode != old_mode)))
 	redraw_cmdline = TRUE;
 #endif
 
@@ -3115,7 +3119,7 @@
 	curwin->w_cursor.coladd = 0;
 #endif
 
-    if (p_smd && msg_silent == 0)
+    if (mode_displayed)
 	clear_cmdline = TRUE;		/* unshow visual mode later */
 #ifdef FEAT_CMDL_INFO
     else
@@ -5713,7 +5717,10 @@
 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
     /* In a quickfix window a <CR> jumps to the error under the cursor. */
     if (bt_quickfix(curbuf) && cap->cmdchar == CAR)
-	do_cmdline_cmd((char_u *)".cc");
+	if (curwin->w_llist_ref == NULL)
+	    do_cmdline_cmd((char_u *)".cc");	/* quickfix window */
+	else
+	    do_cmdline_cmd((char_u *)".ll");	/* location list window */
     else
 #endif
     {
@@ -8282,7 +8289,7 @@
     if (cap->nchar == Ctrl_N || cap->nchar == Ctrl_G)
     {
 	clearop(cap->oap);
-	if (restart_edit != 0 && p_smd && msg_silent == 0)
+	if (restart_edit != 0 && mode_displayed)
 	    clear_cmdline = TRUE;		/* unshow mode later */
 	restart_edit = 0;
 #ifdef FEAT_CMDWIN
diff --git a/src/window.c b/src/window.c
index bb2647c..6bb9c46 100644
--- a/src/window.c
+++ b/src/window.c
@@ -518,8 +518,9 @@
 		 */
 		if (bt_quickfix(curbuf))
 		{
-		    sprintf((char *)cbuf, "split +%ldcc",
-						 (long)curwin->w_cursor.lnum);
+		    sprintf((char *)cbuf, "split +%ld%s",
+				(long)curwin->w_cursor.lnum,
+				(curwin->w_llist_ref == NULL) ? "cc" : "ll");
 		    do_cmdline_cmd(cbuf);
 		}
 #endif
@@ -817,6 +818,9 @@
 #ifdef FEAT_JUMPLIST
 	copy_jumplist(curwin, wp);
 #endif
+#ifdef FEAT_QUICKFIX
+	copy_loclist(curwin, wp);
+#endif
 	if (curwin->w_localdir != NULL)
 	    wp->w_localdir = vim_strsave(curwin->w_localdir);
 
@@ -3182,6 +3186,10 @@
     free_jumplist(wp);
 #endif
 
+#ifdef FEAT_QUICKFIX
+    qf_free_all(wp);
+#endif
+
 #ifdef FEAT_GUI
     if (gui.in_use)
     {