summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1118
blob: a5bb18311b6a912cf9ae096a85098870a9347403 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1118
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.1118
Problem:    A couple of conditions are hard to understand.
Solution:   Split the conditions into pieces. (Ozaki Kiichi, closes #3879)
Files:	    src/getchar.c, src/os_unix.c


*** ../vim-8.1.1117/src/getchar.c	2019-03-30 18:46:57.348077402 +0100
--- src/getchar.c	2019-04-04 20:05:56.187300570 +0200
***************
*** 2030,2035 ****
--- 2030,2037 ----
  	     */
  	    for (;;)
  	    {
+ 		long	    wait_time;
+ 
  		/*
  		 * ui_breakcheck() is slow, don't use it too often when
  		 * inside a mapping.  But call it each time for typed
***************
*** 2828,2845 ****
  		    // that has a <Nop> RHS.
  		    timedout = FALSE;
  
  		wait_tb_len = typebuf.tb_len;
  		c = inchar(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len,
  			typebuf.tb_buflen - typebuf.tb_off - typebuf.tb_len - 1,
! 			!advance
! 			    ? 0
! 			    : ((typebuf.tb_len == 0
! 				    || !(p_timeout || (p_ttimeout
! 					       && keylen == KEYLEN_PART_KEY)))
! 				    ? -1L
! 				    : ((keylen == KEYLEN_PART_KEY && p_ttm >= 0)
! 					    ? p_ttm
! 					    : p_tm)));
  
  #ifdef FEAT_CMDL_INFO
  		if (i != 0)
--- 2830,2854 ----
  		    // that has a <Nop> RHS.
  		    timedout = FALSE;
  
+ 		if (advance)
+ 		{
+ 		    if (typebuf.tb_len == 0
+ 			    || !(p_timeout
+ 				 || (p_ttimeout && keylen == KEYLEN_PART_KEY)))
+ 			// blocking wait
+ 			wait_time = -1L;
+ 		    else if (keylen == KEYLEN_PART_KEY && p_ttm >= 0)
+ 			wait_time = p_ttm;
+ 		    else
+ 			wait_time = p_tm;
+ 		}
+ 		else
+ 		    wait_time = 0;
+ 
  		wait_tb_len = typebuf.tb_len;
  		c = inchar(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len,
  			typebuf.tb_buflen - typebuf.tb_off - typebuf.tb_len - 1,
! 			wait_time);
  
  #ifdef FEAT_CMDL_INFO
  		if (i != 0)
*** ../vim-8.1.1117/src/os_unix.c	2019-03-30 18:46:57.360077328 +0100
--- src/os_unix.c	2019-04-04 20:08:33.214471353 +0200
***************
*** 5607,5625 ****
  	close(fd_err[1]);
      if (channel != NULL)
      {
! 	int in_fd = use_file_for_in || use_null_for_in
! 			? INVALID_FD : fd_in[1] < 0 ? pty_master_fd : fd_in[1];
! 	int out_fd = use_file_for_out || use_null_for_out
! 		      ? INVALID_FD : fd_out[0] < 0 ? pty_master_fd : fd_out[0];
! 	/* When using pty_master_fd only set it for stdout, do not duplicate it
! 	 * for stderr, it only needs to be read once. */
! 	int err_fd = use_out_for_err || use_file_for_err || use_null_for_err
! 		      ? INVALID_FD
! 		      : fd_err[0] >= 0
! 		         ? fd_err[0]
! 		         : (out_fd == pty_master_fd
! 				 ? INVALID_FD
! 				 : pty_master_fd);
  
  	channel_set_pipes(channel, in_fd, out_fd, err_fd);
  	channel_set_job(channel, job, options);
--- 5607,5631 ----
  	close(fd_err[1]);
      if (channel != NULL)
      {
! 	int in_fd = INVALID_FD;
! 	int out_fd = INVALID_FD;
! 	int err_fd = INVALID_FD;
! 
! 	if (!(use_file_for_in || use_null_for_in))
! 	    in_fd = fd_in[1] >= 0 ? fd_in[1] : pty_master_fd;
! 
! 	if (!(use_file_for_out || use_null_for_out))
! 	    out_fd = fd_out[0] >= 0 ? fd_out[0] : pty_master_fd;
! 
! 	// When using pty_master_fd only set it for stdout, do not duplicate
! 	// it for stderr, it only needs to be read once.
! 	if (!(use_out_for_err || use_file_for_err || use_null_for_err))
! 	{
! 	    if (fd_err[0] >= 0)
! 		err_fd = fd_err[0];
! 	    else if (out_fd != pty_master_fd)
! 		err_fd = pty_master_fd;
! 	}
  
  	channel_set_pipes(channel, in_fd, out_fd, err_fd);
  	channel_set_job(channel, job, options);
*** ../vim-8.1.1117/src/version.c	2019-04-04 19:06:11.147333162 +0200
--- src/version.c	2019-04-04 20:00:40.008936695 +0200
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1118,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
197. Your desk collapses under the weight of your computer peripherals.

 /// 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    ///