|
|
073263 |
To: vim_dev@googlegroups.com
|
|
|
073263 |
Subject: Patch 7.4.171
|
|
|
073263 |
Fcc: outbox
|
|
|
073263 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
073263 |
Mime-Version: 1.0
|
|
|
073263 |
Content-Type: text/plain; charset=UTF-8
|
|
|
073263 |
Content-Transfer-Encoding: 8bit
|
|
|
073263 |
------------
|
|
|
073263 |
|
|
|
073263 |
Patch 7.4.171
|
|
|
073263 |
Problem: Redo does not set v:count and v:count1.
|
|
|
073263 |
Solution: Use a separate buffer for redo, so that we can set the counts when
|
|
|
073263 |
performing redo.
|
|
|
073263 |
Files: src/getchar.c, src/globals.h, src/normal.c, src/proto/getchar.pro,
|
|
|
073263 |
src/structs.h
|
|
|
073263 |
|
|
|
073263 |
|
|
|
073263 |
*** ../vim-7.4.170/src/getchar.c 2013-06-29 13:43:27.000000000 +0200
|
|
|
073263 |
--- src/getchar.c 2014-02-11 14:54:46.830097259 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 40,52 ****
|
|
|
073263 |
|
|
|
073263 |
#define MINIMAL_SIZE 20 /* minimal size for b_str */
|
|
|
073263 |
|
|
|
073263 |
! static struct buffheader redobuff = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
! static struct buffheader old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
|
|
|
073263 |
! static struct buffheader save_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
! static struct buffheader save_old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
#endif
|
|
|
073263 |
! static struct buffheader recordbuff = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
|
|
|
073263 |
static int typeahead_char = 0; /* typeahead char that's not flushed */
|
|
|
073263 |
|
|
|
073263 |
--- 40,52 ----
|
|
|
073263 |
|
|
|
073263 |
#define MINIMAL_SIZE 20 /* minimal size for b_str */
|
|
|
073263 |
|
|
|
073263 |
! static buffheader_T redobuff = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
! static buffheader_T old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
|
|
|
073263 |
! static buffheader_T save_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
! static buffheader_T save_old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
#endif
|
|
|
073263 |
! static buffheader_T recordbuff = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
|
|
|
073263 |
static int typeahead_char = 0; /* typeahead char that's not flushed */
|
|
|
073263 |
|
|
|
073263 |
***************
|
|
|
073263 |
*** 112,122 ****
|
|
|
073263 |
|
|
|
073263 |
static int last_recorded_len = 0; /* number of last recorded chars */
|
|
|
073263 |
|
|
|
073263 |
! static char_u *get_buffcont __ARGS((struct buffheader *, int));
|
|
|
073263 |
! static void add_buff __ARGS((struct buffheader *, char_u *, long n));
|
|
|
073263 |
! static void add_num_buff __ARGS((struct buffheader *, long));
|
|
|
073263 |
! static void add_char_buff __ARGS((struct buffheader *, int));
|
|
|
073263 |
! static int read_stuff __ARGS((int advance));
|
|
|
073263 |
static void start_stuff __ARGS((void));
|
|
|
073263 |
static int read_redo __ARGS((int, int));
|
|
|
073263 |
static void copy_redo __ARGS((int));
|
|
|
073263 |
--- 112,123 ----
|
|
|
073263 |
|
|
|
073263 |
static int last_recorded_len = 0; /* number of last recorded chars */
|
|
|
073263 |
|
|
|
073263 |
! static char_u *get_buffcont __ARGS((buffheader_T *, int));
|
|
|
073263 |
! static void add_buff __ARGS((buffheader_T *, char_u *, long n));
|
|
|
073263 |
! static void add_num_buff __ARGS((buffheader_T *, long));
|
|
|
073263 |
! static void add_char_buff __ARGS((buffheader_T *, int));
|
|
|
073263 |
! static int read_readbuffers __ARGS((int advance));
|
|
|
073263 |
! static int read_readbuf __ARGS((buffheader_T *buf, int advance));
|
|
|
073263 |
static void start_stuff __ARGS((void));
|
|
|
073263 |
static int read_redo __ARGS((int, int));
|
|
|
073263 |
static void copy_redo __ARGS((int));
|
|
|
073263 |
***************
|
|
|
073263 |
*** 137,145 ****
|
|
|
073263 |
*/
|
|
|
073263 |
void
|
|
|
073263 |
free_buff(buf)
|
|
|
073263 |
! struct buffheader *buf;
|
|
|
073263 |
{
|
|
|
073263 |
! struct buffblock *p, *np;
|
|
|
073263 |
|
|
|
073263 |
for (p = buf->bh_first.b_next; p != NULL; p = np)
|
|
|
073263 |
{
|
|
|
073263 |
--- 138,146 ----
|
|
|
073263 |
*/
|
|
|
073263 |
void
|
|
|
073263 |
free_buff(buf)
|
|
|
073263 |
! buffheader_T *buf;
|
|
|
073263 |
{
|
|
|
073263 |
! buffblock_T *p, *np;
|
|
|
073263 |
|
|
|
073263 |
for (p = buf->bh_first.b_next; p != NULL; p = np)
|
|
|
073263 |
{
|
|
|
073263 |
***************
|
|
|
073263 |
*** 155,168 ****
|
|
|
073263 |
*/
|
|
|
073263 |
static char_u *
|
|
|
073263 |
get_buffcont(buffer, dozero)
|
|
|
073263 |
! struct buffheader *buffer;
|
|
|
073263 |
int dozero; /* count == zero is not an error */
|
|
|
073263 |
{
|
|
|
073263 |
long_u count = 0;
|
|
|
073263 |
char_u *p = NULL;
|
|
|
073263 |
char_u *p2;
|
|
|
073263 |
char_u *str;
|
|
|
073263 |
! struct buffblock *bp;
|
|
|
073263 |
|
|
|
073263 |
/* compute the total length of the string */
|
|
|
073263 |
for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next)
|
|
|
073263 |
--- 156,169 ----
|
|
|
073263 |
*/
|
|
|
073263 |
static char_u *
|
|
|
073263 |
get_buffcont(buffer, dozero)
|
|
|
073263 |
! buffheader_T *buffer;
|
|
|
073263 |
int dozero; /* count == zero is not an error */
|
|
|
073263 |
{
|
|
|
073263 |
long_u count = 0;
|
|
|
073263 |
char_u *p = NULL;
|
|
|
073263 |
char_u *p2;
|
|
|
073263 |
char_u *str;
|
|
|
073263 |
! buffblock_T *bp;
|
|
|
073263 |
|
|
|
073263 |
/* compute the total length of the string */
|
|
|
073263 |
for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next)
|
|
|
073263 |
***************
|
|
|
073263 |
*** 230,240 ****
|
|
|
073263 |
*/
|
|
|
073263 |
static void
|
|
|
073263 |
add_buff(buf, s, slen)
|
|
|
073263 |
! struct buffheader *buf;
|
|
|
073263 |
char_u *s;
|
|
|
073263 |
long slen; /* length of "s" or -1 */
|
|
|
073263 |
{
|
|
|
073263 |
! struct buffblock *p;
|
|
|
073263 |
long_u len;
|
|
|
073263 |
|
|
|
073263 |
if (slen < 0)
|
|
|
073263 |
--- 231,241 ----
|
|
|
073263 |
*/
|
|
|
073263 |
static void
|
|
|
073263 |
add_buff(buf, s, slen)
|
|
|
073263 |
! buffheader_T *buf;
|
|
|
073263 |
char_u *s;
|
|
|
073263 |
long slen; /* length of "s" or -1 */
|
|
|
073263 |
{
|
|
|
073263 |
! buffblock_T *p;
|
|
|
073263 |
long_u len;
|
|
|
073263 |
|
|
|
073263 |
if (slen < 0)
|
|
|
073263 |
***************
|
|
|
073263 |
*** 270,276 ****
|
|
|
073263 |
len = MINIMAL_SIZE;
|
|
|
073263 |
else
|
|
|
073263 |
len = slen;
|
|
|
073263 |
! p = (struct buffblock *)lalloc((long_u)(sizeof(struct buffblock) + len),
|
|
|
073263 |
TRUE);
|
|
|
073263 |
if (p == NULL)
|
|
|
073263 |
return; /* no space, just forget it */
|
|
|
073263 |
--- 271,277 ----
|
|
|
073263 |
len = MINIMAL_SIZE;
|
|
|
073263 |
else
|
|
|
073263 |
len = slen;
|
|
|
073263 |
! p = (buffblock_T *)lalloc((long_u)(sizeof(buffblock_T) + len),
|
|
|
073263 |
TRUE);
|
|
|
073263 |
if (p == NULL)
|
|
|
073263 |
return; /* no space, just forget it */
|
|
|
073263 |
***************
|
|
|
073263 |
*** 289,295 ****
|
|
|
073263 |
*/
|
|
|
073263 |
static void
|
|
|
073263 |
add_num_buff(buf, n)
|
|
|
073263 |
! struct buffheader *buf;
|
|
|
073263 |
long n;
|
|
|
073263 |
{
|
|
|
073263 |
char_u number[32];
|
|
|
073263 |
--- 290,296 ----
|
|
|
073263 |
*/
|
|
|
073263 |
static void
|
|
|
073263 |
add_num_buff(buf, n)
|
|
|
073263 |
! buffheader_T *buf;
|
|
|
073263 |
long n;
|
|
|
073263 |
{
|
|
|
073263 |
char_u number[32];
|
|
|
073263 |
***************
|
|
|
073263 |
*** 304,310 ****
|
|
|
073263 |
*/
|
|
|
073263 |
static void
|
|
|
073263 |
add_char_buff(buf, c)
|
|
|
073263 |
! struct buffheader *buf;
|
|
|
073263 |
int c;
|
|
|
073263 |
{
|
|
|
073263 |
#ifdef FEAT_MBYTE
|
|
|
073263 |
--- 305,311 ----
|
|
|
073263 |
*/
|
|
|
073263 |
static void
|
|
|
073263 |
add_char_buff(buf, c)
|
|
|
073263 |
! buffheader_T *buf;
|
|
|
073263 |
int c;
|
|
|
073263 |
{
|
|
|
073263 |
#ifdef FEAT_MBYTE
|
|
|
073263 |
***************
|
|
|
073263 |
*** 354,399 ****
|
|
|
073263 |
#endif
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
! * Get one byte from the stuff buffer.
|
|
|
073263 |
* If advance == TRUE go to the next char.
|
|
|
073263 |
* No translation is done K_SPECIAL and CSI are escaped.
|
|
|
073263 |
*/
|
|
|
073263 |
static int
|
|
|
073263 |
! read_stuff(advance)
|
|
|
073263 |
int advance;
|
|
|
073263 |
{
|
|
|
073263 |
! char_u c;
|
|
|
073263 |
! struct buffblock *curr;
|
|
|
073263 |
|
|
|
073263 |
! if (stuffbuff.bh_first.b_next == NULL) /* buffer is empty */
|
|
|
073263 |
return NUL;
|
|
|
073263 |
|
|
|
073263 |
! curr = stuffbuff.bh_first.b_next;
|
|
|
073263 |
! c = curr->b_str[stuffbuff.bh_index];
|
|
|
073263 |
|
|
|
073263 |
if (advance)
|
|
|
073263 |
{
|
|
|
073263 |
! if (curr->b_str[++stuffbuff.bh_index] == NUL)
|
|
|
073263 |
{
|
|
|
073263 |
! stuffbuff.bh_first.b_next = curr->b_next;
|
|
|
073263 |
vim_free(curr);
|
|
|
073263 |
! stuffbuff.bh_index = 0;
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
return c;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
! * Prepare the stuff buffer for reading (if it contains something).
|
|
|
073263 |
*/
|
|
|
073263 |
static void
|
|
|
073263 |
start_stuff()
|
|
|
073263 |
{
|
|
|
073263 |
! if (stuffbuff.bh_first.b_next != NULL)
|
|
|
073263 |
{
|
|
|
073263 |
! stuffbuff.bh_curr = &(stuffbuff.bh_first);
|
|
|
073263 |
! stuffbuff.bh_space = 0;
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
--- 355,425 ----
|
|
|
073263 |
#endif
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
+ /* First read ahead buffer. Used for translated commands. */
|
|
|
073263 |
+ static buffheader_T readbuf1 = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
+
|
|
|
073263 |
+ /* Second read ahead buffer. Used for redo. */
|
|
|
073263 |
+ static buffheader_T readbuf2 = {{NULL, {NUL}}, NULL, 0, 0};
|
|
|
073263 |
+
|
|
|
073263 |
/*
|
|
|
073263 |
! * Get one byte from the read buffers. Use readbuf1 one first, use readbuf2
|
|
|
073263 |
! * if that one is empty.
|
|
|
073263 |
* If advance == TRUE go to the next char.
|
|
|
073263 |
* No translation is done K_SPECIAL and CSI are escaped.
|
|
|
073263 |
*/
|
|
|
073263 |
static int
|
|
|
073263 |
! read_readbuffers(advance)
|
|
|
073263 |
int advance;
|
|
|
073263 |
{
|
|
|
073263 |
! int c;
|
|
|
073263 |
!
|
|
|
073263 |
! c = read_readbuf(&readbuf1, advance);
|
|
|
073263 |
! if (c == NUL)
|
|
|
073263 |
! c = read_readbuf(&readbuf2, advance);
|
|
|
073263 |
! return c;
|
|
|
073263 |
! }
|
|
|
073263 |
!
|
|
|
073263 |
! static int
|
|
|
073263 |
! read_readbuf(buf, advance)
|
|
|
073263 |
! buffheader_T *buf;
|
|
|
073263 |
! int advance;
|
|
|
073263 |
! {
|
|
|
073263 |
! char_u c;
|
|
|
073263 |
! buffblock_T *curr;
|
|
|
073263 |
|
|
|
073263 |
! if (buf->bh_first.b_next == NULL) /* buffer is empty */
|
|
|
073263 |
return NUL;
|
|
|
073263 |
|
|
|
073263 |
! curr = buf->bh_first.b_next;
|
|
|
073263 |
! c = curr->b_str[buf->bh_index];
|
|
|
073263 |
|
|
|
073263 |
if (advance)
|
|
|
073263 |
{
|
|
|
073263 |
! if (curr->b_str[++buf->bh_index] == NUL)
|
|
|
073263 |
{
|
|
|
073263 |
! buf->bh_first.b_next = curr->b_next;
|
|
|
073263 |
vim_free(curr);
|
|
|
073263 |
! buf->bh_index = 0;
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
return c;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
! * Prepare the read buffers for reading (if they contains something).
|
|
|
073263 |
*/
|
|
|
073263 |
static void
|
|
|
073263 |
start_stuff()
|
|
|
073263 |
{
|
|
|
073263 |
! if (readbuf1.bh_first.b_next != NULL)
|
|
|
073263 |
{
|
|
|
073263 |
! readbuf1.bh_curr = &(readbuf1.bh_first);
|
|
|
073263 |
! readbuf1.bh_space = 0;
|
|
|
073263 |
! }
|
|
|
073263 |
! if (readbuf2.bh_first.b_next != NULL)
|
|
|
073263 |
! {
|
|
|
073263 |
! readbuf2.bh_curr = &(readbuf2.bh_first);
|
|
|
073263 |
! readbuf2.bh_space = 0;
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
***************
|
|
|
073263 |
*** 403,409 ****
|
|
|
073263 |
int
|
|
|
073263 |
stuff_empty()
|
|
|
073263 |
{
|
|
|
073263 |
! return (stuffbuff.bh_first.b_next == NULL);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
--- 429,446 ----
|
|
|
073263 |
int
|
|
|
073263 |
stuff_empty()
|
|
|
073263 |
{
|
|
|
073263 |
! return (readbuf1.bh_first.b_next == NULL
|
|
|
073263 |
! && readbuf2.bh_first.b_next == NULL);
|
|
|
073263 |
! }
|
|
|
073263 |
!
|
|
|
073263 |
! /*
|
|
|
073263 |
! * Return TRUE if readbuf1 is empty. There may still be redo characters in
|
|
|
073263 |
! * redbuf2.
|
|
|
073263 |
! */
|
|
|
073263 |
! int
|
|
|
073263 |
! readbuf1_empty()
|
|
|
073263 |
! {
|
|
|
073263 |
! return (readbuf1.bh_first.b_next == NULL);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
***************
|
|
|
073263 |
*** 428,434 ****
|
|
|
073263 |
init_typebuf();
|
|
|
073263 |
|
|
|
073263 |
start_stuff();
|
|
|
073263 |
! while (read_stuff(TRUE) != NUL)
|
|
|
073263 |
;
|
|
|
073263 |
|
|
|
073263 |
if (flush_typeahead) /* remove all typeahead */
|
|
|
073263 |
--- 465,471 ----
|
|
|
073263 |
init_typebuf();
|
|
|
073263 |
|
|
|
073263 |
start_stuff();
|
|
|
073263 |
! while (read_readbuffers(TRUE) != NUL)
|
|
|
073263 |
;
|
|
|
073263 |
|
|
|
073263 |
if (flush_typeahead) /* remove all typeahead */
|
|
|
073263 |
***************
|
|
|
073263 |
*** 483,489 ****
|
|
|
073263 |
redobuff = old_redobuff;
|
|
|
073263 |
old_redobuff.bh_first.b_next = NULL;
|
|
|
073263 |
start_stuff();
|
|
|
073263 |
! while (read_stuff(TRUE) != NUL)
|
|
|
073263 |
;
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
--- 520,526 ----
|
|
|
073263 |
redobuff = old_redobuff;
|
|
|
073263 |
old_redobuff.bh_first.b_next = NULL;
|
|
|
073263 |
start_stuff();
|
|
|
073263 |
! while (read_readbuffers(TRUE) != NUL)
|
|
|
073263 |
;
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
***************
|
|
|
073263 |
*** 638,644 ****
|
|
|
073263 |
stuffReadbuff(s)
|
|
|
073263 |
char_u *s;
|
|
|
073263 |
{
|
|
|
073263 |
! add_buff(&stuffbuff, s, -1L);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
void
|
|
|
073263 |
--- 675,681 ----
|
|
|
073263 |
stuffReadbuff(s)
|
|
|
073263 |
char_u *s;
|
|
|
073263 |
{
|
|
|
073263 |
! add_buff(&readbuf1, s, -1L);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
void
|
|
|
073263 |
***************
|
|
|
073263 |
*** 646,652 ****
|
|
|
073263 |
char_u *s;
|
|
|
073263 |
long len;
|
|
|
073263 |
{
|
|
|
073263 |
! add_buff(&stuffbuff, s, len);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
#if defined(FEAT_EVAL) || defined(PROTO)
|
|
|
073263 |
--- 683,689 ----
|
|
|
073263 |
char_u *s;
|
|
|
073263 |
long len;
|
|
|
073263 |
{
|
|
|
073263 |
! add_buff(&readbuf1, s, len);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
#if defined(FEAT_EVAL) || defined(PROTO)
|
|
|
073263 |
***************
|
|
|
073263 |
*** 692,698 ****
|
|
|
073263 |
stuffcharReadbuff(c)
|
|
|
073263 |
int c;
|
|
|
073263 |
{
|
|
|
073263 |
! add_char_buff(&stuffbuff, c);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
--- 729,735 ----
|
|
|
073263 |
stuffcharReadbuff(c)
|
|
|
073263 |
int c;
|
|
|
073263 |
{
|
|
|
073263 |
! add_char_buff(&readbuf1, c);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
***************
|
|
|
073263 |
*** 702,708 ****
|
|
|
073263 |
stuffnumReadbuff(n)
|
|
|
073263 |
long n;
|
|
|
073263 |
{
|
|
|
073263 |
! add_num_buff(&stuffbuff, n);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
--- 739,745 ----
|
|
|
073263 |
stuffnumReadbuff(n)
|
|
|
073263 |
long n;
|
|
|
073263 |
{
|
|
|
073263 |
! add_num_buff(&readbuf1, n);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
***************
|
|
|
073263 |
*** 718,730 ****
|
|
|
073263 |
int init;
|
|
|
073263 |
int old_redo;
|
|
|
073263 |
{
|
|
|
073263 |
! static struct buffblock *bp;
|
|
|
073263 |
! static char_u *p;
|
|
|
073263 |
! int c;
|
|
|
073263 |
#ifdef FEAT_MBYTE
|
|
|
073263 |
! int n;
|
|
|
073263 |
! char_u buf[MB_MAXBYTES + 1];
|
|
|
073263 |
! int i;
|
|
|
073263 |
#endif
|
|
|
073263 |
|
|
|
073263 |
if (init)
|
|
|
073263 |
--- 755,767 ----
|
|
|
073263 |
int init;
|
|
|
073263 |
int old_redo;
|
|
|
073263 |
{
|
|
|
073263 |
! static buffblock_T *bp;
|
|
|
073263 |
! static char_u *p;
|
|
|
073263 |
! int c;
|
|
|
073263 |
#ifdef FEAT_MBYTE
|
|
|
073263 |
! int n;
|
|
|
073263 |
! char_u buf[MB_MAXBYTES + 1];
|
|
|
073263 |
! int i;
|
|
|
073263 |
#endif
|
|
|
073263 |
|
|
|
073263 |
if (init)
|
|
|
073263 |
***************
|
|
|
073263 |
*** 795,805 ****
|
|
|
073263 |
int c;
|
|
|
073263 |
|
|
|
073263 |
while ((c = read_redo(FALSE, old_redo)) != NUL)
|
|
|
073263 |
! stuffcharReadbuff(c);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
! * Stuff the redo buffer into the stuffbuff.
|
|
|
073263 |
* Insert the redo count into the command.
|
|
|
073263 |
* If "old_redo" is TRUE, the last but one command is repeated
|
|
|
073263 |
* instead of the last command (inserting text). This is used for
|
|
|
073263 |
--- 832,842 ----
|
|
|
073263 |
int c;
|
|
|
073263 |
|
|
|
073263 |
while ((c = read_redo(FALSE, old_redo)) != NUL)
|
|
|
073263 |
! add_char_buff(&readbuf2, c);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
! * Stuff the redo buffer into readbuf2.
|
|
|
073263 |
* Insert the redo count into the command.
|
|
|
073263 |
* If "old_redo" is TRUE, the last but one command is repeated
|
|
|
073263 |
* instead of the last command (inserting text). This is used for
|
|
|
073263 |
***************
|
|
|
073263 |
*** 823,835 ****
|
|
|
073263 |
/* copy the buffer name, if present */
|
|
|
073263 |
if (c == '"')
|
|
|
073263 |
{
|
|
|
073263 |
! add_buff(&stuffbuff, (char_u *)"\"", 1L);
|
|
|
073263 |
c = read_redo(FALSE, old_redo);
|
|
|
073263 |
|
|
|
073263 |
/* if a numbered buffer is used, increment the number */
|
|
|
073263 |
if (c >= '1' && c < '9')
|
|
|
073263 |
++c;
|
|
|
073263 |
! add_char_buff(&stuffbuff, c);
|
|
|
073263 |
c = read_redo(FALSE, old_redo);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
--- 860,872 ----
|
|
|
073263 |
/* copy the buffer name, if present */
|
|
|
073263 |
if (c == '"')
|
|
|
073263 |
{
|
|
|
073263 |
! add_buff(&readbuf2, (char_u *)"\"", 1L);
|
|
|
073263 |
c = read_redo(FALSE, old_redo);
|
|
|
073263 |
|
|
|
073263 |
/* if a numbered buffer is used, increment the number */
|
|
|
073263 |
if (c >= '1' && c < '9')
|
|
|
073263 |
++c;
|
|
|
073263 |
! add_char_buff(&readbuf2, c);
|
|
|
073263 |
c = read_redo(FALSE, old_redo);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
***************
|
|
|
073263 |
*** 850,867 ****
|
|
|
073263 |
{
|
|
|
073263 |
while (VIM_ISDIGIT(c)) /* skip "old" count */
|
|
|
073263 |
c = read_redo(FALSE, old_redo);
|
|
|
073263 |
! add_num_buff(&stuffbuff, count);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/* copy from the redo buffer into the stuff buffer */
|
|
|
073263 |
! add_char_buff(&stuffbuff, c);
|
|
|
073263 |
copy_redo(old_redo);
|
|
|
073263 |
return OK;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
* Repeat the last insert (R, o, O, a, A, i or I command) by stuffing
|
|
|
073263 |
! * the redo buffer into the stuffbuff.
|
|
|
073263 |
* return FAIL for failure, OK otherwise
|
|
|
073263 |
*/
|
|
|
073263 |
int
|
|
|
073263 |
--- 887,904 ----
|
|
|
073263 |
{
|
|
|
073263 |
while (VIM_ISDIGIT(c)) /* skip "old" count */
|
|
|
073263 |
c = read_redo(FALSE, old_redo);
|
|
|
073263 |
! add_num_buff(&readbuf2, count);
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/* copy from the redo buffer into the stuff buffer */
|
|
|
073263 |
! add_char_buff(&readbuf2, c);
|
|
|
073263 |
copy_redo(old_redo);
|
|
|
073263 |
return OK;
|
|
|
073263 |
}
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
* Repeat the last insert (R, o, O, a, A, i or I command) by stuffing
|
|
|
073263 |
! * the redo buffer into readbuf2.
|
|
|
073263 |
* return FAIL for failure, OK otherwise
|
|
|
073263 |
*/
|
|
|
073263 |
int
|
|
|
073263 |
***************
|
|
|
073263 |
*** 879,885 ****
|
|
|
073263 |
if (vim_strchr((char_u *)"AaIiRrOo", c) != NULL)
|
|
|
073263 |
{
|
|
|
073263 |
if (c == 'O' || c == 'o')
|
|
|
073263 |
! stuffReadbuff(NL_STR);
|
|
|
073263 |
break;
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
--- 916,922 ----
|
|
|
073263 |
if (vim_strchr((char_u *)"AaIiRrOo", c) != NULL)
|
|
|
073263 |
{
|
|
|
073263 |
if (c == 'O' || c == 'o')
|
|
|
073263 |
! add_buff(&readbuf2, NL_STR, -1L);
|
|
|
073263 |
break;
|
|
|
073263 |
}
|
|
|
073263 |
}
|
|
|
073263 |
***************
|
|
|
073263 |
*** 1360,1367 ****
|
|
|
073263 |
tp->old_mod_mask = old_mod_mask;
|
|
|
073263 |
old_char = -1;
|
|
|
073263 |
|
|
|
073263 |
! tp->save_stuffbuff = stuffbuff;
|
|
|
073263 |
! stuffbuff.bh_first.b_next = NULL;
|
|
|
073263 |
# ifdef USE_INPUT_BUF
|
|
|
073263 |
tp->save_inputbuf = get_input_buf();
|
|
|
073263 |
# endif
|
|
|
073263 |
--- 1397,1406 ----
|
|
|
073263 |
tp->old_mod_mask = old_mod_mask;
|
|
|
073263 |
old_char = -1;
|
|
|
073263 |
|
|
|
073263 |
! tp->save_readbuf1 = readbuf1;
|
|
|
073263 |
! readbuf1.bh_first.b_next = NULL;
|
|
|
073263 |
! tp->save_readbuf2 = readbuf2;
|
|
|
073263 |
! readbuf2.bh_first.b_next = NULL;
|
|
|
073263 |
# ifdef USE_INPUT_BUF
|
|
|
073263 |
tp->save_inputbuf = get_input_buf();
|
|
|
073263 |
# endif
|
|
|
073263 |
***************
|
|
|
073263 |
*** 1384,1391 ****
|
|
|
073263 |
old_char = tp->old_char;
|
|
|
073263 |
old_mod_mask = tp->old_mod_mask;
|
|
|
073263 |
|
|
|
073263 |
! free_buff(&stuffbuff);
|
|
|
073263 |
! stuffbuff = tp->save_stuffbuff;
|
|
|
073263 |
# ifdef USE_INPUT_BUF
|
|
|
073263 |
set_input_buf(tp->save_inputbuf);
|
|
|
073263 |
# endif
|
|
|
073263 |
--- 1423,1432 ----
|
|
|
073263 |
old_char = tp->old_char;
|
|
|
073263 |
old_mod_mask = tp->old_mod_mask;
|
|
|
073263 |
|
|
|
073263 |
! free_buff(&readbuf1);
|
|
|
073263 |
! readbuf1 = tp->save_readbuf1;
|
|
|
073263 |
! free_buff(&readbuf2);
|
|
|
073263 |
! readbuf2 = tp->save_readbuf2;
|
|
|
073263 |
# ifdef USE_INPUT_BUF
|
|
|
073263 |
set_input_buf(tp->save_inputbuf);
|
|
|
073263 |
# endif
|
|
|
073263 |
***************
|
|
|
073263 |
*** 1992,1998 ****
|
|
|
073263 |
typeahead_char = 0;
|
|
|
073263 |
}
|
|
|
073263 |
else
|
|
|
073263 |
! c = read_stuff(advance);
|
|
|
073263 |
if (c != NUL && !got_int)
|
|
|
073263 |
{
|
|
|
073263 |
if (advance)
|
|
|
073263 |
--- 2033,2039 ----
|
|
|
073263 |
typeahead_char = 0;
|
|
|
073263 |
}
|
|
|
073263 |
else
|
|
|
073263 |
! c = read_readbuffers(advance);
|
|
|
073263 |
if (c != NUL && !got_int)
|
|
|
073263 |
{
|
|
|
073263 |
if (advance)
|
|
|
073263 |
*** ../vim-7.4.170/src/globals.h 2013-11-09 03:31:45.000000000 +0100
|
|
|
073263 |
--- src/globals.h 2014-02-11 14:17:44.070063200 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 979,989 ****
|
|
|
073263 |
EXTERN int readonlymode INIT(= FALSE); /* Set to TRUE for "view" */
|
|
|
073263 |
EXTERN int recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */
|
|
|
073263 |
|
|
|
073263 |
- EXTERN struct buffheader stuffbuff /* stuff buffer */
|
|
|
073263 |
- #ifdef DO_INIT
|
|
|
073263 |
- = {{NULL, {NUL}}, NULL, 0, 0}
|
|
|
073263 |
- #endif
|
|
|
073263 |
- ;
|
|
|
073263 |
EXTERN typebuf_T typebuf /* typeahead buffer */
|
|
|
073263 |
#ifdef DO_INIT
|
|
|
073263 |
= {NULL, NULL, 0, 0, 0, 0, 0, 0, 0}
|
|
|
073263 |
--- 979,984 ----
|
|
|
073263 |
*** ../vim-7.4.170/src/normal.c 2014-01-14 13:18:53.000000000 +0100
|
|
|
073263 |
--- src/normal.c 2014-02-11 14:53:54.246096453 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 655,662 ****
|
|
|
073263 |
#ifdef FEAT_EVAL
|
|
|
073263 |
/* Set v:count here, when called from main() and not a stuffed
|
|
|
073263 |
* command, so that v:count can be used in an expression mapping
|
|
|
073263 |
! * when there is no count. */
|
|
|
073263 |
! if (toplevel && stuff_empty())
|
|
|
073263 |
set_vcount_ca(&ca, &set_prevcount);
|
|
|
073263 |
#endif
|
|
|
073263 |
|
|
|
073263 |
--- 655,662 ----
|
|
|
073263 |
#ifdef FEAT_EVAL
|
|
|
073263 |
/* Set v:count here, when called from main() and not a stuffed
|
|
|
073263 |
* command, so that v:count can be used in an expression mapping
|
|
|
073263 |
! * when there is no count. Do set it for redo. */
|
|
|
073263 |
! if (toplevel && readbuf1_empty())
|
|
|
073263 |
set_vcount_ca(&ca, &set_prevcount);
|
|
|
073263 |
#endif
|
|
|
073263 |
|
|
|
073263 |
***************
|
|
|
073263 |
*** 736,743 ****
|
|
|
073263 |
#ifdef FEAT_EVAL
|
|
|
073263 |
/* Set v:count here, when called from main() and not a stuffed
|
|
|
073263 |
* command, so that v:count can be used in an expression mapping
|
|
|
073263 |
! * right after the count. */
|
|
|
073263 |
! if (toplevel && stuff_empty())
|
|
|
073263 |
set_vcount_ca(&ca, &set_prevcount);
|
|
|
073263 |
#endif
|
|
|
073263 |
if (ctrl_w)
|
|
|
073263 |
--- 736,743 ----
|
|
|
073263 |
#ifdef FEAT_EVAL
|
|
|
073263 |
/* Set v:count here, when called from main() and not a stuffed
|
|
|
073263 |
* command, so that v:count can be used in an expression mapping
|
|
|
073263 |
! * right after the count. Do set it for redo. */
|
|
|
073263 |
! if (toplevel && readbuf1_empty())
|
|
|
073263 |
set_vcount_ca(&ca, &set_prevcount);
|
|
|
073263 |
#endif
|
|
|
073263 |
if (ctrl_w)
|
|
|
073263 |
***************
|
|
|
073263 |
*** 819,826 ****
|
|
|
073263 |
#ifdef FEAT_EVAL
|
|
|
073263 |
/*
|
|
|
073263 |
* Only set v:count when called from main() and not a stuffed command.
|
|
|
073263 |
*/
|
|
|
073263 |
! if (toplevel && stuff_empty())
|
|
|
073263 |
set_vcount(ca.count0, ca.count1, set_prevcount);
|
|
|
073263 |
#endif
|
|
|
073263 |
|
|
|
073263 |
--- 819,827 ----
|
|
|
073263 |
#ifdef FEAT_EVAL
|
|
|
073263 |
/*
|
|
|
073263 |
* Only set v:count when called from main() and not a stuffed command.
|
|
|
073263 |
+ * Do set it for redo.
|
|
|
073263 |
*/
|
|
|
073263 |
! if (toplevel && readbuf1_empty())
|
|
|
073263 |
set_vcount(ca.count0, ca.count1, set_prevcount);
|
|
|
073263 |
#endif
|
|
|
073263 |
|
|
|
073263 |
*** ../vim-7.4.170/src/proto/getchar.pro 2013-08-10 13:37:12.000000000 +0200
|
|
|
073263 |
--- src/proto/getchar.pro 2014-02-11 14:55:14.806097687 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 1,8 ****
|
|
|
073263 |
/* getchar.c */
|
|
|
073263 |
! void free_buff __ARGS((struct buffheader *buf));
|
|
|
073263 |
char_u *get_recorded __ARGS((void));
|
|
|
073263 |
char_u *get_inserted __ARGS((void));
|
|
|
073263 |
int stuff_empty __ARGS((void));
|
|
|
073263 |
void typeahead_noflush __ARGS((int c));
|
|
|
073263 |
void flush_buffers __ARGS((int flush_typeahead));
|
|
|
073263 |
void ResetRedobuff __ARGS((void));
|
|
|
073263 |
--- 1,9 ----
|
|
|
073263 |
/* getchar.c */
|
|
|
073263 |
! void free_buff __ARGS((buffheader_T *buf));
|
|
|
073263 |
char_u *get_recorded __ARGS((void));
|
|
|
073263 |
char_u *get_inserted __ARGS((void));
|
|
|
073263 |
int stuff_empty __ARGS((void));
|
|
|
073263 |
+ int readbuf1_empty __ARGS((void));
|
|
|
073263 |
void typeahead_noflush __ARGS((int c));
|
|
|
073263 |
void flush_buffers __ARGS((int flush_typeahead));
|
|
|
073263 |
void ResetRedobuff __ARGS((void));
|
|
|
073263 |
*** ../vim-7.4.170/src/structs.h 2013-11-12 04:43:57.000000000 +0100
|
|
|
073263 |
--- src/structs.h 2014-02-11 14:35:43.606079741 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 471,483 ****
|
|
|
073263 |
blocknr_T nt_new_bnum; /* new, positive, number */
|
|
|
073263 |
};
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
* structure used to store one block of the stuff/redo/recording buffers
|
|
|
073263 |
*/
|
|
|
073263 |
struct buffblock
|
|
|
073263 |
{
|
|
|
073263 |
! struct buffblock *b_next; /* pointer to next buffblock */
|
|
|
073263 |
! char_u b_str[1]; /* contents (actually longer) */
|
|
|
073263 |
};
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
--- 471,487 ----
|
|
|
073263 |
blocknr_T nt_new_bnum; /* new, positive, number */
|
|
|
073263 |
};
|
|
|
073263 |
|
|
|
073263 |
+
|
|
|
073263 |
+ typedef struct buffblock buffblock_T;
|
|
|
073263 |
+ typedef struct buffheader buffheader_T;
|
|
|
073263 |
+
|
|
|
073263 |
/*
|
|
|
073263 |
* structure used to store one block of the stuff/redo/recording buffers
|
|
|
073263 |
*/
|
|
|
073263 |
struct buffblock
|
|
|
073263 |
{
|
|
|
073263 |
! buffblock_T *b_next; /* pointer to next buffblock */
|
|
|
073263 |
! char_u b_str[1]; /* contents (actually longer) */
|
|
|
073263 |
};
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
***************
|
|
|
073263 |
*** 485,494 ****
|
|
|
073263 |
*/
|
|
|
073263 |
struct buffheader
|
|
|
073263 |
{
|
|
|
073263 |
! struct buffblock bh_first; /* first (dummy) block of list */
|
|
|
073263 |
! struct buffblock *bh_curr; /* buffblock for appending */
|
|
|
073263 |
! int bh_index; /* index for reading */
|
|
|
073263 |
! int bh_space; /* space in bh_curr for appending */
|
|
|
073263 |
};
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
--- 489,498 ----
|
|
|
073263 |
*/
|
|
|
073263 |
struct buffheader
|
|
|
073263 |
{
|
|
|
073263 |
! buffblock_T bh_first; /* first (dummy) block of list */
|
|
|
073263 |
! buffblock_T *bh_curr; /* buffblock for appending */
|
|
|
073263 |
! int bh_index; /* index for reading */
|
|
|
073263 |
! int bh_space; /* space in bh_curr for appending */
|
|
|
073263 |
};
|
|
|
073263 |
|
|
|
073263 |
/*
|
|
|
073263 |
***************
|
|
|
073263 |
*** 964,970 ****
|
|
|
073263 |
int typebuf_valid; /* TRUE when save_typebuf valid */
|
|
|
073263 |
int old_char;
|
|
|
073263 |
int old_mod_mask;
|
|
|
073263 |
! struct buffheader save_stuffbuff;
|
|
|
073263 |
#ifdef USE_INPUT_BUF
|
|
|
073263 |
char_u *save_inputbuf;
|
|
|
073263 |
#endif
|
|
|
073263 |
--- 968,975 ----
|
|
|
073263 |
int typebuf_valid; /* TRUE when save_typebuf valid */
|
|
|
073263 |
int old_char;
|
|
|
073263 |
int old_mod_mask;
|
|
|
073263 |
! buffheader_T save_readbuf1;
|
|
|
073263 |
! buffheader_T save_readbuf2;
|
|
|
073263 |
#ifdef USE_INPUT_BUF
|
|
|
073263 |
char_u *save_inputbuf;
|
|
|
073263 |
#endif
|
|
|
073263 |
*** ../vim-7.4.170/src/version.c 2014-02-11 12:15:39.781950970 +0100
|
|
|
073263 |
--- src/version.c 2014-02-11 15:05:17.306106920 +0100
|
|
|
073263 |
***************
|
|
|
073263 |
*** 740,741 ****
|
|
|
073263 |
--- 740,743 ----
|
|
|
073263 |
{ /* Add new patch number below this line */
|
|
|
073263 |
+ /**/
|
|
|
073263 |
+ 171,
|
|
|
073263 |
/**/
|
|
|
073263 |
|
|
|
073263 |
--
|
|
|
073263 |
Linux is just like a wigwam: no Windows, no Gates and an Apache inside.
|
|
|
073263 |
|
|
|
073263 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
073263 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
073263 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
073263 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|