mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
updated for version 7.4.396
Problem: When 'clipboard' is "unnamed", :g/pat/d is very slow. (Praful) Solution: Only set the clipboard after the last delete. (Christian Brabandt)
This commit is contained in:
54
src/ui.c
54
src/ui.c
@@ -557,6 +557,51 @@ clip_copy_selection(clip)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Save and restore clip_unnamed before doing possibly many changes. This
|
||||
* prevents accessing the clipboard very often which might slow down Vim
|
||||
* considerably.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Save clip_unnamed and reset it.
|
||||
*/
|
||||
void
|
||||
start_global_changes()
|
||||
{
|
||||
clip_unnamed_saved = clip_unnamed;
|
||||
|
||||
if (clip_did_set_selection)
|
||||
{
|
||||
clip_unnamed = FALSE;
|
||||
clip_did_set_selection = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore clip_unnamed and set the selection when needed.
|
||||
*/
|
||||
void
|
||||
end_global_changes()
|
||||
{
|
||||
if (!clip_did_set_selection)
|
||||
{
|
||||
clip_did_set_selection = TRUE;
|
||||
clip_unnamed = clip_unnamed_saved;
|
||||
if (clip_unnamed & CLIP_UNNAMED)
|
||||
{
|
||||
clip_own_selection(&clip_star);
|
||||
clip_gen_set_selection(&clip_star);
|
||||
}
|
||||
if (clip_unnamed & CLIP_UNNAMED_PLUS)
|
||||
{
|
||||
clip_own_selection(&clip_plus);
|
||||
clip_gen_set_selection(&clip_plus);
|
||||
}
|
||||
}
|
||||
clip_unnamed_saved = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when Visual mode is ended: update the selection.
|
||||
*/
|
||||
@@ -1428,6 +1473,15 @@ clip_gen_lose_selection(cbd)
|
||||
clip_gen_set_selection(cbd)
|
||||
VimClipboard *cbd;
|
||||
{
|
||||
if (!clip_did_set_selection)
|
||||
{
|
||||
/* Updating postponed, so that accessing the system clipboard won't
|
||||
* hang Vim when accessing it many times (e.g. on a :g comand). */
|
||||
if (cbd == &clip_plus && (clip_unnamed_saved & CLIP_UNNAMED_PLUS))
|
||||
return;
|
||||
else if (cbd == &clip_star && (clip_unnamed_saved & CLIP_UNNAMED))
|
||||
return;
|
||||
}
|
||||
#ifdef FEAT_XCLIPBOARD
|
||||
# ifdef FEAT_GUI
|
||||
if (gui.in_use)
|
||||
|
Reference in New Issue
Block a user