remove some unneeded edit_update()s in do_para_search() and do_justify()

per DB's patch, and simplify an if statement in do_justify()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1742 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-05-17 16:11:18 +00:00
parent 1d43db879e
commit 7097d7b6d2
2 changed files with 27 additions and 34 deletions

View File

@ -51,6 +51,9 @@ CVS code -
- Tweak for efficiency. (David Benbennick)
justify_format()
- Remove redundant assignment. (DLR)
do_para_search(), do_justify()
- Remove unneeded edit_update() calls. (David Benbennick)
- Simplify an if statement. (DLR)
do_exit()
- Refactor so that no recursion is needed if we try to exit with
a modified file that has no name when TEMP_OPT is set. (DLR)

View File

@ -2218,8 +2218,9 @@ int do_para_search(int search_type, size_t *quote, size_t *par, size_t
restart_para_search:
/* Here we find the first line of the paragraph to search. If the
* current line is in a paragraph, then we move back to the first line.
* Otherwise we move to the first line that is in a paragraph. */
* current line is in a paragraph, then we move back to the first
* line. Otherwise, we move to the first line that is in a
* paragraph. */
quote_len = quote_length(IFREG(current->data, &qreg));
indent_len = indent_length(current->data + quote_len);
@ -2240,8 +2241,7 @@ int do_para_search(int search_type, size_t *quote, size_t *par, size_t
#ifndef NANO_SMALL
&& !ISSET(AUTOINDENT)
#endif
) ||
!indents_match(current->prev->data + quote_len,
) || !indents_match(current->prev->data + quote_len,
temp_id_len, current->data + quote_len, indent_len))
break;
indent_len = temp_id_len;
@ -2255,12 +2255,8 @@ int do_para_search(int search_type, size_t *quote, size_t *par, size_t
/* There is no previous paragraph, so nothing to move to. */
if (current->prev == NULL) {
placewewant = 0;
if (do_refresh) {
if (current_y < 0)
edit_update(current, CENTER);
else
if (do_refresh)
edit_refresh();
}
#ifdef HAVE_REGEX_H
if (!do_restart)
regfree(&qreg);
@ -2294,10 +2290,11 @@ int do_para_search(int search_type, size_t *quote, size_t *par, size_t
} while (current->data[quote_len + indent_len] == '\0');
}
/* Now current is the first line of the paragraph, and quote_len is the
* quotation length of that line. */
/* Now current is the first line of the paragraph, and quote_len is
* the quotation length of that line. */
/* Next step, compute par_len, the number of lines in this paragraph. */
/* Next step, compute par_len, the number of lines in this
* paragraph. */
line = current;
par_len = 1;
indent_len = indent_length(line->data + quote_len);
@ -2370,13 +2367,8 @@ int do_para_search(int search_type, size_t *quote, size_t *par, size_t
}
/* Refresh the screen if needed. */
if (do_refresh) {
if (((search_type == 0 || search_type == 2) && current_y >
editwinrows - 1) || (search_type == 1 && current_y < 0))
edit_update(current, CENTER);
else
if (do_refresh)
edit_refresh();
}
/* Save the values of quote_len, par_len, and indent_len if
* needed. */
@ -2515,10 +2507,11 @@ int do_justify(int full_justify)
splice_node(current, make_new_node(current), current->next);
/* In a non-quoted paragraph, we copy the indent
* only if AUTOINDENT is turned on. */
if (quote_len == 0)
if (quote_len == 0
#ifndef NANO_SMALL
if (!ISSET(AUTOINDENT))
&& !ISSET(AUTOINDENT)
#endif
)
indent_len = 0;
current->next->data = charalloc(indent_len + line_len -
break_pos);
@ -2648,9 +2641,6 @@ int do_justify(int full_justify)
} /* while (TRUE) */
if (current_y > editwinrows - 1)
edit_update(current, CENTER);
else
edit_refresh();
statusbar(_("Can now UnJustify!"));