list = list_alloc();
if (list == NULL)
return;
+
+ // yanked text contents
for (n = 0; n < reg->y_size; n++)
list_append_string(list, reg->y_array[n], -1);
list->lv_lock = VAR_FIXED;
(void)dict_add_list(v_event, "regcontents", list);
+ // register name or empty string for unnamed operation
buf[0] = (char_u)oap->regname;
buf[1] = NUL;
(void)dict_add_string(v_event, "regname", buf);
+ // motion type: inclusive or exclusive
+ (void)dict_add_bool(v_event, "inclusive", oap->inclusive);
+
+ // kind of operation (yank, delete, change)
buf[0] = get_op_char(oap->op_type);
buf[1] = get_extra_op_char(oap->op_type);
buf[2] = NUL;
(void)dict_add_string(v_event, "operator", buf);
+ // register type
buf[0] = NUL;
buf[1] = NUL;
switch (get_reg_type(oap->regname, ®len))
}
(void)dict_add_string(v_event, "regtype", buf);
+ // selection type - visual or not
(void)dict_add_bool(v_event, "visual", oap->is_VIsual);
// Lock the dictionary and its keys
norm "ayiw
call assert_equal(
- \{'regcontents': ['foo'], 'regname': 'a', 'operator': 'y', 'regtype': 'v', 'visual': v:false},
- \g:event)
+ \ #{regcontents: ['foo'], regname: 'a', operator: 'y',
+ \ regtype: 'v', visual: v:false, inclusive: v:true},
+ \ g:event)
norm y_
call assert_equal(
- \{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V', 'visual': v:false},
- \g:event)
+ \ #{regcontents: ['foo'], regname: '', operator: 'y', regtype: 'V',
+ \ visual: v:false, inclusive: v:false},
+ \ g:event)
norm Vy
call assert_equal(
- \{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V', 'visual': v:true},
- \g:event)
+ \ #{regcontents: ['foo'], regname: '', operator: 'y', regtype: 'V',
+ \ visual: v:true, inclusive: v:true},
+ \ g:event)
call feedkeys("\<C-V>y", 'x')
call assert_equal(
- \{'regcontents': ['f'], 'regname': '', 'operator': 'y', 'regtype': "\x161", 'visual': v:true},
- \g:event)
+ \ #{regcontents: ['f'], regname: '', operator: 'y', regtype: "\x161",
+ \ visual: v:true, inclusive: v:true},
+ \ g:event)
norm "xciwbar
call assert_equal(
- \{'regcontents': ['foo'], 'regname': 'x', 'operator': 'c', 'regtype': 'v', 'visual': v:false},
- \g:event)
+ \ #{regcontents: ['foo'], regname: 'x', operator: 'c', regtype: 'v',
+ \ visual: v:false, inclusive: v:true},
+ \ g:event)
norm "bdiw
call assert_equal(
- \{'regcontents': ['bar'], 'regname': 'b', 'operator': 'd', 'regtype': 'v', 'visual': v:false},
- \g:event)
+ \ #{regcontents: ['bar'], regname: 'b', operator: 'd', regtype: 'v',
+ \ visual: v:false, inclusive: v:true},
+ \ g:event)
+
+ call setline(1, 'foobar')
+ " exclusive motion
+ norm $"ay0
+ call assert_equal(
+ \ #{regcontents: ['fooba'], regname: 'a', operator: 'y', regtype: 'v',
+ \ visual: v:false, inclusive: v:false},
+ \ g:event)
+ " inclusive motion
+ norm 0"ay$
+ call assert_equal(
+ \ #{regcontents: ['foobar'], regname: 'a', operator: 'y', regtype: 'v',
+ \ visual: v:false, inclusive: v:true},
+ \ g:event)
call assert_equal({}, v:event)
set clipboard=autoselect
exe "norm! ggviw\<Esc>"
call assert_equal(
- \{'regcontents': ['foobar'], 'regname': '*', 'operator': 'y', 'regtype': 'v', 'visual': v:true},
- \g:event)
+ \ #{regcontents: ['foobar'], regname: '*', operator: 'y',
+ \ regtype: 'v', visual: v:true, inclusive: v:false},
+ \ g:event)
let @+ = ''
set clipboard=autoselectplus
exe "norm! ggviw\<Esc>"
call assert_equal(
- \{'regcontents': ['foobar'], 'regname': '+', 'operator': 'y', 'regtype': 'v', 'visual': v:true},
- \g:event)
+ \ #{regcontents: ['foobar'], regname: '+', operator: 'y',
+ \ regtype: 'v', visual: v:true, inclusive: v:false},
+ \ g:event)
set clipboard&vim
endif