miscellaneous bits: change flags to an unsigned long and totsize to a
size_t, store the number of multibyte characters instead of the number of single-byte characters in totsize, and add a few formatting fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2302 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
7c60eab744
commit
23c44504ad
|
@ -142,6 +142,13 @@ CVS code -
|
||||||
warnings or errors. Changes to cancel_fork(),
|
warnings or errors. Changes to cancel_fork(),
|
||||||
handle_hipterm(), do_suspend(), and do_cont(). (David
|
handle_hipterm(), do_suspend(), and do_cont(). (David
|
||||||
Benbennick)
|
Benbennick)
|
||||||
|
- Change flags to an unsigned long, and totsize to a size_t.
|
||||||
|
(DLR)
|
||||||
|
- Store the number of multibyte characters instead of the number
|
||||||
|
of single-byte characters in totsize, and use get_totals() to
|
||||||
|
get the value of totsize in a few more places. Changes to
|
||||||
|
read_line(), read_file(), do_delete(), do_input(),
|
||||||
|
get_totals(), and do_cursorpos(). (DLR)
|
||||||
- cut.c:
|
- cut.c:
|
||||||
do_cut_text()
|
do_cut_text()
|
||||||
- If keep_cutbuffer is FALSE, only blow away the text in the
|
- If keep_cutbuffer is FALSE, only blow away the text in the
|
||||||
|
|
27
src/files.c
27
src/files.c
|
@ -80,10 +80,8 @@ filestruct *read_line(char *buf, filestruct *prev, bool *first_line_ins,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
/* If it's a DOS file (CR LF), and file conversion isn't disabled,
|
/* If it's a DOS file (CR LF), and file conversion isn't disabled,
|
||||||
* strip out the CR part. */
|
* strip out the CR part. */
|
||||||
if (!ISSET(NO_CONVERT) && len > 0 && buf[len - 1] == '\r') {
|
if (!ISSET(NO_CONVERT) && len > 0 && buf[len - 1] == '\r')
|
||||||
fileptr->data[len - 1] = '\0';
|
fileptr->data[len - 1] = '\0';
|
||||||
totsize--;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (*first_line_ins || fileage == NULL) {
|
if (*first_line_ins || fileage == NULL) {
|
||||||
|
@ -131,6 +129,8 @@ void read_file(FILE *f, const char *filename)
|
||||||
{
|
{
|
||||||
size_t num_lines = 0;
|
size_t num_lines = 0;
|
||||||
/* The number of lines in the file. */
|
/* The number of lines in the file. */
|
||||||
|
size_t num_chars = 0;
|
||||||
|
/* The number of bytes in the file. */
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
/* The length of the current line of the file. */
|
/* The length of the current line of the file. */
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
@ -220,7 +220,6 @@ void read_file(FILE *f, const char *filename)
|
||||||
len = 1;
|
len = 1;
|
||||||
|
|
||||||
num_lines++;
|
num_lines++;
|
||||||
totsize++;
|
|
||||||
buf[0] = input;
|
buf[0] = input;
|
||||||
buf[1] = '\0';
|
buf[1] = '\0';
|
||||||
i = 1;
|
i = 1;
|
||||||
|
@ -238,11 +237,11 @@ void read_file(FILE *f, const char *filename)
|
||||||
bufx += 128;
|
bufx += 128;
|
||||||
buf = charealloc(buf, bufx);
|
buf = charealloc(buf, bufx);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[i] = input;
|
buf[i] = input;
|
||||||
buf[i + 1] = '\0';
|
buf[i + 1] = '\0';
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
totsize++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This conditional duplicates previous read_byte() behavior.
|
/* This conditional duplicates previous read_byte() behavior.
|
||||||
|
@ -255,9 +254,10 @@ void read_file(FILE *f, const char *filename)
|
||||||
/* If file conversion isn't disabled and the last character in this
|
/* If file conversion isn't disabled and the last character in this
|
||||||
* file is a CR, read it in properly as a Mac format line. */
|
* file is a CR, read it in properly as a Mac format line. */
|
||||||
if (len == 0 && !ISSET(NO_CONVERT) && input == '\r') {
|
if (len == 0 && !ISSET(NO_CONVERT) && input == '\r') {
|
||||||
|
len = 1;
|
||||||
|
|
||||||
buf[0] = input;
|
buf[0] = input;
|
||||||
buf[1] = '\0';
|
buf[1] = '\0';
|
||||||
len = 1;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -276,13 +276,13 @@ void read_file(FILE *f, const char *filename)
|
||||||
/* Read in the last line properly. */
|
/* Read in the last line properly. */
|
||||||
fileptr = read_line(buf, fileptr, &first_line_ins, len);
|
fileptr = read_line(buf, fileptr, &first_line_ins, len);
|
||||||
num_lines++;
|
num_lines++;
|
||||||
totsize++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
/* If we didn't get a file and we don't already have one, make a new
|
/* If we didn't get a file and we don't already have one, make a new
|
||||||
* file. */
|
* file. */
|
||||||
if (totsize == 0 || fileptr == NULL)
|
if (fileptr == NULL)
|
||||||
new_file();
|
new_file();
|
||||||
|
|
||||||
/* Did we try to insert a file of 0 bytes? */
|
/* Did we try to insert a file of 0 bytes? */
|
||||||
|
@ -296,10 +296,12 @@ void read_file(FILE *f, const char *filename)
|
||||||
} else if (fileptr->next == NULL) {
|
} else if (fileptr->next == NULL) {
|
||||||
filebot = fileptr;
|
filebot = fileptr;
|
||||||
new_magicline();
|
new_magicline();
|
||||||
totsize--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_totals(fileage, filebot, NULL, &num_chars);
|
||||||
|
totsize += num_chars;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
if (format == 3)
|
if (format == 3)
|
||||||
statusbar(
|
statusbar(
|
||||||
|
@ -319,7 +321,7 @@ void read_file(FILE *f, const char *filename)
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
statusbar(P_("Read %lu line", "Read %lu lines",
|
statusbar(P_("Read %lu line", "Read %lu lines",
|
||||||
(unsigned long)num_lines),(unsigned long)num_lines);
|
(unsigned long)num_lines), (unsigned long)num_lines);
|
||||||
|
|
||||||
totlines += num_lines;
|
totlines += num_lines;
|
||||||
}
|
}
|
||||||
|
@ -337,6 +339,7 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
||||||
struct stat fileinfo;
|
struct stat fileinfo;
|
||||||
|
|
||||||
assert(f != NULL);
|
assert(f != NULL);
|
||||||
|
|
||||||
if (filename == NULL || filename[0] == '\0' ||
|
if (filename == NULL || filename[0] == '\0' ||
|
||||||
stat(filename, &fileinfo) == -1) {
|
stat(filename, &fileinfo) == -1) {
|
||||||
if (newfie) {
|
if (newfie) {
|
||||||
|
@ -708,6 +711,7 @@ void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
|
||||||
openfilestruct *end)
|
openfilestruct *end)
|
||||||
{
|
{
|
||||||
assert(newnode != NULL && begin != NULL);
|
assert(newnode != NULL && begin != NULL);
|
||||||
|
|
||||||
newnode->next = end;
|
newnode->next = end;
|
||||||
newnode->prev = begin;
|
newnode->prev = begin;
|
||||||
begin->next = newnode;
|
begin->next = newnode;
|
||||||
|
@ -719,6 +723,7 @@ void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
|
||||||
void unlink_opennode(openfilestruct *fileptr)
|
void unlink_opennode(openfilestruct *fileptr)
|
||||||
{
|
{
|
||||||
assert(fileptr != NULL && fileptr->prev != NULL && fileptr->next != NULL && fileptr != fileptr->prev && fileptr != fileptr->next);
|
assert(fileptr != NULL && fileptr->prev != NULL && fileptr->next != NULL && fileptr != fileptr->prev && fileptr != fileptr->next);
|
||||||
|
|
||||||
fileptr->prev->next = fileptr->next;
|
fileptr->prev->next = fileptr->next;
|
||||||
fileptr->next->prev = fileptr->prev;
|
fileptr->next->prev = fileptr->prev;
|
||||||
delete_opennode(fileptr);
|
delete_opennode(fileptr);
|
||||||
|
@ -728,6 +733,7 @@ void unlink_opennode(openfilestruct *fileptr)
|
||||||
void delete_opennode(openfilestruct *fileptr)
|
void delete_opennode(openfilestruct *fileptr)
|
||||||
{
|
{
|
||||||
assert(fileptr != NULL && fileptr->filename != NULL && fileptr->fileage != NULL);
|
assert(fileptr != NULL && fileptr->filename != NULL && fileptr->fileage != NULL);
|
||||||
|
|
||||||
free(fileptr->filename);
|
free(fileptr->filename);
|
||||||
free_filestruct(fileptr->fileage);
|
free_filestruct(fileptr->fileage);
|
||||||
free(fileptr);
|
free(fileptr);
|
||||||
|
@ -739,6 +745,7 @@ void delete_opennode(openfilestruct *fileptr)
|
||||||
void free_openfilestruct(openfilestruct *src)
|
void free_openfilestruct(openfilestruct *src)
|
||||||
{
|
{
|
||||||
assert(src != NULL);
|
assert(src != NULL);
|
||||||
|
|
||||||
while (src != src->next) {
|
while (src != src->next) {
|
||||||
src = src->next;
|
src = src->next;
|
||||||
delete_opennode(src->prev);
|
delete_opennode(src->prev);
|
||||||
|
|
|
@ -40,7 +40,7 @@ char *last_search = NULL; /* Last string we searched for */
|
||||||
char *last_replace = NULL; /* Last replacement string */
|
char *last_replace = NULL; /* Last replacement string */
|
||||||
int search_last_line; /* Is this the last search line? */
|
int search_last_line; /* Is this the last search line? */
|
||||||
|
|
||||||
long flags = 0; /* Our flag containing many options */
|
unsigned long flags = 0; /* Our flag containing many options */
|
||||||
WINDOW *topwin; /* Top buffer */
|
WINDOW *topwin; /* Top buffer */
|
||||||
WINDOW *edit; /* The file portion of the editor */
|
WINDOW *edit; /* The file portion of the editor */
|
||||||
WINDOW *bottomwin; /* Bottom buffer */
|
WINDOW *bottomwin; /* Bottom buffer */
|
||||||
|
@ -103,7 +103,8 @@ char *backup_dir = NULL; /* Backup directory. */
|
||||||
|
|
||||||
char *answer = NULL; /* Answer str to many questions */
|
char *answer = NULL; /* Answer str to many questions */
|
||||||
int totlines = 0; /* Total number of lines in the file */
|
int totlines = 0; /* Total number of lines in the file */
|
||||||
long totsize = 0; /* Total number of bytes in the file */
|
size_t totsize = 0; /* Total number of characters in the
|
||||||
|
file */
|
||||||
size_t placewewant = 0; /* The column we'd like the cursor
|
size_t placewewant = 0; /* The column we'd like the cursor
|
||||||
to jump to when we go to the
|
to jump to when we go to the
|
||||||
next or previous line */
|
next or previous line */
|
||||||
|
|
23
src/nano.c
23
src/nano.c
|
@ -701,7 +701,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||||
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x)
|
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x)
|
||||||
{
|
{
|
||||||
filestruct *top_save;
|
filestruct *top_save;
|
||||||
long part_totsize;
|
size_t part_totsize;
|
||||||
bool at_edittop;
|
bool at_edittop;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
bool mark_inside = FALSE;
|
bool mark_inside = FALSE;
|
||||||
|
@ -800,7 +800,7 @@ void copy_from_filestruct(filestruct *file_top, filestruct *file_bot)
|
||||||
{
|
{
|
||||||
filestruct *top_save;
|
filestruct *top_save;
|
||||||
int part_totlines;
|
int part_totlines;
|
||||||
long part_totsize;
|
size_t part_totsize;
|
||||||
bool at_edittop;
|
bool at_edittop;
|
||||||
|
|
||||||
assert(file_top != NULL && file_bot != NULL);
|
assert(file_top != NULL && file_bot != NULL);
|
||||||
|
@ -1214,7 +1214,7 @@ void do_delete(void)
|
||||||
if (current_x < mark_beginx && mark_beginbuf == current)
|
if (current_x < mark_beginx && mark_beginbuf == current)
|
||||||
mark_beginx -= char_buf_len;
|
mark_beginx -= char_buf_len;
|
||||||
#endif
|
#endif
|
||||||
totsize -= char_buf_len;
|
totsize--;
|
||||||
} else if (current != filebot && (current->next != filebot ||
|
} else if (current != filebot && (current->next != filebot ||
|
||||||
current->data[0] == '\0')) {
|
current->data[0] == '\0')) {
|
||||||
/* We can delete the line before filebot only if it is blank: it
|
/* We can delete the line before filebot only if it is blank: it
|
||||||
|
@ -2099,7 +2099,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||||
* the alternate spell command. The line that mark_beginbuf
|
* the alternate spell command. The line that mark_beginbuf
|
||||||
* points to will be freed, so we save the line number and
|
* points to will be freed, so we save the line number and
|
||||||
* restore afterwards. */
|
* restore afterwards. */
|
||||||
long old_totsize = totsize;
|
size_t totsize_save = totsize;
|
||||||
/* Our saved value of totsize, used when we spell-check a marked
|
/* Our saved value of totsize, used when we spell-check a marked
|
||||||
* selection. */
|
* selection. */
|
||||||
|
|
||||||
|
@ -2161,7 +2161,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
if (old_mark_set) {
|
if (old_mark_set) {
|
||||||
long part_totsize;
|
size_t part_totsize;
|
||||||
|
|
||||||
/* If the mark was on, partition the filestruct so that it
|
/* If the mark was on, partition the filestruct so that it
|
||||||
* contains only the marked text, and keep track of whether the
|
* contains only the marked text, and keep track of whether the
|
||||||
|
@ -2176,7 +2176,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||||
* it from the saved value of totsize. Note that we don't need
|
* it from the saved value of totsize. Note that we don't need
|
||||||
* to save totlines. */
|
* to save totlines. */
|
||||||
get_totals(top, bot, NULL, &part_totsize);
|
get_totals(top, bot, NULL, &part_totsize);
|
||||||
old_totsize -= part_totsize;
|
totsize_save -= part_totsize;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2225,8 +2225,8 @@ const char *do_alt_speller(char *tempfile_name)
|
||||||
* saved value the actual value. */
|
* saved value the actual value. */
|
||||||
renumber(top_save);
|
renumber(top_save);
|
||||||
totlines = filebot->lineno;
|
totlines = filebot->lineno;
|
||||||
old_totsize += totsize;
|
totsize_save += totsize;
|
||||||
totsize = old_totsize;
|
totsize = totsize_save;
|
||||||
|
|
||||||
/* Assign mark_beginbuf to the line where the mark began
|
/* Assign mark_beginbuf to the line where the mark began
|
||||||
* before. */
|
* before. */
|
||||||
|
@ -2842,7 +2842,8 @@ void do_justify(bool full_justify)
|
||||||
* unjustifies. Note that we don't need to save totlines. */
|
* unjustifies. Note that we don't need to save totlines. */
|
||||||
size_t current_x_save = current_x;
|
size_t current_x_save = current_x;
|
||||||
int current_y_save = current_y;
|
int current_y_save = current_y;
|
||||||
long flags_save = flags, totsize_save = totsize;
|
unsigned long flags_save = flags;
|
||||||
|
size_t totsize_save = totsize;
|
||||||
filestruct *edittop_save = edittop, *current_save = current;
|
filestruct *edittop_save = edittop, *current_save = current;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
filestruct *mark_beginbuf_save = mark_beginbuf;
|
filestruct *mark_beginbuf_save = mark_beginbuf;
|
||||||
|
@ -3770,7 +3771,7 @@ void do_output(char *output, size_t output_len)
|
||||||
current_len - current_x + char_buf_len);
|
current_len - current_x + char_buf_len);
|
||||||
charcpy(¤t->data[current_x], char_buf, char_buf_len);
|
charcpy(¤t->data[current_x], char_buf, char_buf_len);
|
||||||
current_len += char_buf_len;
|
current_len += char_buf_len;
|
||||||
totsize += char_buf_len;
|
totsize++;
|
||||||
set_modified();
|
set_modified();
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
|
@ -4104,7 +4105,7 @@ int main(int argc, char **argv)
|
||||||
char *alt_speller_cpy = alt_speller;
|
char *alt_speller_cpy = alt_speller;
|
||||||
#endif
|
#endif
|
||||||
ssize_t tabsize_cpy = tabsize;
|
ssize_t tabsize_cpy = tabsize;
|
||||||
long flags_cpy = flags;
|
unsigned long flags_cpy = flags;
|
||||||
|
|
||||||
#ifndef DISABLE_OPERATINGDIR
|
#ifndef DISABLE_OPERATINGDIR
|
||||||
operating_dir = NULL;
|
operating_dir = NULL;
|
||||||
|
|
|
@ -172,8 +172,8 @@ typedef struct openfilestruct {
|
||||||
size_t placewewant; /* Current file's place we want. */
|
size_t placewewant; /* Current file's place we want. */
|
||||||
int totlines; /* Current file's total number of
|
int totlines; /* Current file's total number of
|
||||||
* lines. */
|
* lines. */
|
||||||
long totsize; /* Current file's total size. */
|
size_t totsize; /* Current file's total size. */
|
||||||
long flags; /* Current file's flags: modification
|
unsigned long flags; /* Current file's flags: modification
|
||||||
* status (and marking status, if
|
* status (and marking status, if
|
||||||
* available). */
|
* available). */
|
||||||
file_format fmt; /* Current file's format. */
|
file_format fmt; /* Current file's format. */
|
||||||
|
|
|
@ -39,8 +39,8 @@ extern size_t placewewant;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
extern size_t mark_beginx;
|
extern size_t mark_beginx;
|
||||||
#endif
|
#endif
|
||||||
extern long totsize;
|
extern size_t totsize;
|
||||||
extern long flags;
|
extern unsigned long flags;
|
||||||
extern ssize_t tabsize;
|
extern ssize_t tabsize;
|
||||||
extern int currslen;
|
extern int currslen;
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||||
**bot, size_t *bot_x, bool *right_side_up);
|
**bot, size_t *bot_x, bool *right_side_up);
|
||||||
#endif
|
#endif
|
||||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||||
*lines, long *size);
|
*lines, size_t *size);
|
||||||
#ifndef DISABLE_TABCOMP
|
#ifndef DISABLE_TABCOMP
|
||||||
int check_wildcard_match(const char *text, const char *pattern);
|
int check_wildcard_match(const char *text, const char *pattern);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1044,7 +1044,7 @@ void do_find_bracket(void)
|
||||||
char regexp_pat[] = "[ ]";
|
char regexp_pat[] = "[ ]";
|
||||||
size_t current_x_save, pww_save;
|
size_t current_x_save, pww_save;
|
||||||
int count = 1;
|
int count = 1;
|
||||||
long flags_save;
|
unsigned long flags_save;
|
||||||
filestruct *current_save;
|
filestruct *current_save;
|
||||||
|
|
||||||
ch_under_cursor = current->data[current_x];
|
ch_under_cursor = current->data[current_x];
|
||||||
|
|
|
@ -373,7 +373,7 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||||
/* Calculate the number of lines and the number of characters between
|
/* Calculate the number of lines and the number of characters between
|
||||||
* begin and end, and return them in lines and size, respectively. */
|
* begin and end, and return them in lines and size, respectively. */
|
||||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||||
*lines, long *size)
|
*lines, size_t *size)
|
||||||
{
|
{
|
||||||
const filestruct *f;
|
const filestruct *f;
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ void get_totals(const filestruct *begin, const filestruct *end, int
|
||||||
|
|
||||||
/* Count the number of characters on this line. */
|
/* Count the number of characters on this line. */
|
||||||
if (size != NULL) {
|
if (size != NULL) {
|
||||||
*size += strlen(f->data);
|
*size += mbstrlen(f->data);
|
||||||
|
|
||||||
/* Count the newline if we have one. */
|
/* Count the newline if we have one. */
|
||||||
if (f->next != NULL)
|
if (f->next != NULL)
|
||||||
|
@ -406,7 +406,7 @@ void get_totals(const filestruct *begin, const filestruct *end, int
|
||||||
|
|
||||||
/* Count the number of characters on this line. */
|
/* Count the number of characters on this line. */
|
||||||
if (size != NULL) {
|
if (size != NULL) {
|
||||||
*size += strlen(f->data);
|
*size += mbstrlen(f->data);
|
||||||
|
|
||||||
/* Count the newline if we have one. */
|
/* Count the newline if we have one. */
|
||||||
if (f->next != NULL)
|
if (f->next != NULL)
|
||||||
|
|
24
src/winio.c
24
src/winio.c
|
@ -3784,21 +3784,23 @@ void display_main_list(void)
|
||||||
* alone, but next time we will display. */
|
* alone, but next time we will display. */
|
||||||
void do_cursorpos(bool constant)
|
void do_cursorpos(bool constant)
|
||||||
{
|
{
|
||||||
const filestruct *fileptr;
|
char c;
|
||||||
|
filestruct *f;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
static size_t old_i = 0;
|
static size_t old_i = 0, old_totsize = (size_t)-1;
|
||||||
static long old_totsize = -1;
|
|
||||||
|
|
||||||
assert(current != NULL && fileage != NULL && totlines != 0);
|
assert(current != NULL && fileage != NULL && totlines != 0);
|
||||||
|
|
||||||
if (old_totsize == -1)
|
if (old_totsize == (size_t)-1)
|
||||||
old_totsize = totsize;
|
old_totsize = totsize;
|
||||||
|
|
||||||
for (fileptr = fileage; fileptr != current; fileptr = fileptr->next) {
|
c = current->data[current_x];
|
||||||
assert(fileptr != NULL);
|
f = current->next;
|
||||||
i += strlen(fileptr->data) + 1;
|
current->data[current_x] = '\0';
|
||||||
}
|
current->next = NULL;
|
||||||
i += current_x;
|
get_totals(fileage, current, NULL, &i);
|
||||||
|
current->data[current_x] = c;
|
||||||
|
current->next = f;
|
||||||
|
|
||||||
/* Check whether totsize is correct. Else there is a bug
|
/* Check whether totsize is correct. Else there is a bug
|
||||||
* somewhere. */
|
* somewhere. */
|
||||||
|
@ -3819,13 +3821,13 @@ void do_cursorpos(bool constant)
|
||||||
size_t cur_len = strlenpt(current->data) + 1;
|
size_t cur_len = strlenpt(current->data) + 1;
|
||||||
int linepct = 100 * current->lineno / totlines;
|
int linepct = 100 * current->lineno / totlines;
|
||||||
int colpct = 100 * xpt / cur_len;
|
int colpct = 100 * xpt / cur_len;
|
||||||
int bytepct = totsize == 0 ? 0 : 100 * i / totsize;
|
int bytepct = (totsize == 0) ? 0 : 100 * i / totsize;
|
||||||
|
|
||||||
statusbar(
|
statusbar(
|
||||||
_("line %ld/%ld (%d%%), col %lu/%lu (%d%%), char %lu/%ld (%d%%)"),
|
_("line %ld/%ld (%d%%), col %lu/%lu (%d%%), char %lu/%ld (%d%%)"),
|
||||||
current->lineno, totlines, linepct,
|
current->lineno, totlines, linepct,
|
||||||
(unsigned long)xpt, (unsigned long)cur_len, colpct,
|
(unsigned long)xpt, (unsigned long)cur_len, colpct,
|
||||||
(unsigned long)i, totsize, bytepct);
|
(unsigned long)i, (unsigned long)totsize, bytepct);
|
||||||
UNSET(DISABLE_CURPOS);
|
UNSET(DISABLE_CURPOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue