237 lines
7.0 KiB
Plaintext
237 lines
7.0 KiB
Plaintext
|
To: vim_dev@googlegroups.com
|
|||
|
Subject: Patch 7.4.598
|
|||
|
Fcc: outbox
|
|||
|
From: Bram Moolenaar <Bram@moolenaar.net>
|
|||
|
Mime-Version: 1.0
|
|||
|
Content-Type: text/plain; charset=UTF-8
|
|||
|
Content-Transfer-Encoding: 8bit
|
|||
|
------------
|
|||
|
|
|||
|
Patch 7.4.598
|
|||
|
Problem: ":tabdo windo echo 'hi'" causes "* register not to be changed.
|
|||
|
(Salman Halim)
|
|||
|
Solution: Change how clip_did_set_selection is used and add
|
|||
|
clipboard_needs_update and global_change_count. (Christian
|
|||
|
Brabandt)
|
|||
|
Files: src/main.c, src/ui.c, src/testdir/test_eval.in,
|
|||
|
src/testdir/test_eval.ok
|
|||
|
|
|||
|
|
|||
|
*** ../vim-7.4.597/src/main.c 2014-11-12 15:15:34.983882077 +0100
|
|||
|
--- src/main.c 2015-01-27 13:59:56.516171207 +0100
|
|||
|
***************
|
|||
|
*** 959,975 ****
|
|||
|
if (p_im)
|
|||
|
need_start_insertmode = TRUE;
|
|||
|
|
|||
|
- #ifdef FEAT_CLIPBOARD
|
|||
|
- if (clip_unnamed)
|
|||
|
- /* do not overwrite system clipboard while starting up */
|
|||
|
- clip_did_set_selection = -1;
|
|||
|
- #endif
|
|||
|
#ifdef FEAT_AUTOCMD
|
|||
|
apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf);
|
|||
|
- # ifdef FEAT_CLIPBOARD
|
|||
|
- if (clip_did_set_selection < 0)
|
|||
|
- clip_did_set_selection = TRUE;
|
|||
|
- # endif
|
|||
|
TIME_MSG("VimEnter autocommands");
|
|||
|
#endif
|
|||
|
|
|||
|
--- 959,966 ----
|
|||
|
*** ../vim-7.4.597/src/ui.c 2015-01-14 16:08:29.210474234 +0100
|
|||
|
--- src/ui.c 2015-01-27 14:03:23.597904543 +0100
|
|||
|
***************
|
|||
|
*** 73,78 ****
|
|||
|
--- 73,80 ----
|
|||
|
static char_u *ta_str = NULL;
|
|||
|
static int ta_off; /* offset for next char to use when ta_str != NULL */
|
|||
|
static int ta_len; /* length of ta_str when it's not NULL*/
|
|||
|
+ static int clipboard_needs_update; /* clipboard needs to be updated */
|
|||
|
+ static int global_change_count = 0; /* if set, inside a start_global_changes */
|
|||
|
|
|||
|
void
|
|||
|
ui_inchar_undo(s, len)
|
|||
|
***************
|
|||
|
*** 569,577 ****
|
|||
|
void
|
|||
|
start_global_changes()
|
|||
|
{
|
|||
|
clip_unnamed_saved = clip_unnamed;
|
|||
|
|
|||
|
! if (clip_did_set_selection > 0)
|
|||
|
{
|
|||
|
clip_unnamed = FALSE;
|
|||
|
clip_did_set_selection = FALSE;
|
|||
|
--- 571,582 ----
|
|||
|
void
|
|||
|
start_global_changes()
|
|||
|
{
|
|||
|
+ if (++global_change_count > 1)
|
|||
|
+ return;
|
|||
|
clip_unnamed_saved = clip_unnamed;
|
|||
|
+ clipboard_needs_update = FALSE;
|
|||
|
|
|||
|
! if (clip_did_set_selection)
|
|||
|
{
|
|||
|
clip_unnamed = FALSE;
|
|||
|
clip_did_set_selection = FALSE;
|
|||
|
***************
|
|||
|
*** 584,605 ****
|
|||
|
void
|
|||
|
end_global_changes()
|
|||
|
{
|
|||
|
! if (clip_did_set_selection == FALSE) /* not when -1 */
|
|||
|
{
|
|||
|
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;
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
--- 589,618 ----
|
|||
|
void
|
|||
|
end_global_changes()
|
|||
|
{
|
|||
|
! if (--global_change_count > 0)
|
|||
|
! /* recursive */
|
|||
|
! return;
|
|||
|
! if (!clip_did_set_selection)
|
|||
|
{
|
|||
|
clip_did_set_selection = TRUE;
|
|||
|
clip_unnamed = clip_unnamed_saved;
|
|||
|
! clip_unnamed_saved = FALSE;
|
|||
|
! if (clipboard_needs_update)
|
|||
|
{
|
|||
|
! /* only store something in the clipboard,
|
|||
|
! * if we have yanked anything to it */
|
|||
|
! 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);
|
|||
|
! }
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
***************
|
|||
|
*** 1477,1486 ****
|
|||
|
{
|
|||
|
/* 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
|
|||
|
--- 1490,1501 ----
|
|||
|
{
|
|||
|
/* 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))
|
|||
|
! || (cbd == &clip_star && (clip_unnamed_saved & CLIP_UNNAMED)))
|
|||
|
! {
|
|||
|
! clipboard_needs_update = TRUE;
|
|||
|
return;
|
|||
|
+ }
|
|||
|
}
|
|||
|
#ifdef FEAT_XCLIPBOARD
|
|||
|
# ifdef FEAT_GUI
|
|||
|
*** ../vim-7.4.597/src/testdir/test_eval.in 2014-05-28 20:31:37.500292805 +0200
|
|||
|
--- src/testdir/test_eval.in 2015-01-27 13:55:35.899023919 +0100
|
|||
|
***************
|
|||
|
*** 1,7 ****
|
|||
|
Test for various eval features. vim: set ft=vim :
|
|||
|
|
|||
|
! Note: system clipboard support is not tested. I do not think anybody will thank
|
|||
|
! me for messing with clipboard.
|
|||
|
|
|||
|
STARTTEST
|
|||
|
:so small.vim
|
|||
|
--- 1,6 ----
|
|||
|
Test for various eval features. vim: set ft=vim :
|
|||
|
|
|||
|
! Note: system clipboard is saved, changed and restored.
|
|||
|
|
|||
|
STARTTEST
|
|||
|
:so small.vim
|
|||
|
***************
|
|||
|
*** 122,128 ****
|
|||
|
call SetReg('/', ["abc/\n"])
|
|||
|
call SetReg('=', ['"abc/"'])
|
|||
|
call SetReg('=', ["\"abc/\n\""])
|
|||
|
!
|
|||
|
$put ='{{{1 Errors'
|
|||
|
call ErrExe('call setreg()')
|
|||
|
call ErrExe('call setreg(1)')
|
|||
|
--- 121,139 ----
|
|||
|
call SetReg('/', ["abc/\n"])
|
|||
|
call SetReg('=', ['"abc/"'])
|
|||
|
call SetReg('=', ["\"abc/\n\""])
|
|||
|
! $put ='{{{1 System clipboard'
|
|||
|
! " Save and restore system clipboard.
|
|||
|
! " If no connection to X-Server is possible, test should succeed.
|
|||
|
! :let _clipreg = ['+', getreg('+'), getregtype('+')]
|
|||
|
! :let _clipopt = &cb
|
|||
|
! :let &cb='unnamedplus'
|
|||
|
! :1y
|
|||
|
! :AR +
|
|||
|
! :tabdo :windo :echo "hi"
|
|||
|
! :3y
|
|||
|
! :AR +
|
|||
|
! :let &cb=_clipopt
|
|||
|
! :call call('setreg', _clipreg)
|
|||
|
$put ='{{{1 Errors'
|
|||
|
call ErrExe('call setreg()')
|
|||
|
call ErrExe('call setreg(1)')
|
|||
|
*** ../vim-7.4.597/src/testdir/test_eval.ok 2014-05-28 20:31:37.500292805 +0200
|
|||
|
--- src/testdir/test_eval.ok 2015-01-27 14:06:33.559825303 +0100
|
|||
|
***************
|
|||
|
*** 316,321 ****
|
|||
|
--- 316,324 ----
|
|||
|
=: type v; value: abc/ (['abc/']), expr: "abc/" (['"abc/"'])
|
|||
|
{{{2 setreg('=', ['"abc/ |