mirror of git://git.sv.gnu.org/nano.git
in do_justify(), instead of breaking a line at a space and readding the
space afterwards, just break the line after the space, as it's more efficient git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2412 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
7ec8d7c6a3
commit
aad85151ae
|
@ -21,6 +21,10 @@ CVS code -
|
|||
- Fix erroneous #ifdef that resulted in the -d/--rebinddelete
|
||||
and -k/--cut options' not being printed when NANO_SMALL was
|
||||
defined. (DLR)
|
||||
do_justify()
|
||||
- Instead of breaking a line at a space and readding the space
|
||||
afterwards, just break the line after the space, as it's more
|
||||
efficient. (DLR)
|
||||
- utils.c:
|
||||
regexec_safe()
|
||||
- Rename to safe_regexec() for consistency. (DLR)
|
||||
|
|
18
src/nano.c
18
src/nano.c
|
@ -3114,8 +3114,9 @@ void do_justify(bool full_justify)
|
|||
|
||||
assert(break_pos < line_len);
|
||||
|
||||
/* Make a new line and copy the text after where we broke
|
||||
* this line to the beginning of the new line. */
|
||||
/* Make a new line, and copy the text after where we're
|
||||
* going to break this line to the beginning of the new
|
||||
* line. */
|
||||
splice_node(current, make_new_node(current), current->next);
|
||||
|
||||
/* If this paragraph is non-quoted, and autoindent isn't
|
||||
|
@ -3136,7 +3137,7 @@ void do_justify(bool full_justify)
|
|||
|
||||
par_len++;
|
||||
totlines++;
|
||||
totsize += indent_len;
|
||||
totsize += indent_len + 1;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Adjust the mark coordinates to compensate for the change
|
||||
|
@ -3147,15 +3148,8 @@ void do_justify(bool full_justify)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Break the line, and add the space back to where we broke
|
||||
* it. */
|
||||
null_at(¤t->data, break_pos);
|
||||
|
||||
current->data = charealloc(current->data, break_pos + 2);
|
||||
current->data[break_pos] = ' ';
|
||||
current->data[break_pos + 1] = '\0';
|
||||
|
||||
totsize++;
|
||||
/* Break the line at the character just after the space. */
|
||||
null_at(¤t->data, break_pos + 1);
|
||||
|
||||
/* Go to the next line. */
|
||||
par_len--;
|
||||
|
|
Loading…
Reference in New Issue