A RetroSearch Logo

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

Search Query:

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

event in RecordingLeave (#16828) · neovim/neovim@f65b0d4 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+46

-8

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+46

-8

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

@@ -840,6 +840,9 @@ RecordingLeave When a macro stops recording.

840 840

register.

841 841

|reg_recorded()| is only updated after this

842 842

event.

843 +

Sets these |v:event| keys:

844 +

regcontents

845 +

regname

843 846

*SessionLoadPost*

844 847

SessionLoadPost After loading the session file created using

845 848

the |:mksession| command.

Original file line number Diff line number Diff line change

@@ -915,24 +915,39 @@ int do_record(int c)

915 915

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

916 916

}

917 917

} else { // stop recording

918 +

save_v_event_T save_v_event;

919 +

// Set the v:event dictionary with information about the recording.

920 +

dict_T *dict = get_v_event(&save_v_event);

921 + 922 +

// The recorded text contents.

923 +

p = get_recorded();

924 +

if (p != NULL) {

925 +

// Remove escaping for CSI and K_SPECIAL in multi-byte chars.

926 +

vim_unescape_csi(p);

927 +

(void)tv_dict_add_str(dict, S_LEN("regcontents"), (const char *)p);

928 +

}

929 + 930 +

// Name of requested register, or empty string for unnamed operation.

931 +

char buf[NUMBUFLEN+2];

932 +

buf[0] = (char)regname;

933 +

buf[1] = NUL;

934 +

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

935 + 918 936

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

919 937

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

920 938

// adds the escaping back later.

921 939

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

940 +

restore_v_event(dict, &save_v_event);

922 941

reg_recorded = reg_recording;

923 942

reg_recording = 0;

924 943

if (ui_has(kUIMessages)) {

925 944

showmode();

926 945

} else {

927 946

msg("");

928 947

}

929 -

p = get_recorded();

930 948

if (p == NULL) {

931 949

retval = FAIL;

932 950

} else {

933 -

// Remove escaping for CSI and K_SPECIAL in multi-byte chars.

934 -

vim_unescape_csi(p);

935 - 936 951

// We don't want to change the default register here, so save and

937 952

// restore the current register name.

938 953

old_y_previous = y_previous;

Original file line number Diff line number Diff line change

@@ -11,7 +11,7 @@ describe('RecordingEnter', function()

11 11

source_vim [[

12 12

let g:recorded = 0

13 13

autocmd RecordingEnter * let g:recorded += 1

14 -

execute "normal! qqyyq"

14 +

call feedkeys("qqyyq", 'xt')

15 15

]]

16 16

eq(1, eval('g:recorded'))

17 17

end)

@@ -20,7 +20,7 @@ describe('RecordingEnter', function()

20 20

source_vim [[

21 21

let g:recording = ''

22 22

autocmd RecordingEnter * let g:recording = reg_recording()

23 -

execute "normal! qqyyq"

23 +

call feedkeys("qqyyq", 'xt')

24 24

]]

25 25

eq('q', eval('g:recording'))

26 26

end)

@@ -32,7 +32,7 @@ describe('RecordingLeave', function()

32 32

source_vim [[

33 33

let g:recorded = 0

34 34

autocmd RecordingLeave * let g:recorded += 1

35 -

execute "normal! qqyyq"

35 +

call feedkeys("qqyyq", 'xt')

36 36

]]

37 37

eq(1, eval('g:recorded'))

38 38

end)

@@ -43,10 +43,30 @@ describe('RecordingLeave', function()

43 43

let g:recording = ''

44 44

autocmd RecordingLeave * let g:recording = reg_recording()

45 45

autocmd RecordingLeave * let g:recorded = reg_recorded()

46 -

execute "normal! qqyyq"

46 +

call feedkeys("qqyyq", 'xt')

47 47

]]

48 48

eq('q', eval 'g:recording')

49 49

eq('', eval 'g:recorded')

50 50

eq('q', eval 'reg_recorded()')

51 51

end)

52 + 53 +

it('populates v:event', function()

54 +

source_vim [[

55 +

let g:regname = ''

56 +

let g:regcontents = ''

57 +

autocmd RecordingLeave * let g:regname = v:event.regname

58 +

autocmd RecordingLeave * let g:regcontents = v:event.regcontents

59 +

call feedkeys("qqyyq", 'xt')

60 +

]]

61 +

eq('q', eval 'g:regname')

62 +

eq('yy', eval 'g:regcontents')

63 +

end)

64 + 65 +

it('resets v:event', function()

66 +

source_vim [[

67 +

autocmd RecordingLeave * let g:event = v:event

68 +

call feedkeys("qqyyq", 'xt')

69 +

]]

70 +

eq(0, eval 'len(v:event)')

71 +

end)

52 72

end)

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