summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0571
blob: bdf8e5b0249d87a6d8b2782f004503f08e9a7022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0571
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0571 (after 8.1.0569)
Problem:    Non-silent execute() resets display column to zero.
Solution:   Keep the display column as-is.
Files:	    src/evalfunc.c, src/testdir/test_execute_func.vim


*** ../vim-8.1.0570/src/evalfunc.c	2018-12-07 16:38:20.461472100 +0100
--- src/evalfunc.c	2018-12-08 13:29:07.583916762 +0100
***************
*** 3263,3268 ****
--- 3263,3269 ----
      int		save_redir_off = redir_off;
      garray_T	save_ga;
      int		save_msg_col = msg_col;
+     int		echo_output = FALSE;
  
      rettv->vval.v_string = NULL;
      rettv->v_type = VAR_STRING;
***************
*** 3289,3294 ****
--- 3290,3297 ----
  
  	if (s == NULL)
  	    return;
+ 	if (*s == NUL)
+ 	    echo_output = TRUE;
  	if (STRNCMP(s, "silent", 6) == 0)
  	    ++msg_silent;
  	if (STRCMP(s, "silent!") == 0)
***************
*** 3305,3311 ****
      ga_init2(&redir_execute_ga, (int)sizeof(char), 500);
      redir_execute = TRUE;
      redir_off = FALSE;
!     msg_col = 0;  // prevent leading spaces
  
      if (cmd != NULL)
  	do_cmdline_cmd(cmd);
--- 3308,3315 ----
      ga_init2(&redir_execute_ga, (int)sizeof(char), 500);
      redir_execute = TRUE;
      redir_off = FALSE;
!     if (!echo_output)
! 	msg_col = 0;  // prevent leading spaces
  
      if (cmd != NULL)
  	do_cmdline_cmd(cmd);
***************
*** 3339,3346 ****
      redir_off = save_redir_off;
  
      // "silent reg" or "silent echo x" leaves msg_col somewhere in the line.
!     // Put it back where it was, since nothing should have been written.
!     msg_col = save_msg_col;
  }
  
  /*
--- 3343,3356 ----
      redir_off = save_redir_off;
  
      // "silent reg" or "silent echo x" leaves msg_col somewhere in the line.
!     if (echo_output)
! 	// When not working silently: put it in column zero.  A following
! 	// "echon" will overwrite the message, unavoidably.
! 	msg_col = 0;
!     else
! 	// When working silently: Put it back where it was, since nothing
! 	// should have been written.
! 	msg_col = save_msg_col;
  }
  
  /*
*** ../vim-8.1.0570/src/testdir/test_execute_func.vim	2018-12-07 16:38:20.461472100 +0100
--- src/testdir/test_execute_func.vim	2018-12-08 13:31:33.151013537 +0100
***************
*** 61,63 ****
--- 61,80 ----
    endfor
    call assert_equal('abcdxyz', text)
  endfunc
+ 
+ func Test_execute_not_silent()
+   echo ''
+   echon 'abcd'
+   let x = execute('echon 234', '')
+   echo 'xyz'
+   let text1 = ''
+   for col in range(1, 8)
+     let text1 .= nr2char(screenchar(&lines - 1, col))
+   endfor
+   call assert_equal('abcd234 ', text1)
+   let text2 = ''
+   for col in range(1, 4)
+     let text2 .= nr2char(screenchar(&lines, col))
+   endfor
+   call assert_equal('xyz ', text2)
+ endfunc
*** ../vim-8.1.0570/src/version.c	2018-12-07 21:08:44.775946983 +0100
--- src/version.c	2018-12-08 13:32:59.090476830 +0100
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     571,
  /**/

-- 
            |

Ceci n'est pas une pipe.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///