treg: numeric buffers - 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 881d54517a9ce3a460cbfbf53c3efc323abd04d4
(DIR) parent 2b735a5576c57027328c3b46e8dadc626423b10e
(HTM) Author: Ali Gholami Rudi <ali@rudi.ir>
Date: Wed, 10 Jun 2015 14:39:24 +0430
reg: numeric buffers
Diffstat:
M reg.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/reg.c b/reg.c
t@@ -12,7 +12,7 @@ char *reg_get(int c, int *ln)
return bufs[c];
}
-void reg_put(int c, char *s, int ln)
+static void reg_putraw(int c, char *s, int ln)
{
char *pre = isupper(c) ? bufs[tolower(c)] : "";
char *buf = malloc(strlen(pre) + strlen(s) + 1);
t@@ -23,6 +23,19 @@ void reg_put(int c, char *s, int ln)
lnmode[tolower(c)] = ln;
}
+void reg_put(int c, char *s, int ln)
+{
+ int i, i_ln;
+ char *i_s;
+ if (ln || strchr(s, '\n')) {
+ for (i = 8; i > 0; i--)
+ if ((i_s = reg_get('0' + i, &i_ln)))
+ reg_putraw('0' + i + 1, i_s, i_ln);
+ reg_putraw('1', s, ln);
+ }
+ reg_putraw(c, s, ln);
+}
+
void reg_done(void)
{
int i;