A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/f89ca7194f484108529cbb93ef61ce45a9a277b5 below:

event readonly in more events (#18070) · neovim/neovim@f89ca71 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+35

-0

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+35

-0

lines changed Original file line number Diff line number Diff line change

@@ -836,6 +836,7 @@ static void set_info_event(void **argv)

836 836

typval_T retval;

837 837

(void)object_to_vim(DICTIONARY_OBJ(info), &retval, NULL);

838 838

tv_dict_add_dict(dict, S_LEN("info"), retval.vval.v_dict);

839 +

tv_dict_set_keys_readonly(dict);

839 840 840 841

apply_autocmds(event, NULL, NULL, false, curbuf);

841 842 Original file line number Diff line number Diff line change

@@ -944,6 +944,7 @@ int do_record(int c)

944 944

buf[0] = (char)regname;

945 945

buf[1] = NUL;

946 946

(void)tv_dict_add_str(dict, S_LEN("regname"), buf);

947 +

tv_dict_set_keys_readonly(dict);

947 948 948 949

// Get the recorded key hits. K_SPECIAL will be escaped, this

949 950

// needs to be removed again to put it in a register. exec_reg then

Original file line number Diff line number Diff line change

@@ -336,6 +336,7 @@ void terminal_close(Terminal *term, int status)

336 336

save_v_event_T save_v_event;

337 337

dict_T *dict = get_v_event(&save_v_event);

338 338

tv_dict_add_nr(dict, S_LEN("status"), status);

339 +

tv_dict_set_keys_readonly(dict);

339 340

apply_autocmds(EVENT_TERMCLOSE, NULL, NULL, false, buf);

340 341

restore_v_event(dict, &save_v_event);

341 342

}

Original file line number Diff line number Diff line change

@@ -17,6 +17,7 @@ local command = helpers.command

17 17

local exc_exec = helpers.exc_exec

18 18

local exec_lua = helpers.exec_lua

19 19

local curbufmeths = helpers.curbufmeths

20 +

local retry = helpers.retry

20 21

local source = helpers.source

21 22 22 23

describe('autocmd', function()

@@ -439,6 +440,37 @@ describe('autocmd', function()

439 440

]]}

440 441

end)

441 442 443 +

describe('v:event is readonly #18063', function()

444 +

it('during ChanOpen event', function()

445 +

command('autocmd ChanOpen * let v:event.info.id = 0')

446 +

funcs.jobstart({'cat'})

447 +

retry(nil, nil, function()

448 +

eq('E46: Cannot change read-only variable "v:event.info"', meths.get_vvar('errmsg'))

449 +

end)

450 +

end)

451 + 452 +

it('during ChanOpen event', function()

453 +

command('autocmd ChanInfo * let v:event.info.id = 0')

454 +

meths.set_client_info('foo', {}, 'remote', {}, {})

455 +

retry(nil, nil, function()

456 +

eq('E46: Cannot change read-only variable "v:event.info"', meths.get_vvar('errmsg'))

457 +

end)

458 +

end)

459 + 460 +

it('during RecordingLeave event', function()

461 +

command([[autocmd RecordingLeave * let v:event.regname = '']])

462 +

eq('Vim(let):E46: Cannot change read-only variable "v:event.regname"',

463 +

pcall_err(command, 'normal! qqq'))

464 +

end)

465 + 466 +

it('during TermClose event', function()

467 +

command('autocmd TermClose * let v:event.status = 0')

468 +

command('terminal')

469 +

eq('Vim(let):E46: Cannot change read-only variable "v:event.status"',

470 +

pcall_err(command, 'bdelete!'))

471 +

end)

472 +

end)

473 + 442 474

describe('old_tests', function()

443 475

it('vimscript: WinNew ++once', function()

444 476

source [[

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4