Mercurial > vim
comparison src/fileio.c @ 14700:0a3b9ecf7cb8 v8.1.0362
patch 8.1.0362: cannot get the script line number when executing a function
commit https://github.com/vim/vim/commit/f29c1c6aa3f365c025890fab5fb9efbe88eb1761
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Sep 10 21:05:02 2018 +0200
patch 8.1.0362: cannot get the script line number when executing a function
Problem: Cannot get the script line number when executing a function.
Solution: Store the line number besides the script ID. (Ozaki Kiichi,
closes #3362) Also display the line number with ":verbose set".
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 10 Sep 2018 21:15:07 +0200 |
parents | c8f07e8b273e |
children | 193471015e1a |
comparison
equal
deleted
inserted
replaced
14699:2d2a36710dad | 14700:0a3b9ecf7cb8 |
---|---|
7698 char_u *cmd; /* The command to be executed (NULL | 7698 char_u *cmd; /* The command to be executed (NULL |
7699 when command has been removed) */ | 7699 when command has been removed) */ |
7700 char nested; /* If autocommands nest here */ | 7700 char nested; /* If autocommands nest here */ |
7701 char last; /* last command in list */ | 7701 char last; /* last command in list */ |
7702 #ifdef FEAT_EVAL | 7702 #ifdef FEAT_EVAL |
7703 scid_T scriptID; /* script ID where defined */ | 7703 sctx_T script_ctx; /* script context where defined */ |
7704 #endif | 7704 #endif |
7705 struct AutoCmd *next; /* Next AutoCmd in list */ | 7705 struct AutoCmd *next; /* Next AutoCmd in list */ |
7706 } AutoCmd; | 7706 } AutoCmd; |
7707 | 7707 |
7708 typedef struct AutoPat | 7708 typedef struct AutoPat |
7960 if (got_int) | 7960 if (got_int) |
7961 return; | 7961 return; |
7962 msg_outtrans(ac->cmd); | 7962 msg_outtrans(ac->cmd); |
7963 #ifdef FEAT_EVAL | 7963 #ifdef FEAT_EVAL |
7964 if (p_verbose > 0) | 7964 if (p_verbose > 0) |
7965 last_set_msg(ac->scriptID); | 7965 last_set_msg(ac->script_ctx); |
7966 #endif | 7966 #endif |
7967 if (got_int) | 7967 if (got_int) |
7968 return; | 7968 return; |
7969 if (ac->next != NULL) | 7969 if (ac->next != NULL) |
7970 { | 7970 { |
8843 ac = (AutoCmd *)alloc((unsigned)sizeof(AutoCmd)); | 8843 ac = (AutoCmd *)alloc((unsigned)sizeof(AutoCmd)); |
8844 if (ac == NULL) | 8844 if (ac == NULL) |
8845 return FAIL; | 8845 return FAIL; |
8846 ac->cmd = vim_strsave(cmd); | 8846 ac->cmd = vim_strsave(cmd); |
8847 #ifdef FEAT_EVAL | 8847 #ifdef FEAT_EVAL |
8848 ac->scriptID = current_SID; | 8848 ac->script_ctx = current_sctx; |
8849 ac->script_ctx.sc_lnum += sourcing_lnum; | |
8849 #endif | 8850 #endif |
8850 if (ac->cmd == NULL) | 8851 if (ac->cmd == NULL) |
8851 { | 8852 { |
8852 vim_free(ac); | 8853 vim_free(ac); |
8853 return FAIL; | 8854 return FAIL; |
9410 int save_autocmd_nested; | 9411 int save_autocmd_nested; |
9411 static int nesting = 0; | 9412 static int nesting = 0; |
9412 AutoPatCmd patcmd; | 9413 AutoPatCmd patcmd; |
9413 AutoPat *ap; | 9414 AutoPat *ap; |
9414 #ifdef FEAT_EVAL | 9415 #ifdef FEAT_EVAL |
9415 scid_T save_current_SID; | 9416 sctx_T save_current_sctx; |
9416 void *save_funccalp; | 9417 void *save_funccalp; |
9417 char_u *save_cmdarg; | 9418 char_u *save_cmdarg; |
9418 long save_cmdbang; | 9419 long save_cmdbang; |
9419 #endif | 9420 #endif |
9420 static int filechangeshell_busy = FALSE; | 9421 static int filechangeshell_busy = FALSE; |
9619 sourcing_name = NULL; /* don't free this one */ | 9620 sourcing_name = NULL; /* don't free this one */ |
9620 save_sourcing_lnum = sourcing_lnum; | 9621 save_sourcing_lnum = sourcing_lnum; |
9621 sourcing_lnum = 0; /* no line number here */ | 9622 sourcing_lnum = 0; /* no line number here */ |
9622 | 9623 |
9623 #ifdef FEAT_EVAL | 9624 #ifdef FEAT_EVAL |
9624 save_current_SID = current_SID; | 9625 save_current_sctx = current_sctx; |
9625 | 9626 |
9626 # ifdef FEAT_PROFILE | 9627 # ifdef FEAT_PROFILE |
9627 if (do_profiling == PROF_YES) | 9628 if (do_profiling == PROF_YES) |
9628 prof_child_enter(&wait_time); /* doesn't count for the caller itself */ | 9629 prof_child_enter(&wait_time); /* doesn't count for the caller itself */ |
9629 # endif | 9630 # endif |
9723 autocmd_fname = save_autocmd_fname; | 9724 autocmd_fname = save_autocmd_fname; |
9724 autocmd_fname_full = save_autocmd_fname_full; | 9725 autocmd_fname_full = save_autocmd_fname_full; |
9725 autocmd_bufnr = save_autocmd_bufnr; | 9726 autocmd_bufnr = save_autocmd_bufnr; |
9726 autocmd_match = save_autocmd_match; | 9727 autocmd_match = save_autocmd_match; |
9727 #ifdef FEAT_EVAL | 9728 #ifdef FEAT_EVAL |
9728 current_SID = save_current_SID; | 9729 current_sctx = save_current_sctx; |
9729 restore_funccal(save_funccalp); | 9730 restore_funccal(save_funccalp); |
9730 # ifdef FEAT_PROFILE | 9731 # ifdef FEAT_PROFILE |
9731 if (do_profiling == PROF_YES) | 9732 if (do_profiling == PROF_YES) |
9732 prof_child_exit(&wait_time); | 9733 prof_child_exit(&wait_time); |
9733 # endif | 9734 # endif |
9947 verbose_leave_scroll(); | 9948 verbose_leave_scroll(); |
9948 } | 9949 } |
9949 retval = vim_strsave(ac->cmd); | 9950 retval = vim_strsave(ac->cmd); |
9950 autocmd_nested = ac->nested; | 9951 autocmd_nested = ac->nested; |
9951 #ifdef FEAT_EVAL | 9952 #ifdef FEAT_EVAL |
9952 current_SID = ac->scriptID; | 9953 current_sctx = ac->script_ctx; |
9953 #endif | 9954 #endif |
9954 if (ac->last) | 9955 if (ac->last) |
9955 acp->nextcmd = NULL; | 9956 acp->nextcmd = NULL; |
9956 else | 9957 else |
9957 acp->nextcmd = ac->next; | 9958 acp->nextcmd = ac->next; |