comparison src/ex_docmd.c @ 21594:5daca8504c63 v8.2.1347

patch 8.2.1347: cannot easily get the script ID Commit: https://github.com/vim/vim/commit/909443028b57d7514ce3c71f00e9d808f2126b4f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 1 20:45:11 2020 +0200 patch 8.2.1347: cannot easily get the script ID Problem: Cannot easily get the script ID. Solution: Support expand('<SID>').
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Aug 2020 21:00:04 +0200
parents 7d721e95dc51
children c18d00494b60
comparison
equal deleted inserted replaced
21593:6015f5f423ba 21594:5daca8504c63
8300 #define SPEC_ABUF (SPEC_AFILE + 1) 8300 #define SPEC_ABUF (SPEC_AFILE + 1)
8301 "<amatch>", // autocommand match name 8301 "<amatch>", // autocommand match name
8302 #define SPEC_AMATCH (SPEC_ABUF + 1) 8302 #define SPEC_AMATCH (SPEC_ABUF + 1)
8303 "<sflnum>", // script file line number 8303 "<sflnum>", // script file line number
8304 #define SPEC_SFLNUM (SPEC_AMATCH + 1) 8304 #define SPEC_SFLNUM (SPEC_AMATCH + 1)
8305 "<SID>", // script ID: <SNR>123_
8306 #define SPEC_SID (SPEC_SFLNUM + 1)
8305 #ifdef FEAT_CLIENTSERVER 8307 #ifdef FEAT_CLIENTSERVER
8306 "<client>" 8308 "<client>"
8307 # define SPEC_CLIENT (SPEC_SFLNUM + 1) 8309 # define SPEC_CLIENT (SPEC_SID + 1)
8308 #endif 8310 #endif
8309 }; 8311 };
8310 8312
8311 for (i = 0; i < (int)(sizeof(spec_str) / sizeof(char *)); ++i) 8313 for (i = 0; i < (int)(sizeof(spec_str) / sizeof(char *)); ++i)
8312 { 8314 {
8578 sprintf((char *)strbuf, "%ld", 8580 sprintf((char *)strbuf, "%ld",
8579 (long)(current_sctx.sc_lnum + SOURCING_LNUM)); 8581 (long)(current_sctx.sc_lnum + SOURCING_LNUM));
8580 result = strbuf; 8582 result = strbuf;
8581 break; 8583 break;
8582 #endif 8584 #endif
8585
8586 case SPEC_SID:
8587 if (current_sctx.sc_sid <= 0)
8588 {
8589 *errormsg = _(e_usingsid);
8590 return NULL;
8591 }
8592 sprintf((char *)strbuf, "<SNR>%d_", current_sctx.sc_sid);
8593 result = strbuf;
8594 break;
8583 8595
8584 #ifdef FEAT_CLIENTSERVER 8596 #ifdef FEAT_CLIENTSERVER
8585 case SPEC_CLIENT: // Source of last submitted input 8597 case SPEC_CLIENT: // Source of last submitted input
8586 sprintf((char *)strbuf, PRINTF_HEX_LONG_U, 8598 sprintf((char *)strbuf, PRINTF_HEX_LONG_U,
8587 (long_u)clientWindow); 8599 (long_u)clientWindow);