Skip to content

Commit 90a265c

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 724ee2b + e0ab979 commit 90a265c

File tree

8 files changed

+48
-27
lines changed

8 files changed

+48
-27
lines changed

src/macros.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@
191191
# ifndef WIN32
192192
# define mch_access(n, p) access((n), (p))
193193
# endif
194-
# if !(defined(FEAT_MBYTE) && defined(WIN3264))
195-
# define mch_fopen(n, p) fopen((n), (p))
196-
# endif
197194
# define mch_fstat(n, p) fstat((n), (p))
198195
# ifdef MSWIN /* has it's own mch_stat() function */
199196
# define mch_stat(n, p) vim_stat((n), (p))
@@ -223,10 +220,6 @@
223220
* but it is not recommended, because it can destroy indexes etc.
224221
*/
225222
# define mch_open(n, m, p) open(vms_fixfilename(n), (m), (p))
226-
# else
227-
# if !(defined(FEAT_MBYTE) && defined(WIN3264))
228-
# define mch_open(n, m, p) open((n), (m), (p))
229-
# endif
230223
# endif
231224
#endif
232225

src/os_unix.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5338,6 +5338,17 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
53385338
if (use_null_for_in || use_null_for_out || use_null_for_err)
53395339
null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0);
53405340

5341+
if (pty_slave_fd >= 0)
5342+
{
5343+
/* push stream discipline modules */
5344+
SetupSlavePTY(pty_slave_fd);
5345+
# ifdef TIOCSCTTY
5346+
/* Try to become controlling tty (probably doesn't work,
5347+
* unless run by root) */
5348+
ioctl(pty_slave_fd, TIOCSCTTY, (char *)NULL);
5349+
# endif
5350+
}
5351+
53415352
/* set up stdin for the child */
53425353
close(0);
53435354
if (use_null_for_in && null_fd >= 0)
@@ -5384,24 +5395,13 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options)
53845395
close(fd_err[1]);
53855396
if (pty_master_fd >= 0)
53865397
{
5387-
close(pty_master_fd); /* not used */
5388-
close(pty_slave_fd); /* duped above */
5398+
close(pty_master_fd); /* not used in the child */
5399+
close(pty_slave_fd); /* was duped above */
53895400
}
53905401

53915402
if (null_fd >= 0)
53925403
close(null_fd);
53935404

5394-
if (pty_slave_fd >= 0)
5395-
{
5396-
/* push stream discipline modules */
5397-
SetupSlavePTY(pty_slave_fd);
5398-
# ifdef TIOCSCTTY
5399-
/* Try to become controlling tty (probably doesn't work,
5400-
* unless run by root) */
5401-
ioctl(pty_slave_fd, TIOCSCTTY, (char *)NULL);
5402-
# endif
5403-
}
5404-
54055405
/* See above for type of argv. */
54065406
execvp(argv[0], argv);
54075407

src/os_win32.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ typedef int HICON;
111111
typedef int HINSTANCE;
112112
typedef int HWND;
113113
typedef int INPUT_RECORD;
114+
typedef int INT;
114115
typedef int KEY_EVENT_RECORD;
115116
typedef int LOGFONT;
116117
typedef int LPBOOL;
@@ -657,13 +658,13 @@ null_libintl_textdomain(const char *domainname UNUSED)
657658
return NULL;
658659
}
659660

660-
int
661+
static int
661662
null_libintl_putenv(const char *envstring UNUSED)
662663
{
663664
return 0;
664665
}
665666

666-
int
667+
static int
667668
null_libintl_wputenv(const wchar_t *envstring UNUSED)
668669
{
669670
return 0;
@@ -6503,7 +6504,7 @@ mch_access(char *n, int p)
65036504
* Version of open() that may use UTF-16 file name.
65046505
*/
65056506
int
6506-
mch_open(char *name, int flags, int mode)
6507+
mch_open(const char *name, int flags, int mode)
65076508
{
65086509
/* _wopen() does not work with Borland C 5.5: creates a read-only file. */
65096510
# ifndef __BORLANDC__
@@ -6536,7 +6537,7 @@ mch_open(char *name, int flags, int mode)
65366537
* Version of fopen() that may use UTF-16 file name.
65376538
*/
65386539
FILE *
6539-
mch_fopen(char *name, char *mode)
6540+
mch_fopen(const char *name, const char *mode)
65406541
{
65416542
WCHAR *wn, *wm;
65426543
FILE *f = NULL;

src/proto/os_win32.pro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ int mch_wrename(WCHAR *wold, WCHAR *wnew);
5656
int mch_rename(const char *pszOldFile, const char *pszNewFile);
5757
char *default_shell(void);
5858
int mch_access(char *n, int p);
59-
int mch_open(char *name, int flags, int mode);
60-
FILE *mch_fopen(char *name, char *mode);
59+
int mch_open(const char *name, int flags, int mode);
60+
FILE *mch_fopen(const char *name, const char *mode);
6161
int mch_copy_file_attribute(char_u *from, char_u *to);
6262
int myresetstkoflw(void);
6363
int get_cmd_argsW(char ***argvp);

src/terminal.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ terminal_loop(void)
973973
/* We don't know if the job can handle CTRL-C itself or not, this
974974
* may kill the shell instead of killing the command running in the
975975
* shell. */
976-
mch_stop_job(curbuf->b_term->tl_job, "quit")
976+
mch_stop_job(curbuf->b_term->tl_job, (char_u *)"quit")
977977
#endif
978978

979979
if (c == (termkey == 0 ? Ctrl_W : termkey))
@@ -1852,6 +1852,8 @@ f_term_getline(typval_T *argvars, typval_T *rettv)
18521852
int len;
18531853
char_u *p;
18541854

1855+
if (row < 0 || row >= term->tl_rows)
1856+
return;
18551857
len = term->tl_cols * MB_MAXBYTES + 1;
18561858
p = alloc(len);
18571859
if (p == NULL)

src/testdir/test_terminal.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ func Test_terminal_hide_buffer()
8181
endfunc
8282

8383
func Check_123(buf)
84+
let l = term_scrape(a:buf, 0)
85+
call assert_true(len(l) == 0)
86+
let l = term_scrape(a:buf, 999)
87+
call assert_true(len(l) == 0)
8488
let l = term_scrape(a:buf, 1)
8589
call assert_true(len(l) > 0)
8690
call assert_equal('1', l[0].chars)
@@ -93,6 +97,12 @@ func Check_123(buf)
9397
call assert_equal('#000000', l[0].bg)
9498
endif
9599

100+
let l = term_getline(a:buf, -1)
101+
call assert_equal('', l)
102+
let l = term_getline(a:buf, 0)
103+
call assert_equal('', l)
104+
let l = term_getline(a:buf, 999)
105+
call assert_equal('', l)
96106
let l = term_getline(a:buf, 1)
97107
call assert_equal('123', l)
98108
endfunc

src/version.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,16 @@ static char *(features[]) =
784784

785785
static int included_patches[] =
786786
{ /* Add new patch number below this line */
787+
/**/
788+
844,
789+
/**/
790+
843,
791+
/**/
792+
842,
793+
/**/
794+
841,
795+
/**/
796+
840,
787797
/**/
788798
839,
789799
/**/

src/vim.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,6 +2144,11 @@ typedef enum {
21442144
# define number_width(x) 7
21452145
#endif
21462146

2147+
/* This must come after including proto.h */
2148+
#if !(defined(FEAT_MBYTE) && defined(WIN3264))
2149+
# define mch_open(n, m, p) open((n), (m), (p))
2150+
# define mch_fopen(n, p) fopen((n), (p))
2151+
#endif
21472152

21482153
#include "globals.h" /* global variables and messages */
21492154

0 commit comments

Comments
 (0)