diff src/mark.c @ 16433:9c206a78ec04 v8.1.1221

patch 8.1.1221: filtering does not work when listing marks commit https://github.com/vim/vim/commit/ad6dc49a7564a99fca36c1928e3865787d3bd5b2 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 27 22:40:08 2019 +0200 patch 8.1.1221: filtering does not work when listing marks Problem: Filtering does not work when listing marks. Solution: Implement filtering marks. (Marcin Szamotulski, closes https://github.com/vim/vim/issues/3895)
author Bram Moolenaar <Bram@vim.org>
date Sat, 27 Apr 2019 22:45:05 +0200
parents dd4e6f077874
children 7e733046db1d
line wrap: on
line diff
--- a/src/mark.c
+++ b/src/mark.c
@@ -744,11 +744,12 @@ show_one_mark(
     int		c,
     char_u	*arg,
     pos_T	*p,
-    char_u	*name,
+    char_u	*name_arg,
     int		current)	/* in current file */
 {
     static int	did_title = FALSE;
     int		mustfree = FALSE;
+    char_u	*name = name_arg;
 
     if (c == -1)			    /* finish up */
     {
@@ -762,35 +763,38 @@ show_one_mark(
 		semsg(_("E283: No marks matching \"%s\""), arg);
 	}
     }
-    /* don't output anything if 'q' typed at --more-- prompt */
+    // don't output anything if 'q' typed at --more-- prompt
     else if (!got_int
 	    && (arg == NULL || vim_strchr(arg, c) != NULL)
 	    && p->lnum != 0)
     {
-	if (!did_title)
+	if (name == NULL && current)
 	{
-	    /* Highlight title */
-	    msg_puts_title(_("\nmark line  col file/text"));
-	    did_title = TRUE;
+	    name = mark_line(p, 15);
+	    mustfree = TRUE;
 	}
-	msg_putchar('\n');
-	if (!got_int)
+	if (!message_filtered(name))
 	{
-	    sprintf((char *)IObuff, " %c %6ld %4d ", c, p->lnum, p->col);
-	    msg_outtrans(IObuff);
-	    if (name == NULL && current)
+	    if (!did_title)
 	    {
-		name = mark_line(p, 15);
-		mustfree = TRUE;
+		// Highlight title
+		msg_puts_title(_("\nmark line  col file/text"));
+		did_title = TRUE;
 	    }
-	    if (name != NULL)
+	    msg_putchar('\n');
+	    if (!got_int)
 	    {
-		msg_outtrans_attr(name, current ? HL_ATTR(HLF_D) : 0);
-		if (mustfree)
-		    vim_free(name);
+		sprintf((char *)IObuff, " %c %6ld %4d ", c, p->lnum, p->col);
+		msg_outtrans(IObuff);
+		if (name != NULL)
+		{
+		    msg_outtrans_attr(name, current ? HL_ATTR(HLF_D) : 0);
+		}
 	    }
+	    out_flush();		    // show one line at a time
 	}
-	out_flush();		    /* show one line at a time */
+	if (mustfree)
+	    vim_free(name);
     }
 }