To: vim_dev@googlegroups.com Subject: Patch 8.0.1624 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1624 Problem: Options for term_dumpdiff() and term_dumpload() not implemented yet. Solution: Implement the relevant options. Files: src/terminal.c, runtime/doc/eval.txt *** ../vim-8.0.1623/src/terminal.c 2018-03-18 19:19:33.266818628 +0100 --- src/terminal.c 2018-03-20 18:29:12.731966768 +0100 *************** *** 342,347 **** --- 342,348 ---- buf_T *old_curbuf = NULL; int res; buf_T *newbuf; + int vertical = opt->jo_vertical || (cmdmod.split & WSP_VERT); if (check_restricted() || check_secure()) return NULL; *************** *** 411,427 **** split_ea.cmdidx = CMD_new; split_ea.cmd = (char_u *)"new"; split_ea.arg = (char_u *)""; ! if (opt->jo_term_rows > 0 && !(cmdmod.split & WSP_VERT)) { split_ea.line2 = opt->jo_term_rows; split_ea.addr_count = 1; } ! if (opt->jo_term_cols > 0 && (cmdmod.split & WSP_VERT)) { split_ea.line2 = opt->jo_term_cols; split_ea.addr_count = 1; } ex_splitview(&split_ea); if (curwin == old_curwin) { --- 412,430 ---- split_ea.cmdidx = CMD_new; split_ea.cmd = (char_u *)"new"; split_ea.arg = (char_u *)""; ! if (opt->jo_term_rows > 0 && !vertical) { split_ea.line2 = opt->jo_term_rows; split_ea.addr_count = 1; } ! if (opt->jo_term_cols > 0 && vertical) { split_ea.line2 = opt->jo_term_cols; split_ea.addr_count = 1; } + if (vertical) + cmdmod.split |= WSP_VERT; ex_splitview(&split_ea); if (curwin == old_curwin) { *************** *** 437,447 **** { /* Only one size was taken care of with :new, do the other one. With * "curwin" both need to be done. */ ! if (opt->jo_term_rows > 0 && (opt->jo_curwin ! || (cmdmod.split & WSP_VERT))) win_setheight(opt->jo_term_rows); ! if (opt->jo_term_cols > 0 && (opt->jo_curwin ! || !(cmdmod.split & WSP_VERT))) win_setwidth(opt->jo_term_cols); } --- 440,448 ---- { /* Only one size was taken care of with :new, do the other one. With * "curwin" both need to be done. */ ! if (opt->jo_term_rows > 0 && (opt->jo_curwin || vertical)) win_setheight(opt->jo_term_rows); ! if (opt->jo_term_cols > 0 && (opt->jo_curwin || !vertical)) win_setwidth(opt->jo_term_cols); } *************** *** 3732,3737 **** --- 3733,3739 ---- char_u buf2[NUMBUFLEN]; char_u *fname1; char_u *fname2 = NULL; + char_u *fname_tofree = NULL; FILE *fd1; FILE *fd2 = NULL; char_u *textline = NULL; *************** *** 3763,3772 **** } init_job_options(&opt); ! /* TODO: use the {options} argument */ ! /* TODO: use the file name arguments for the buffer name */ ! opt.jo_term_name = (char_u *)"dump diff"; buf = term_start(&argvars[0], NULL, &opt, TERM_START_NOJOB); if (buf != NULL && buf->b_term != NULL) --- 3765,3787 ---- } init_job_options(&opt); ! if (argvars[do_diff ? 2 : 1].v_type != VAR_UNKNOWN ! && get_job_options(&argvars[do_diff ? 2 : 1], &opt, 0, ! JO2_TERM_NAME + JO2_TERM_COLS + JO2_TERM_ROWS ! + JO2_VERTICAL + JO2_CURWIN + JO2_NORESTORE) == FAIL) ! goto theend; ! if (opt.jo_term_name == NULL) ! { ! int len = STRLEN(fname1) + 12; ! ! fname_tofree = alloc(len); ! if (fname_tofree != NULL) ! { ! vim_snprintf((char *)fname_tofree, len, "dump diff %s", fname1); ! opt.jo_term_name = fname_tofree; ! } ! } buf = term_start(&argvars[0], NULL, &opt, TERM_START_NOJOB); if (buf != NULL && buf->b_term != NULL) *************** *** 3937,3942 **** --- 3952,3958 ---- theend: vim_free(textline); + vim_free(fname_tofree); fclose(fd1); if (fd2 != NULL) fclose(fd2); *************** *** 4541,4548 **** + JO2_NORESTORE + JO2_TERM_KILL) == FAIL) return; - if (opt.jo_vertical) - cmdmod.split = WSP_VERT; buf = term_start(&argvars[0], NULL, &opt, 0); if (buf != NULL && buf->b_term != NULL) --- 4557,4562 ---- *** ../vim-8.0.1623/runtime/doc/eval.txt 2018-03-10 20:27:32.075757637 +0100 --- runtime/doc/eval.txt 2018-03-20 18:09:32.317642019 +0100 *************** *** 8132,8138 **** the second file. The middle part shows the differences. The parts are separated by a line of dashes. ! {options} are not implemented yet. Each character in the middle part indicates a difference. If there are multiple differences only the first in this list is --- 8190,8209 ---- the second file. The middle part shows the differences. The parts are separated by a line of dashes. ! If the {options} argument is present, it must be a Dict with ! these possible members: ! "term_name" name to use for the buffer name, instead ! of the first file name. ! "term_rows" vertical size to use for the terminal, ! instead of using 'termsize' ! "term_cols" horizontal size to use for the terminal, ! instead of using 'termsize' ! "vertical" split the window vertically ! "curwin" use the current window, do not split the ! window; fails if the current buffer ! cannot be |abandon|ed ! "norestore" do not add the terminal window to a ! session file Each character in the middle part indicates a difference. If there are multiple differences only the first in this list is *************** *** 8155,8167 **** Returns the buffer number or zero when it fails. Also see |terminal-diff|. ! {options} are not implemented yet. *term_dumpwrite()* term_dumpwrite({buf}, {filename} [, {options}]) Dump the contents of the terminal screen of {buf} in the file {filename}. This uses a format that can be used with ! |term_dumpread()| and |term_dumpdiff()|. If {filename} already exists an error is given. *E953* Also see |terminal-diff|. --- 8226,8238 ---- Returns the buffer number or zero when it fails. Also see |terminal-diff|. ! For {options} see |term_dumpdiff()|. *term_dumpwrite()* term_dumpwrite({buf}, {filename} [, {options}]) Dump the contents of the terminal screen of {buf} in the file {filename}. This uses a format that can be used with ! |term_dumpload()| and |term_dumpdiff()|. If {filename} already exists an error is given. *E953* Also see |terminal-diff|. *** ../vim-8.0.1623/src/version.c 2018-03-20 17:42:56.502284457 +0100 --- src/version.c 2018-03-20 18:08:40.097927574 +0100 *************** *** 768,769 **** --- 768,771 ---- { /* Add new patch number below this line */ + /**/ + 1624, /**/ -- My sister Cecilia opened a computer store in Hawaii. She sells C shells by the seashore. /// 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 ///