comparison src/ex_cmds2.c @ 17178:40c4cb095d53 v8.1.1588

patch 8.1.1588: in :let-heredoc line continuation is recognized commit https://github.com/vim/vim/commit/e96a2498f9a2d3e93ac07431f6d4afd77f30afdf Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 25 04:12:16 2019 +0200 patch 8.1.1588: in :let-heredoc line continuation is recognized Problem: In :let-heredoc line continuation is recognized. Solution: Do not consume line continuation. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/4580)
author Bram Moolenaar <Bram@vim.org>
date Tue, 25 Jun 2019 04:15:08 +0200
parents ebe9aab81898
children a5c3d374e1d3
comparison
equal deleted inserted replaced
17177:b58feb1a84f0 17178:40c4cb095d53
369 int save_called_emsg = called_emsg; 369 int save_called_emsg = called_emsg;
370 int save_must_redraw = must_redraw; 370 int save_must_redraw = must_redraw;
371 int save_trylevel = trylevel; 371 int save_trylevel = trylevel;
372 int save_did_throw = did_throw; 372 int save_did_throw = did_throw;
373 int save_ex_pressedreturn = get_pressedreturn(); 373 int save_ex_pressedreturn = get_pressedreturn();
374 int save_may_garbage_collect = may_garbage_collect;
374 except_T *save_current_exception = current_exception; 375 except_T *save_current_exception = current_exception;
375 vimvars_save_T vvsave; 376 vimvars_save_T vvsave;
376 377
377 /* Create a scope for running the timer callback, ignoring most of 378 /* Create a scope for running the timer callback, ignoring most of
378 * the current scope, such as being inside a try/catch. */ 379 * the current scope, such as being inside a try/catch. */
383 did_uncaught_emsg = FALSE; 384 did_uncaught_emsg = FALSE;
384 must_redraw = 0; 385 must_redraw = 0;
385 trylevel = 0; 386 trylevel = 0;
386 did_throw = FALSE; 387 did_throw = FALSE;
387 current_exception = NULL; 388 current_exception = NULL;
389 may_garbage_collect = FALSE;
388 save_vimvars(&vvsave); 390 save_vimvars(&vvsave);
391
389 timer->tr_firing = TRUE; 392 timer->tr_firing = TRUE;
390 timer_callback(timer); 393 timer_callback(timer);
391 timer->tr_firing = FALSE; 394 timer->tr_firing = FALSE;
392 395
393 timer_next = timer->tr_next; 396 timer_next = timer->tr_next;
405 if (must_redraw != 0) 408 if (must_redraw != 0)
406 need_update_screen = TRUE; 409 need_update_screen = TRUE;
407 must_redraw = must_redraw > save_must_redraw 410 must_redraw = must_redraw > save_must_redraw
408 ? must_redraw : save_must_redraw; 411 ? must_redraw : save_must_redraw;
409 set_pressedreturn(save_ex_pressedreturn); 412 set_pressedreturn(save_ex_pressedreturn);
413 may_garbage_collect = save_may_garbage_collect;
410 414
411 /* Only fire the timer again if it repeats and stop_timer() wasn't 415 /* Only fire the timer again if it repeats and stop_timer() wasn't
412 * called while inside the callback (tr_id == -1). */ 416 * called while inside the callback (tr_id == -1). */
413 if (timer->tr_repeat != 0 && timer->tr_id != -1 417 if (timer->tr_repeat != 0 && timer->tr_id != -1
414 && timer->tr_emsg_count < 3) 418 && timer->tr_emsg_count < 3)
3609 #endif 3613 #endif
3610 3614
3611 cookie.conv.vc_type = CONV_NONE; /* no conversion */ 3615 cookie.conv.vc_type = CONV_NONE; /* no conversion */
3612 3616
3613 /* Read the first line so we can check for a UTF-8 BOM. */ 3617 /* Read the first line so we can check for a UTF-8 BOM. */
3614 firstline = getsourceline(0, (void *)&cookie, 0); 3618 firstline = getsourceline(0, (void *)&cookie, 0, TRUE);
3615 if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef 3619 if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
3616 && firstline[1] == 0xbb && firstline[2] == 0xbf) 3620 && firstline[1] == 0xbb && firstline[2] == 0xbf)
3617 { 3621 {
3618 /* Found BOM; setup conversion, skip over BOM and recode the line. */ 3622 /* Found BOM; setup conversion, skip over BOM and recode the line. */
3619 convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc); 3623 convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
3792 * 3796 *
3793 * Return a pointer to the line in allocated memory. 3797 * Return a pointer to the line in allocated memory.
3794 * Return NULL for end-of-file or some error. 3798 * Return NULL for end-of-file or some error.
3795 */ 3799 */
3796 char_u * 3800 char_u *
3797 getsourceline(int c UNUSED, void *cookie, int indent UNUSED) 3801 getsourceline(int c UNUSED, void *cookie, int indent UNUSED, int do_concat)
3798 { 3802 {
3799 struct source_cookie *sp = (struct source_cookie *)cookie; 3803 struct source_cookie *sp = (struct source_cookie *)cookie;
3800 char_u *line; 3804 char_u *line;
3801 char_u *p; 3805 char_u *p;
3802 3806
3831 script_line_start(); 3835 script_line_start();
3832 #endif 3836 #endif
3833 3837
3834 /* Only concatenate lines starting with a \ when 'cpoptions' doesn't 3838 /* Only concatenate lines starting with a \ when 'cpoptions' doesn't
3835 * contain the 'C' flag. */ 3839 * contain the 'C' flag. */
3836 if (line != NULL && (vim_strchr(p_cpo, CPO_CONCAT) == NULL)) 3840 if (line != NULL && do_concat && vim_strchr(p_cpo, CPO_CONCAT) == NULL)
3837 { 3841 {
3838 /* compensate for the one line read-ahead */ 3842 /* compensate for the one line read-ahead */
3839 --sourcing_lnum; 3843 --sourcing_lnum;
3840 3844
3841 // Get the next line and concatenate it when it starts with a 3845 // Get the next line and concatenate it when it starts with a
4210 * message for missing ":endif". 4214 * message for missing ":endif".
4211 * Return FALSE when not sourcing a file. 4215 * Return FALSE when not sourcing a file.
4212 */ 4216 */
4213 int 4217 int
4214 source_finished( 4218 source_finished(
4215 char_u *(*fgetline)(int, void *, int), 4219 char_u *(*fgetline)(int, void *, int, int),
4216 void *cookie) 4220 void *cookie)
4217 { 4221 {
4218 return (getline_equal(fgetline, cookie, getsourceline) 4222 return (getline_equal(fgetline, cookie, getsourceline)
4219 && ((struct source_cookie *)getline_cookie( 4223 && ((struct source_cookie *)getline_cookie(
4220 fgetline, cookie))->finished); 4224 fgetline, cookie))->finished);