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
This commit is contained in:
David Lawrence Ramsey 2004-12-31 04:10:28 +00:00
parent 0d847aadd9
commit 3e81914b82
5 changed files with 12 additions and 10 deletions

View File

@ -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().

View File

@ -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));

View File

@ -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(&quote_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(&current->data[current_x + key_len],
&current->data[current_x],
current_len - current_x + key_len);

View File

@ -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. */

View File

@ -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;
}