commit 3e81914b8275ab5cb5640dbfdbf191fda68e053c
parent 0d847aadd9159109dbddc4493322e84855f219a9
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Fri, 31 Dec 2004 04:10:28 +0000
miscellaneous bits: fix the full justify segfault in a way that doesn't
break some normal full justifies, do a few more int -> bool conversions,
and fix a comment
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2209 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
5 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -1213,7 +1213,7 @@ void init_operating_dir(void)
* are, or 1 otherwise. If allow_tabcomp is nonzero, allow incomplete
* names that would be matches for the operating directory, so that tab
* completion will work. */
-int check_operating_dir(const char *currpath, int allow_tabcomp)
+int check_operating_dir(const char *currpath, bool allow_tabcomp)
{
/* The char *full_operating_dir is global for mem cleanup. It
* should have already been initialized by init_operating_dir().
diff --git a/src/move.c b/src/move.c
@@ -248,7 +248,7 @@ void do_down(void)
update_line(current, current_x);
}
-void do_left(int allow_update)
+void do_left(bool allow_update)
{
size_t pww_save = placewewant;
if (current_x > 0)
@@ -268,7 +268,7 @@ void do_left_void(void)
do_left(TRUE);
}
-void do_right(int allow_update)
+void do_right(bool allow_update)
{
size_t pww_save = placewewant;
assert(current_x <= strlen(current->data));
diff --git a/src/nano.c b/src/nano.c
@@ -2744,7 +2744,7 @@ void do_justify(bool full_justify)
* and break out of the loop. Otherwise, refresh the screen and
* get out. */
if (do_para_search("e_len, &par_len)) {
- if (full_justify && current != filebot) {
+ if (full_justify && first_par_line != filebot) {
last_par_line = filebot;
break;
} else {
@@ -3643,7 +3643,9 @@ void do_output(int *kbinput, size_t kbinput_len)
/* More dangerousness fun =) */
current->data = charealloc(current->data,
current_len + key_len + 1);
+
assert(current_x <= current_len);
+
charmove(¤t->data[current_x + key_len],
¤t->data[current_x],
current_len - current_x + key_len);
diff --git a/src/proto.h b/src/proto.h
@@ -214,7 +214,7 @@ char *safe_tempnam(const char *dirname, const char *filename_prefix);
#endif
#ifndef DISABLE_OPERATINGDIR
void init_operating_dir(void);
-int check_operating_dir(const char *currpath, int allow_tabcomp);
+int check_operating_dir(const char *currpath, bool allow_tabcomp);
#endif
#ifndef NANO_SMALL
void init_backup_dir(void);
@@ -282,9 +282,9 @@ void do_page_up(void);
void do_page_down(void);
void do_up(void);
void do_down(void);
-void do_left(int allow_update);
+void do_left(bool allow_update);
void do_left_void(void);
-void do_right(int allow_update);
+void do_right(bool allow_update);
void do_right_void(void);
/* Public functions in nano.c. */
diff --git a/src/search.c b/src/search.c
@@ -255,9 +255,9 @@ int search_init(bool replacing, bool use_answer)
#ifndef NANO_SMALL
search_history.current = search_history.next;
#endif
- /* Put answer up on the statusbar. */
- do_gotoline(-1, FALSE);
- /* Fall through. */
+ do_gotoline(-1, FALSE); /* Put answer up on the
+ * statusbar and fall
+ * through. */
default:
return -1;
}