To:
[email protected]
Subject: Patch 6.3b.015
Fcc: outbox
From: Bram Moolenaar <
[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 6.3b.015
Problem: Get lalloc(0) error when using "p" in Visual mode while
'clipboard' contains "autoselect,unnamed". (Mark Wagonner)
Solution: Avoid allocating zero bytes. Obtain the clipboard when necessary.
Files: src/ops.c
*** ../vim-6.3b.014/src/ops.c Sun May 16 22:38:45 2004
--- src/ops.c Tue May 25 19:52:26 2004
***************
*** 864,869 ****
--- 864,898 ----
y_previous = y_current;
}
+ #ifdef FEAT_CLIPBOARD
+ /*
+ * When "regname" is a clipboard register, obtain the selection. If it's not
+ * available return zero, otherwise return "regname".
+ */
+ static int may_get_selection __ARGS((int regname));
+
+ static int
+ may_get_selection(regname)
+ int regname;
+ {
+ if (regname == '*')
+ {
+ if (!clip_star.available)
+ regname = 0;
+ else
+ clip_get_selection(&clip_star);
+ }
+ else if (regname == '+')
+ {
+ if (!clip_plus.available)
+ regname = 0;
+ else
+ clip_get_selection(&clip_plus);
+ }
+ return regname;
+ }
+ #endif
+
#if defined(FEAT_VISUAL) || defined(PROTO)
/*
* Obtain the contents of a "normal" register. The register is made empty.
***************
*** 877,882 ****
--- 906,921 ----
static struct yankreg *reg;
int i;
+ #ifdef FEAT_CLIPBOARD
+ /* When Visual area changed, may have to update selection. Obtain the
+ * selection too. */
+ if (name == '*' && clip_star.available && clip_isautosel())
+ {
+ clip_update_selection();
+ may_get_selection(name);
+ }
+ #endif
+
get_yank_register(name, 0);
reg = (struct yankreg *)alloc((unsigned)sizeof(struct yankreg));
if (reg != NULL)
***************
*** 885,892 ****
if (copy)
{
/* If we run out of memory some or all of the lines are empty. */
! reg->y_array = (char_u **)alloc((unsigned)(sizeof(char_u *)
! * reg->y_size));
if (reg->y_array != NULL)
{
for (i = 0; i < reg->y_size; ++i)
--- 924,934 ----
if (copy)
{
/* If we run out of memory some or all of the lines are empty. */
! if (reg->y_size == 0)
! reg->y_array = NULL;
! else
! reg->y_array = (char_u **)alloc((unsigned)(sizeof(char_u *)
! * reg->y_size));
if (reg->y_array != NULL)
{
for (i = 0; i < reg->y_size; ++i)
***************
*** 1048,1082 ****
}
return OK;
}
-
- #ifdef FEAT_CLIPBOARD
- /*
- * When "regname" is a clipboard register, obtain the selection. If it's not
- * available return zero, otherwise return "regname".
- */
- static int may_get_selection __ARGS((int regname));
-
- static int
- may_get_selection(regname)
- int regname;
- {
- if (regname == '*')
- {
- if (!clip_star.available)
- regname = 0;
- else
- clip_get_selection(&clip_star);
- }
- else if (regname == '+')
- {
- if (!clip_plus.available)
- regname = 0;
- else
- clip_get_selection(&clip_plus);
- }
- return regname;
- }
- #endif
/*
* execute a yank register: copy it into the stuff buffer
--- 1090,1095 ----
*** ../vim-6.3b.014/src/version.c Sun May 30 20:29:49 2004
--- src/version.c Sun May 30 20:30:30 2004
***************
*** 643,644 ****
--- 643,646 ----
{ /* Add new patch number below this line */
+ /**/
+ 15,
/**/
--
hundred-and-one symptoms of being an internet addict:
5. You find yourself brainstorming for new subjects to search.
/// Bram Moolenaar --
[email protected] --
http://www.Moolenaar.net \\\
/// Sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ Project leader for A-A-P --
http://www.A-A-P.org ///
\\\ Buy at Amazon and help AIDS victims --
http://ICCF.nl/click1.html ///