Commit aad85151 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

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
parent 7ec8d7c6
Showing with 10 additions and 12 deletions
+10 -12
...@@ -21,6 +21,10 @@ CVS code - ...@@ -21,6 +21,10 @@ CVS code -
- Fix erroneous #ifdef that resulted in the -d/--rebinddelete - Fix erroneous #ifdef that resulted in the -d/--rebinddelete
and -k/--cut options' not being printed when NANO_SMALL was and -k/--cut options' not being printed when NANO_SMALL was
defined. (DLR) 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: - utils.c:
regexec_safe() regexec_safe()
- Rename to safe_regexec() for consistency. (DLR) - Rename to safe_regexec() for consistency. (DLR)
......
...@@ -3114,8 +3114,9 @@ void do_justify(bool full_justify) ...@@ -3114,8 +3114,9 @@ void do_justify(bool full_justify)
assert(break_pos < line_len); assert(break_pos < line_len);
/* Make a new line and copy the text after where we broke /* Make a new line, and copy the text after where we're
* this line to the beginning of the new line. */ * going to break this line to the beginning of the new
* line. */
splice_node(current, make_new_node(current), current->next); splice_node(current, make_new_node(current), current->next);
/* If this paragraph is non-quoted, and autoindent isn't /* If this paragraph is non-quoted, and autoindent isn't
...@@ -3136,7 +3137,7 @@ void do_justify(bool full_justify) ...@@ -3136,7 +3137,7 @@ void do_justify(bool full_justify)
par_len++; par_len++;
totlines++; totlines++;
totsize += indent_len; totsize += indent_len + 1;
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* Adjust the mark coordinates to compensate for the change /* Adjust the mark coordinates to compensate for the change
...@@ -3147,15 +3148,8 @@ void do_justify(bool full_justify) ...@@ -3147,15 +3148,8 @@ void do_justify(bool full_justify)
} }
#endif #endif
/* Break the line, and add the space back to where we broke /* Break the line at the character just after the space. */
* it. */ null_at(&current->data, break_pos + 1);
null_at(&current->data, break_pos);
current->data = charealloc(current->data, break_pos + 2);
current->data[break_pos] = ' ';
current->data[break_pos + 1] = '\0';
totsize++;
/* Go to the next line. */ /* Go to the next line. */
par_len--; par_len--;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment