smsg((char_u *)_("Pattern not found: %s"), pat);
}
else
+ {
+#ifdef FEAT_CLIPBOARD
+ start_global_changes();
+#endif
global_exe(cmd);
+#ifdef FEAT_CLIPBOARD
+ end_global_changes();
+#endif
+ }
ml_clearmarked(); /* clear rest of the marks */
vim_regfree(regmatch.regprog);
* great speed improvement. */
save_ei = au_event_disable(",Syntax");
#endif
+#ifdef FEAT_CLIPBOARD
+ start_global_changes();
+#endif
if (eap->cmdidx == CMD_windo
|| eap->cmdidx == CMD_tabdo
curbuf->b_fname, TRUE, curbuf);
}
#endif
+#ifdef FEAT_CLIPBOARD
+ end_global_changes();
+#endif
}
/*
* used.
* Returns OK when at least one match found, FAIL otherwise.
*
- * If "name" is NULL calls callback for each entry in runtimepath. Cookie is
- * passed by reference in this case, setting it to NULL indicates that callback
+ * If "name" is NULL calls callback for each entry in runtimepath. Cookie is
+ * passed by reference in this case, setting it to NULL indicates that callback
* has done its job.
*/
int
{
linenr_T lnum;
+#ifdef FEAT_CLIPBOARD
+ start_global_changes();
+#endif
+
/* First set the marks for all lines closed/open. */
for (lnum = eap->line1; lnum <= eap->line2; ++lnum)
if (hasFolding(lnum, NULL, NULL) == (eap->cmdidx == CMD_folddoclosed))
/* Execute the command on the marked lines. */
global_exe(eap->arg);
ml_clearmarked(); /* clear rest of the marks */
+#ifdef FEAT_CLIPBOARD
+ end_global_changes();
+#endif
}
#endif
EXTERN int clip_autoselectml INIT(= FALSE);
EXTERN int clip_html INIT(= FALSE);
EXTERN regprog_T *clip_exclude_prog INIT(= NULL);
+EXTERN int clip_did_set_selection INIT(= TRUE);
+EXTERN int clip_unnamed_saved INIT(= 0);
#endif
/*
{
/* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard',
* use '*' or '+' reg, respectively. "unnamedplus" prevails. */
- if (*rp == 0 && clip_unnamed != 0)
- *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
+ if (*rp == 0 && (clip_unnamed != 0 || clip_unnamed_saved != 0))
+ {
+ if (clip_unnamed != 0)
+ *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
+ ? '+' : '*';
+ else
+ *rp = ((clip_unnamed_saved & CLIP_UNNAMED_PLUS) && clip_plus.available)
? '+' : '*';
+ }
if (!clip_star.available && *rp == '*')
*rp = 0;
if (!clip_plus.available && *rp == '+')
if (clip_star.available
&& (curr == &(y_regs[STAR_REGISTER])
|| (!deleting && oap->regname == 0
- && (clip_unnamed & CLIP_UNNAMED))))
+ && ((clip_unnamed | clip_unnamed_saved) & CLIP_UNNAMED))))
{
if (curr != &(y_regs[STAR_REGISTER]))
/* Copy the text from register 0 to the clipboard register. */
if (clip_plus.available
&& (curr == &(y_regs[PLUS_REGISTER])
|| (!deleting && oap->regname == 0
- && (clip_unnamed & CLIP_UNNAMED_PLUS))))
+ && ((clip_unnamed | clip_unnamed_saved) &
+ CLIP_UNNAMED_PLUS))))
{
if (curr != &(y_regs[PLUS_REGISTER]))
/* Copy the text from register 0 to the clipboard register. */
void clip_update_selection __ARGS((VimClipboard *clip));
void clip_own_selection __ARGS((VimClipboard *cbd));
void clip_lose_selection __ARGS((VimClipboard *cbd));
+void start_global_changes __ARGS((void));
+void end_global_changes __ARGS((void));
void clip_auto_select __ARGS((void));
int clip_isautosel_star __ARGS((void));
int clip_isautosel_plus __ARGS((void));
}
}
+/*
+ * 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.
*/
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)
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 396,
/**/
395,
/**/