Mercurial > vim
comparison src/ui.c @ 6116:7766142fc7d3 v7.4.396
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)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 06 Aug 2014 18:17:11 +0200 |
parents | ef83b423ebf7 |
children | 1138726736fb |
comparison
equal
deleted
inserted
replaced
6115:fe7b9f6ad226 | 6116:7766142fc7d3 |
---|---|
553 clip_own_selection(clip); | 553 clip_own_selection(clip); |
554 if (clip->owned) | 554 if (clip->owned) |
555 clip_get_selection(clip); | 555 clip_get_selection(clip); |
556 clip_gen_set_selection(clip); | 556 clip_gen_set_selection(clip); |
557 } | 557 } |
558 } | |
559 | |
560 /* | |
561 * Save and restore clip_unnamed before doing possibly many changes. This | |
562 * prevents accessing the clipboard very often which might slow down Vim | |
563 * considerably. | |
564 */ | |
565 | |
566 /* | |
567 * Save clip_unnamed and reset it. | |
568 */ | |
569 void | |
570 start_global_changes() | |
571 { | |
572 clip_unnamed_saved = clip_unnamed; | |
573 | |
574 if (clip_did_set_selection) | |
575 { | |
576 clip_unnamed = FALSE; | |
577 clip_did_set_selection = FALSE; | |
578 } | |
579 } | |
580 | |
581 /* | |
582 * Restore clip_unnamed and set the selection when needed. | |
583 */ | |
584 void | |
585 end_global_changes() | |
586 { | |
587 if (!clip_did_set_selection) | |
588 { | |
589 clip_did_set_selection = TRUE; | |
590 clip_unnamed = clip_unnamed_saved; | |
591 if (clip_unnamed & CLIP_UNNAMED) | |
592 { | |
593 clip_own_selection(&clip_star); | |
594 clip_gen_set_selection(&clip_star); | |
595 } | |
596 if (clip_unnamed & CLIP_UNNAMED_PLUS) | |
597 { | |
598 clip_own_selection(&clip_plus); | |
599 clip_gen_set_selection(&clip_plus); | |
600 } | |
601 } | |
602 clip_unnamed_saved = FALSE; | |
558 } | 603 } |
559 | 604 |
560 /* | 605 /* |
561 * Called when Visual mode is ended: update the selection. | 606 * Called when Visual mode is ended: update the selection. |
562 */ | 607 */ |
1426 | 1471 |
1427 void | 1472 void |
1428 clip_gen_set_selection(cbd) | 1473 clip_gen_set_selection(cbd) |
1429 VimClipboard *cbd; | 1474 VimClipboard *cbd; |
1430 { | 1475 { |
1476 if (!clip_did_set_selection) | |
1477 { | |
1478 /* Updating postponed, so that accessing the system clipboard won't | |
1479 * hang Vim when accessing it many times (e.g. on a :g comand). */ | |
1480 if (cbd == &clip_plus && (clip_unnamed_saved & CLIP_UNNAMED_PLUS)) | |
1481 return; | |
1482 else if (cbd == &clip_star && (clip_unnamed_saved & CLIP_UNNAMED)) | |
1483 return; | |
1484 } | |
1431 #ifdef FEAT_XCLIPBOARD | 1485 #ifdef FEAT_XCLIPBOARD |
1432 # ifdef FEAT_GUI | 1486 # ifdef FEAT_GUI |
1433 if (gui.in_use) | 1487 if (gui.in_use) |
1434 clip_mch_set_selection(cbd); | 1488 clip_mch_set_selection(cbd); |
1435 else | 1489 else |