tweaks: reshuffle two lines, and reword a comment
parent
2a2fe7208a
commit
c224ea3ce7
11
src/text.c
11
src/text.c
|
@ -1669,15 +1669,14 @@ void squeeze(linestruct *line, size_t skip)
|
||||||
{
|
{
|
||||||
char *from, *to, *newdata;
|
char *from, *to, *newdata;
|
||||||
size_t shrunk = 0;
|
size_t shrunk = 0;
|
||||||
|
int charlen;
|
||||||
|
|
||||||
from = line->data + skip;
|
|
||||||
newdata = charalloc(strlen(line->data) + 1);
|
newdata = charalloc(strlen(line->data) + 1);
|
||||||
strncpy(newdata, line->data, skip);
|
strncpy(newdata, line->data, skip);
|
||||||
|
from = line->data + skip;
|
||||||
to = newdata + skip;
|
to = newdata + skip;
|
||||||
|
|
||||||
while (*from != '\0') {
|
while (*from != '\0') {
|
||||||
int charlen;
|
|
||||||
|
|
||||||
/* If this character is blank, change it to a space,
|
/* If this character is blank, change it to a space,
|
||||||
* and pass over all blanks after it. */
|
* and pass over all blanks after it. */
|
||||||
if (is_blank_mbchar(from)) {
|
if (is_blank_mbchar(from)) {
|
||||||
|
@ -1689,9 +1688,9 @@ void squeeze(linestruct *line, size_t skip)
|
||||||
from += charlen;
|
from += charlen;
|
||||||
shrunk += charlen;
|
shrunk += charlen;
|
||||||
}
|
}
|
||||||
/* If this character is punctuation optionally followed by a bracket
|
/* If this character is punctuation, then copy it plus a possible
|
||||||
* and then followed by blanks, change no more than two of the blanks
|
* bracket, and change at most two of subsequent blanks to spaces,
|
||||||
* to spaces if necessary, and pass over all blanks after them. */
|
* and pass over all blanks after these. */
|
||||||
} else if (mbstrchr(punct, from) != NULL) {
|
} else if (mbstrchr(punct, from) != NULL) {
|
||||||
charlen = parse_mbchar(from, NULL, NULL);
|
charlen = parse_mbchar(from, NULL, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue