tweaks: reshuffle some lines, to reduce duplication
Этот коммит содержится в:
родитель
a77b21388a
Коммит
e98847200e
11
src/text.c
11
src/text.c
@ -3058,11 +3058,12 @@ void do_wordlinechar_count(void)
|
|||||||
words++;
|
words++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the total line and character counts, as "wc -l" and "wc -c"
|
/* Get the number of lines, similar to what "wc -l" gives. */
|
||||||
* do, but get the latter in multibyte characters. */
|
lines = openfile->filebot->lineno - openfile->filetop->lineno +
|
||||||
|
((openfile->filebot->data[0] == '\0') ? 0 : 1);
|
||||||
|
|
||||||
|
/* Get the number of multibyte characters, similar to "wc -c". */
|
||||||
if (was_mark) {
|
if (was_mark) {
|
||||||
lines = openfile->filebot->lineno - openfile->filetop->lineno + 1;
|
|
||||||
lines -= (openfile->filebot->data[0] == '\0') ? 1 : 0;
|
|
||||||
chars = get_totsize(openfile->filetop, openfile->filebot);
|
chars = get_totsize(openfile->filetop, openfile->filebot);
|
||||||
|
|
||||||
/* Unpartition the buffer so that it contains all the text
|
/* Unpartition the buffer so that it contains all the text
|
||||||
@ -3070,8 +3071,6 @@ void do_wordlinechar_count(void)
|
|||||||
unpartition_buffer(&filepart);
|
unpartition_buffer(&filepart);
|
||||||
openfile->mark = was_mark;
|
openfile->mark = was_mark;
|
||||||
} else {
|
} else {
|
||||||
lines = openfile->filebot->lineno;
|
|
||||||
lines -= (openfile->filebot->data[0] == '\0') ? 1 : 0;
|
|
||||||
chars = openfile->totsize;
|
chars = openfile->totsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user