Commit 428f6203 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

DB's justify fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1450 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 25 additions and 10 deletions
+25 -10
...@@ -20,15 +20,21 @@ CVS code ...@@ -20,15 +20,21 @@ CVS code
- Fix assumption that matches is null terminated (David - Fix assumption that matches is null terminated (David
Benbennick). Benbennick).
- nano.c: - nano.c:
main() breakable()
- Fix nano not compiling with ENABLE_RCFILE and DISABLE_TABCOMP - Fix incorrect return value on short lines (David Benbennick).
(David Benbennick).
help_init()
- Fix crashing in do_help when COLS < 23 (David Benbennick).
do_help() do_help()
- Fix line lengths not being computed properly, causes display - Fix line lengths not being computed properly, causes display
glitches most noticeable with < 20 rows. New function glitches most noticeable with < 20 rows. New function
nano.c:line_len(). (David Benbennick). nano.c:line_len(). (David Benbennick).
do_justify()
- Add regfree() to quote regex (David Benbennick).
- Only copy previous indent if AUTOINDENT is set (David
Benbennick).
help_init()
- Fix crashing in do_help when COLS < 23 (David Benbennick).
main()
- Fix nano not compiling with ENABLE_RCFILE and DISABLE_TABCOMP
(David Benbennick).
- rcfile.c: - rcfile.c:
colortoint() colortoint()
- Don't bomb after invalid color and print bad color name - Don't bomb after invalid color and print bad color name
......
...@@ -2225,7 +2225,9 @@ int breakable(const char *line, int goal) ...@@ -2225,7 +2225,9 @@ int breakable(const char *line, int goal)
else else
goal -= 1; goal -= 1;
} }
return FALSE; /* If goal is not negative, the whole line (one word) was short
* enough. */
return goal >= 0;
} }
/* We are trying to break a chunk off line. We find the last space such /* We are trying to break a chunk off line. We find the last space such
...@@ -2400,10 +2402,10 @@ int do_justify(void) ...@@ -2400,10 +2402,10 @@ int do_justify(void)
/* There is no next paragraph, so nothing to justify. */ /* There is no next paragraph, so nothing to justify. */
if (current->next == NULL) { if (current->next == NULL) {
placewewant = 0; placewewant = 0;
if (current_y > editwinrows - 1) edit_refresh();
edit_update(current, CENTER); #ifdef HAVE_REGEX_H
else regfree(&qreg);
edit_refresh(); #endif
return 0; return 0;
} }
current = current->next; current = current->next;
...@@ -2486,6 +2488,13 @@ int do_justify(void) ...@@ -2486,6 +2488,13 @@ int do_justify(void)
* line and copy text after break_pos into it. */ * line and copy text after break_pos into it. */
splice_node(current, make_new_node(current), splice_node(current, make_new_node(current),
current->next); current->next);
/* In a non-quoted paragraph, we copy the indent only if
AUTOINDENT is turned on. */
if (quote_len == 0)
#ifndef NANO_SMALL
if (!ISSET(AUTOINDENT))
#endif
indent_len = 0;
current->next->data = charalloc(indent_len + line_len - current->next->data = charalloc(indent_len + line_len -
break_pos); break_pos);
strncpy(current->next->data, current->data, strncpy(current->next->data, current->data,
......
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