tlbuf: save before jump mark in undo buffer - neatvi - [fork] simple vi-type editor with UTF-8 support
(HTM) git clone git://src.adamsgaard.dk/neatvi
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit ff0bb634c4421809714974d432ce1b7fefb33c90
(DIR) parent 9c04d34f7e9c3f9478e69744e40e2e8b70c8e9a6
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Thu, 26 Nov 2015 08:06:13 +0330
lbuf: save before jump mark in undo buffer
Diffstat:
M lbuf.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
---
(DIR) diff --git a/lbuf.c b/lbuf.c
t@@ -5,7 +5,8 @@
#include <unistd.h>
#include "vi.h"
-#define NMARKS 32
+#define NMARKS_BASE ('z' - 'a' + 2)
+#define NMARKS 32
/* line operations */
struct lopt {
t@@ -77,12 +78,14 @@ static int markidx(int mark)
{
if (islower(mark))
return mark - 'a';
- if (mark == '*')
+ if (mark == '\'' || mark == '`')
return 'z' - 'a' + 1;
- if (mark == '[')
+ if (mark == '*')
return 'z' - 'a' + 2;
- if (mark == ']')
+ if (mark == '[')
return 'z' - 'a' + 3;
+ if (mark == ']')
+ return 'z' - 'a' + 4;
return -1;
}
t@@ -192,7 +195,7 @@ static void lbuf_opt(struct lbuf *lb, char *buf, int pos, int n_del)
lo->ins = buf ? uc_dup(buf) : NULL;
lo->seq = lb->useq;
lbuf_savepos(lb, lo);
- for (i = 0; i < 'z' - 'a' + 1; i++)
+ for (i = 0; i < NMARKS_BASE; i++)
if (lb->mark[i] >= pos && lb->mark[i] < pos + n_del)
lbuf_savemark(lb, lo, i);
}