• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision023b91234643d148acc0b0aac3fff7ed6df0c427 (tree)
l'heure2022-06-22 16:32:02
Auteurbadcoff33 <none@none>
Commiterbadcoff33

Message de Log

work of TextYankPost feature

Change Summary

Modification

--- a/autoload/visuals.vim
+++ b/autoload/visuals.vim
@@ -64,22 +64,26 @@ function visuals#blend_down()
6464 endif
6565 endfunction
6666
67-function! visuals#blink_on_yank_now()
68- call prop_type_delete('TP_Visual')
69- call prop_type_add('TP_Visual', #{ highlight: 'Visual' })
70- let al = getpos("'[")[1]
71- let ac = getpos("'[")[2]
72- let bl = getpos("']")[1]
73- let bc = getpos("']")[2]
74- let ac = (ac > 1000) ? 1 : ac
75- let bc = (bc > 1000) ? len(getline(bl)) : bc
76- call prop_add_list(
77- \ #{bufnr: bufnr("%"), id: 1, type: 'TP_Visual'},
78- \ [[al, ac, bl, bc + 1]])
79- call timer_start(200, "BlinkOffYank", {'repeat': 1})
67+" avoid error 2nd from prop_type_add by delete it first
68+call prop_type_delete('text_prop_yank')
69+call prop_type_add('text_prop_yank', #{ highlight: 'CursorLine' })
70+
71+function! visuals#blink_on_yank_now(lead_pos, trail_pos)
72+ if v:event['visual'] == v:true
73+ return
74+ endif
75+ if v:event['operator'] == 'd'
76+ return
77+ endif
78+ if a:trail_pos[2] == 0x7fffffff
79+ let sp = len(getline(a:trail_pos[1]))
80+ else
81+ let sp = a:trail_pos[2]
82+ endif
83+ call prop_add_list(#{bufnr: bufnr("%"), id: 1, type: 'text_prop_yank'}, [[a:lead_pos[1], a:lead_pos[2], a:trail_pos[1], sp + 1]])
84+ call timer_start(200, "visuals#blink_on_yank_off", {'repeat': 1})
8085 endfunction
8186
8287 function! visuals#blink_on_yank_off(tid)
8388 call prop_clear(1, line("$"))
84- call prop_type_delete('TP_Visual')
8589 endfunction
--- a/plugin/visuals.vim
+++ b/plugin/visuals.vim
@@ -13,6 +13,6 @@ augroup END
1313 noremap <Leader><Leader> <cmd>HlWord<CR>
1414
1515 autocmd! TextYankPost
16-autocmd TextYankPost * call visuals#blink_on_yank_now()
16+autocmd TextYankPost * call visuals#blink_on_yank_now(getpos("'["), getpos("']"))
1717
1818 BlinkyOn " default to ON
--- a/vimrc
+++ b/vimrc
@@ -248,31 +248,6 @@ let g:term = &term
248248 syntax on
249249
250250 runtime plugins.vim
251-function! BlinkOnYank()
252- let ml = getmarklist("%")
253- for e in ml
254- if e["mark"] == "'["
255- let lead_pos = e["pos"]
256- endif
257- if e["mark"] == "']"
258- let trail_pos = e["pos"]
259- endif
260- endfor
261- call prop_type_delete('TP_Visual')
262- call prop_type_add('TP_Visual', #{ highlight: 'Visual' })
263- if trail_pos[2] == -2147483648
264- let sp = len(getline(trail_pos[1]))
265- else
266- let sp = trail_pos[2]
267- endif
268- call prop_add_list(#{bufnr: bufnr("%"), id: 1, type: 'TP_Visual'}, [[lead_pos[1], lead_pos[2], trail_pos[1], sp + 1]])
269- call timer_start(200, "BlinkOffYank", {'repeat': 1})
270-endfunction
271-function! BlinkOffYank(tid)
272- call prop_clear(1, line("$"))
273- call prop_type_delete('TP_Visual')
274-endfunction
275-autocmd! TextYankPost
276-autocmd TextYankPost * call BlinkOnYank()
251+
277252 " vim:sw=2:tw=78:nocindent:foldmethod=marker:nofen:
278253