summaryrefslogtreecommitdiff
path: root/nanobox.c
diff options
context:
space:
mode:
Diffstat (limited to 'nanobox.c')
-rw-r--r--nanobox.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/nanobox.c b/nanobox.c
index 781ff4b..fec354c 100644
--- a/nanobox.c
+++ b/nanobox.c
@@ -634,12 +634,12 @@ static void showmatching(char *); // show the matching pair () [] {}
int nano_stdio_mode = 0;
#endif
#if ENABLE_FEATURE_NANO_YANKMARK || ENABLE_FEATURE_NANO_SEARCH || ENABLE_FEATURE_NANO_CRASHME
-// might reallocate text[]! use p += string_insert(p, ...),
+// might reallocate text[]! use p = string_insert(p, ...),
// and be careful to not use pointers into potentially freed text[]!
# if !ENABLE_FEATURE_NANO_UNDO
#define string_insert(a,b,c) string_insert(a,b)
# endif
-static uintptr_t string_insert(char *, const char *, int); // insert the string at 'p'
+static char *string_insert(char *, const char *, int); // insert the string at 'p'
#endif
#if ENABLE_FEATURE_NANO_YANKMARK
static char *text_yank(char *, char *); // save copy of "p" into a register
@@ -1897,7 +1897,7 @@ static void show_help(void)
|| ENABLE_FEATURE_NANO_CRASHME
// might reallocate text[]! use p += string_insert(p, ...),
// and be careful to not use pointers into potentially freed text[]!
-static uintptr_t string_insert(char *p, const char *s, int undo) // insert the string at 'p'
+static char * string_insert(char *p, const char *s, int undo) // insert the string at 'p'
{
uintptr_t bias;
int i;
@@ -1926,7 +1926,7 @@ static uintptr_t string_insert(char *p, const char *s, int undo) // insert the s
if (cnt > 4) status_line("Put %d lines (%d chars)", cnt, i);
}
#endif
- return bias;
+ return p;
}
#endif
@@ -2764,7 +2764,7 @@ static void newline_cmd(void)
s = xstrndup(a, (b - a));
s[b - a];
dot = char_insert(dot, '\n', ALLOW_UNDO_QUEUED);
- dot += string_insert(dot, s, ALLOW_UNDO) + b - a;
+ dot = string_insert(dot, s, ALLOW_UNDO) + b - a;
free(s);
} else {
dot = char_insert(dot, '\n', ALLOW_UNDO_QUEUED);
@@ -2948,7 +2948,7 @@ static void do_cmd(int c)
status_line_bold("Nothing in clipboard");
break;
}
- dot += string_insert(dot, clipboard, ALLOW_UNDO); // insert the string
+ dot = string_insert(dot, clipboard, ALLOW_UNDO); // insert the string
yank_append = 0;
break;
#endif