Mercurial > vim
comparison src/os_unix.c @ 12192:6947d5bcf57f v8.0.0976
patch 8.0.0976: cannot send lines to a terminal job
commit https://github.com/vim/vim/commit/b241208a13d3e9def36d749b1e824ae694aa85f8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 20 18:09:14 2017 +0200
patch 8.0.0976: cannot send lines to a terminal job
Problem: Cannot send lines to a terminal job.
Solution: Make [range]terminal send selected lines to the job.
Use ++rows and ++cols for the terminal size.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 20 Aug 2017 18:15:04 +0200 |
parents | 3bf5fe164a9f |
children | 52eea5b73b2a |
comparison
equal
deleted
inserted
replaced
12191:fee055edaaef | 12192:6947d5bcf57f |
---|---|
5236 int use_null_for_out = options->jo_io[PART_OUT] == JIO_NULL; | 5236 int use_null_for_out = options->jo_io[PART_OUT] == JIO_NULL; |
5237 int use_null_for_err = options->jo_io[PART_ERR] == JIO_NULL; | 5237 int use_null_for_err = options->jo_io[PART_ERR] == JIO_NULL; |
5238 int use_file_for_in = options->jo_io[PART_IN] == JIO_FILE; | 5238 int use_file_for_in = options->jo_io[PART_IN] == JIO_FILE; |
5239 int use_file_for_out = options->jo_io[PART_OUT] == JIO_FILE; | 5239 int use_file_for_out = options->jo_io[PART_OUT] == JIO_FILE; |
5240 int use_file_for_err = options->jo_io[PART_ERR] == JIO_FILE; | 5240 int use_file_for_err = options->jo_io[PART_ERR] == JIO_FILE; |
5241 int use_buffer_for_in = options->jo_io[PART_IN] == JIO_BUFFER; | |
5241 int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT; | 5242 int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT; |
5242 SIGSET_DECL(curset) | 5243 SIGSET_DECL(curset) |
5243 | 5244 |
5244 if (use_out_for_err && use_null_for_out) | 5245 if (use_out_for_err && use_null_for_out) |
5245 use_null_for_err = TRUE; | 5246 use_null_for_err = TRUE; |
5246 | 5247 |
5247 /* default is to fail */ | 5248 /* default is to fail */ |
5248 job->jv_status = JOB_FAILED; | 5249 job->jv_status = JOB_FAILED; |
5249 | 5250 |
5250 if (options->jo_pty) | 5251 if (options->jo_pty |
5252 && (!(use_file_for_in || use_null_for_in) | |
5253 || !(use_file_for_in || use_null_for_out) | |
5254 || !(use_out_for_err || use_file_for_err || use_null_for_err))) | |
5251 open_pty(&pty_master_fd, &pty_slave_fd, &job->jv_tty_name); | 5255 open_pty(&pty_master_fd, &pty_slave_fd, &job->jv_tty_name); |
5252 | 5256 |
5253 /* TODO: without the channel feature connect the child to /dev/null? */ | 5257 /* TODO: without the channel feature connect the child to /dev/null? */ |
5254 /* Open pipes for stdin, stdout, stderr. */ | 5258 /* Open pipes for stdin, stdout, stderr. */ |
5255 if (use_file_for_in) | 5259 if (use_file_for_in) |
5261 { | 5265 { |
5262 EMSG2(_(e_notopen), fname); | 5266 EMSG2(_(e_notopen), fname); |
5263 goto failed; | 5267 goto failed; |
5264 } | 5268 } |
5265 } | 5269 } |
5266 else if (!use_null_for_in && pty_master_fd < 0 && pipe(fd_in) < 0) | 5270 else |
5267 goto failed; | 5271 /* When writing buffer lines to the input don't use the pty, so that |
5272 * the pipe can be closed when all lines were written. */ | |
5273 if (!use_null_for_in && (pty_master_fd < 0 || use_buffer_for_in) | |
5274 && pipe(fd_in) < 0) | |
5275 goto failed; | |
5268 | 5276 |
5269 if (use_file_for_out) | 5277 if (use_file_for_out) |
5270 { | 5278 { |
5271 char_u *fname = options->jo_io_name[PART_OUT]; | 5279 char_u *fname = options->jo_io_name[PART_OUT]; |
5272 | 5280 |