1
1

when justifying, don't remove a space after a duplicate character in

punct anymore, as it doesn't really make us more compatible with Pico


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2369 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
David Lawrence Ramsey 2005-03-14 20:06:23 +00:00
родитель 7b918c76ee
Коммит 15540051ac
2 изменённых файлов: 41 добавлений и 67 удалений

Просмотреть файл

@ -176,9 +176,11 @@ CVS code -
duplicating code. Also overhaul the justify code to make it duplicating code. Also overhaul the justify code to make it
leave the right number of spaces at the ends of the lines of a leave the right number of spaces at the ends of the lines of a
paragraph, to make it (partially) support multibyte paragraph, to make it (partially) support multibyte
characters, and to make it simpler. New functions characters, and to make it simpler. Also, don't remove a
do_para_begin_void() and do_para_end_void(); changes to space after a duplicate character in punct anymore, as it
justify_format(), do_para_begin(), inpar(), do_para_end(), doesn't really make us more compatible with Pico. New
functions do_para_begin_void() and do_para_end_void(); changes
to justify_format(), do_para_begin(), inpar(), do_para_end(),
break_line(), do_para_search() (renamed find_paragraph()), and break_line(), do_para_search() (renamed find_paragraph()), and
do_justify(); removal of breakable(). (DLR) do_justify(); removal of breakable(). (DLR)
- Still more steps toward full wide/multibyte character support. - Still more steps toward full wide/multibyte character support.

Просмотреть файл

@ -2353,9 +2353,8 @@ size_t indent_length(const char *line)
#ifndef DISABLE_JUSTIFY #ifndef DISABLE_JUSTIFY
/* justify_format() replaces blanks with spaces and multiple spaces by 1 /* justify_format() replaces blanks with spaces and multiple spaces by 1
* (except it maintains 2 after a non-repeated character in punct * (except it maintains up to 2 after a character in punct optionally
* followed by a character in brackets, and removes all at the end of * followed by a character in brackets, and removes all from the end).
* the line).
* *
* justify_format() might make line->data shorter, and change the actual * justify_format() might make line->data shorter, and change the actual
* pointer with null_at(). * pointer with null_at().
@ -2393,82 +2392,54 @@ void justify_format(filestruct *paragraph, size_t skip)
while (*end != '\0' && is_blank_char(*end)) { while (*end != '\0' && is_blank_char(*end)) {
end++; end++;
shift++; shift++;
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* Keep track of the change in the current line. */
if (mark_beginbuf == paragraph && if (mark_beginbuf == paragraph &&
mark_beginx >= end - paragraph->data) mark_beginx >= end - paragraph->data)
mark_shift++; mark_shift++;
#endif #endif
} }
/* If this character is punctuation, there are two ways we can /* If this character is punctuation optionally followed by a
* handle it. */ * bracket and then followed by blanks, make sure there are no
* more than two blanks after it, and make sure that the blanks
* are spaces. */
} else if (strchr(punct, *end) != NULL) { } else if (strchr(punct, *end) != NULL) {
*new_end = *end; *new_end = *end;
new_end++; new_end++;
end++; end++;
/* If this character is punctuation followed by itself and if (*end != '\0' && strchr(brackets, *end) != NULL) {
* optionally followed by a bracket, make sure there is no
* more than one blank after it, and make sure that the
* blank is a space. */
if (*end != '\0' && *end == *(end - 1)) {
*new_end = *end; *new_end = *end;
new_end++; new_end++;
end++; end++;
if (*end != '\0' && strchr(brackets, *end) != NULL) {
*new_end = *end;
new_end++;
end++;
}
if (*end != '\0' && is_blank_char(*end)) {
*new_end = ' ';
new_end++;
end++;
}
while (*end != '\0' && is_blank_char(*end)) {
end++;
shift++;
#ifndef NANO_SMALL
if (mark_beginbuf == paragraph &&
mark_beginx >= end - paragraph->data)
mark_shift++;
#endif
}
/* If this character is punctuation optionally followed by a
* bracket and then followed by spaces, make sure there are
* no more than two blanks after it, and make sure that the
* blanks are spaces. */
} else {
if (*end != '\0' && strchr(brackets, *end) != NULL) {
*new_end = *end;
new_end++;
end++;
}
if (*end != '\0' && is_blank_char(*end)) {
*new_end = ' ';
new_end++;
end++;
}
if (*end != '\0' && is_blank_char(*end)) {
*new_end = ' ';
new_end++;
end++;
}
while (*end != '\0' && is_blank_char(*end)) {
end++;
shift++;
#ifndef NANO_SMALL
if (mark_beginbuf == paragraph &&
mark_beginx >= end - paragraph->data)
mark_shift++;
#endif
}
} }
if (*end != '\0' && is_blank_char(*end)) {
*new_end = ' ';
new_end++;
end++;
}
if (*end != '\0' && is_blank_char(*end)) {
*new_end = ' ';
new_end++;
end++;
}
while (*end != '\0' && is_blank_char(*end)) {
end++;
shift++;
#ifndef NANO_SMALL
/* Keep track of the change in the current line. */
if (mark_beginbuf == paragraph &&
mark_beginx >= end - paragraph->data)
mark_shift++;
#endif
}
/* If this character is neither blank nor punctuation, leave it
* alone. */
} else { } else {
*new_end = *end; *new_end = *end;
new_end++; new_end++;
@ -2480,6 +2451,7 @@ void justify_format(filestruct *paragraph, size_t skip)
*new_end = *end; *new_end = *end;
/* Make sure that there are no spaces at the end of the line. */
while (new_end > new_paragraph_data + skip && while (new_end > new_paragraph_data + skip &&
*(new_end - 1) == ' ') { *(new_end - 1) == ' ') {
new_end--; new_end--;