tweaks: rename a struct element, to make sense
Этот коммит содержится в:
родитель
6755b7c0a0
Коммит
cddfcb1b9d
@ -217,7 +217,7 @@ void color_update(void)
|
|||||||
/* If the filename didn't match anything, try the first line. */
|
/* If the filename didn't match anything, try the first line. */
|
||||||
if (sint == NULL && !inhelp) {
|
if (sint == NULL && !inhelp) {
|
||||||
for (sint = syntaxes; sint != NULL; sint = sint->next) {
|
for (sint = syntaxes; sint != NULL; sint = sint->next) {
|
||||||
if (found_in_list(sint->headers, openfile->fileage->data))
|
if (found_in_list(sint->headers, openfile->filetop->data))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ void precalc_multicolorinfo(void)
|
|||||||
if (ink->end == NULL)
|
if (ink->end == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (line = openfile->fileage; line != NULL; line = line->next) {
|
for (line = openfile->filetop; line != NULL; line = line->next) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
alloc_multidata_if_needed(line);
|
alloc_multidata_if_needed(line);
|
||||||
|
@ -134,7 +134,7 @@ void do_backspace(void)
|
|||||||
zap_text();
|
zap_text();
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (openfile->current != openfile->fileage || openfile->current_x > 0) {
|
if (openfile->current != openfile->filetop || openfile->current_x > 0) {
|
||||||
do_left();
|
do_left();
|
||||||
do_deletion(BACK);
|
do_deletion(BACK);
|
||||||
}
|
}
|
||||||
|
22
src/files.c
22
src/files.c
@ -117,12 +117,12 @@ void make_new_buffer(void)
|
|||||||
/* Initialize the text and pointers of the current openfile struct. */
|
/* Initialize the text and pointers of the current openfile struct. */
|
||||||
void initialize_buffer_text(void)
|
void initialize_buffer_text(void)
|
||||||
{
|
{
|
||||||
openfile->fileage = make_new_node(NULL);
|
openfile->filetop = make_new_node(NULL);
|
||||||
openfile->fileage->data = mallocstrcpy(NULL, "");
|
openfile->filetop->data = mallocstrcpy(NULL, "");
|
||||||
|
|
||||||
openfile->filebot = openfile->fileage;
|
openfile->filebot = openfile->filetop;
|
||||||
openfile->edittop = openfile->fileage;
|
openfile->edittop = openfile->filetop;
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->filetop;
|
||||||
|
|
||||||
openfile->firstcolumn = 0;
|
openfile->firstcolumn = 0;
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
@ -490,7 +490,7 @@ bool open_buffer(const char *filename, bool new_buffer)
|
|||||||
* the filename and put the cursor at the start of the buffer. */
|
* the filename and put the cursor at the start of the buffer. */
|
||||||
if (rc != -1 && new_buffer) {
|
if (rc != -1 && new_buffer) {
|
||||||
openfile->filename = mallocstrcpy(openfile->filename, realname);
|
openfile->filename = mallocstrcpy(openfile->filename, realname);
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->filetop;
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
openfile->placewewant = 0;
|
openfile->placewewant = 0;
|
||||||
}
|
}
|
||||||
@ -528,7 +528,7 @@ void replace_buffer(const char *filename)
|
|||||||
|
|
||||||
/* Throw away the text of the file. */
|
/* Throw away the text of the file. */
|
||||||
cutbuffer = NULL;
|
cutbuffer = NULL;
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->filetop;
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
add_undo(CUT_TO_EOF);
|
add_undo(CUT_TO_EOF);
|
||||||
@ -603,7 +603,7 @@ void prepare_for_display(void)
|
|||||||
/* If there are multiline coloring regexes, and there is no
|
/* If there are multiline coloring regexes, and there is no
|
||||||
* multiline cache data yet, precalculate it now. */
|
* multiline cache data yet, precalculate it now. */
|
||||||
if (openfile->syntax && openfile->syntax->nmultis > 0 &&
|
if (openfile->syntax && openfile->syntax->nmultis > 0 &&
|
||||||
openfile->fileage->multidata == NULL)
|
openfile->filetop->multidata == NULL)
|
||||||
precalc_multicolorinfo();
|
precalc_multicolorinfo();
|
||||||
|
|
||||||
have_palette = FALSE;
|
have_palette = FALSE;
|
||||||
@ -1201,7 +1201,7 @@ void do_insertfile(void)
|
|||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
/* If this is a new buffer, put the cursor at the top. */
|
/* If this is a new buffer, put the cursor at the top. */
|
||||||
if (ISSET(MULTIBUFFER)) {
|
if (ISSET(MULTIBUFFER)) {
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->filetop;
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
openfile->placewewant = 0;
|
openfile->placewewant = 0;
|
||||||
|
|
||||||
@ -1593,7 +1593,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
|||||||
/* Instead of returning in this function, you should always
|
/* Instead of returning in this function, you should always
|
||||||
* set retval and then goto cleanup_and_exit. */
|
* set retval and then goto cleanup_and_exit. */
|
||||||
size_t lineswritten = 0;
|
size_t lineswritten = 0;
|
||||||
const linestruct *fileptr = openfile->fileage;
|
const linestruct *fileptr = openfile->filetop;
|
||||||
int fd;
|
int fd;
|
||||||
/* The file descriptor we use. */
|
/* The file descriptor we use. */
|
||||||
mode_t original_umask = 0;
|
mode_t original_umask = 0;
|
||||||
@ -1999,7 +1999,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
|||||||
|
|
||||||
/* If the syntax changed, discard and recompute the multidata. */
|
/* If the syntax changed, discard and recompute the multidata. */
|
||||||
if (strcmp(oldname, newname) != 0) {
|
if (strcmp(oldname, newname) != 0) {
|
||||||
linestruct *line = openfile->fileage;
|
linestruct *line = openfile->filetop;
|
||||||
|
|
||||||
while (line != NULL) {
|
while (line != NULL) {
|
||||||
free(line->multidata);
|
free(line->multidata);
|
||||||
|
@ -231,7 +231,7 @@ void do_help(void)
|
|||||||
edit_refresh();
|
edit_refresh();
|
||||||
|
|
||||||
location = 0;
|
location = 0;
|
||||||
line = openfile->fileage;
|
line = openfile->filetop;
|
||||||
|
|
||||||
/* Count how far (in bytes) edittop is into the file. */
|
/* Count how far (in bytes) edittop is into the file. */
|
||||||
while (line != openfile->edittop) {
|
while (line != openfile->edittop) {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
/* Move to the first line of the file. */
|
/* Move to the first line of the file. */
|
||||||
void to_first_line(void)
|
void to_first_line(void)
|
||||||
{
|
{
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->filetop;
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
openfile->placewewant = 0;
|
openfile->placewewant = 0;
|
||||||
|
|
||||||
@ -572,7 +572,7 @@ void do_left(void)
|
|||||||
if (openfile->current_x > 0)
|
if (openfile->current_x > 0)
|
||||||
openfile->current_x = move_mbleft(openfile->current->data,
|
openfile->current_x = move_mbleft(openfile->current->data,
|
||||||
openfile->current_x);
|
openfile->current_x);
|
||||||
else if (openfile->current != openfile->fileage) {
|
else if (openfile->current != openfile->filetop) {
|
||||||
openfile->current = openfile->current->prev;
|
openfile->current = openfile->current->prev;
|
||||||
openfile->current_x = strlen(openfile->current->data);
|
openfile->current_x = strlen(openfile->current->data);
|
||||||
}
|
}
|
||||||
|
80
src/nano.c
80
src/nano.c
@ -205,11 +205,11 @@ partition *partition_buffer(linestruct *top, size_t top_x,
|
|||||||
/* If the top and bottom of the partition are different from the top
|
/* If the top and bottom of the partition are different from the top
|
||||||
* and bottom of the buffer, save the latter and then set them
|
* and bottom of the buffer, save the latter and then set them
|
||||||
* to top and bot. */
|
* to top and bot. */
|
||||||
if (top != openfile->fileage) {
|
if (top != openfile->filetop) {
|
||||||
p->fileage = openfile->fileage;
|
p->filetop = openfile->filetop;
|
||||||
openfile->fileage = top;
|
openfile->filetop = top;
|
||||||
} else
|
} else
|
||||||
p->fileage = NULL;
|
p->filetop = NULL;
|
||||||
if (bot != openfile->filebot) {
|
if (bot != openfile->filebot) {
|
||||||
p->filebot = openfile->filebot;
|
p->filebot = openfile->filebot;
|
||||||
openfile->filebot = bot;
|
openfile->filebot = bot;
|
||||||
@ -239,21 +239,21 @@ partition *partition_buffer(linestruct *top, size_t top_x,
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unpartition the current buffer so that it stretches from (fileage, 0)
|
/* Unpartition the current buffer so that it stretches from (filetop, 0)
|
||||||
* to (filebot, $) again. */
|
* to (filebot, $) again. */
|
||||||
void unpartition_buffer(partition **p)
|
void unpartition_buffer(partition **p)
|
||||||
{
|
{
|
||||||
/* Reattach the line above the top of the partition, and restore the
|
/* Reattach the line above the top of the partition, and restore the
|
||||||
* text before top_x from top_data. Free top_data when we're done
|
* text before top_x from top_data. Free top_data when we're done
|
||||||
* with it. */
|
* with it. */
|
||||||
openfile->fileage->prev = (*p)->top_prev;
|
openfile->filetop->prev = (*p)->top_prev;
|
||||||
if (openfile->fileage->prev != NULL)
|
if (openfile->filetop->prev != NULL)
|
||||||
openfile->fileage->prev->next = openfile->fileage;
|
openfile->filetop->prev->next = openfile->filetop;
|
||||||
openfile->fileage->data = charealloc(openfile->fileage->data,
|
openfile->filetop->data = charealloc(openfile->filetop->data,
|
||||||
strlen((*p)->top_data) + strlen(openfile->fileage->data) + 1);
|
strlen((*p)->top_data) + strlen(openfile->filetop->data) + 1);
|
||||||
charmove(openfile->fileage->data + strlen((*p)->top_data),
|
charmove(openfile->filetop->data + strlen((*p)->top_data),
|
||||||
openfile->fileage->data, strlen(openfile->fileage->data) + 1);
|
openfile->filetop->data, strlen(openfile->filetop->data) + 1);
|
||||||
strncpy(openfile->fileage->data, (*p)->top_data, strlen((*p)->top_data));
|
strncpy(openfile->filetop->data, (*p)->top_data, strlen((*p)->top_data));
|
||||||
free((*p)->top_data);
|
free((*p)->top_data);
|
||||||
|
|
||||||
/* Reattach the line below the bottom of the partition, and restore
|
/* Reattach the line below the bottom of the partition, and restore
|
||||||
@ -269,8 +269,8 @@ void unpartition_buffer(partition **p)
|
|||||||
|
|
||||||
/* Restore the top and bottom of the buffer, if they were
|
/* Restore the top and bottom of the buffer, if they were
|
||||||
* different from the top and bottom of the partition. */
|
* different from the top and bottom of the partition. */
|
||||||
if ((*p)->fileage != NULL)
|
if ((*p)->filetop != NULL)
|
||||||
openfile->fileage = (*p)->fileage;
|
openfile->filetop = (*p)->filetop;
|
||||||
if ((*p)->filebot != NULL)
|
if ((*p)->filebot != NULL)
|
||||||
openfile->filebot = (*p)->filebot;
|
openfile->filebot = (*p)->filebot;
|
||||||
|
|
||||||
@ -302,17 +302,17 @@ void extract_buffer(linestruct **file_top, linestruct **file_bot,
|
|||||||
* the edit window is inside the partition, and keep track of
|
* the edit window is inside the partition, and keep track of
|
||||||
* whether the mark begins inside the partition. */
|
* whether the mark begins inside the partition. */
|
||||||
filepart = partition_buffer(top, top_x, bot, bot_x);
|
filepart = partition_buffer(top, top_x, bot, bot_x);
|
||||||
edittop_inside = (openfile->edittop->lineno >= openfile->fileage->lineno &&
|
edittop_inside = (openfile->edittop->lineno >= openfile->filetop->lineno &&
|
||||||
openfile->edittop->lineno <= openfile->filebot->lineno);
|
openfile->edittop->lineno <= openfile->filebot->lineno);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark) {
|
if (openfile->mark) {
|
||||||
mark_inside = (openfile->mark->lineno >= openfile->fileage->lineno &&
|
mark_inside = (openfile->mark->lineno >= openfile->filetop->lineno &&
|
||||||
openfile->mark->lineno <= openfile->filebot->lineno &&
|
openfile->mark->lineno <= openfile->filebot->lineno &&
|
||||||
(openfile->mark != openfile->fileage ||
|
(openfile->mark != openfile->filetop ||
|
||||||
openfile->mark_x >= top_x) &&
|
openfile->mark_x >= top_x) &&
|
||||||
(openfile->mark != openfile->filebot ||
|
(openfile->mark != openfile->filebot ||
|
||||||
openfile->mark_x <= bot_x));
|
openfile->mark_x <= bot_x));
|
||||||
same_line = (openfile->mark == openfile->fileage);
|
same_line = (openfile->mark == openfile->filetop);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ void extract_buffer(linestruct **file_top, linestruct **file_bot,
|
|||||||
/* If file_top is empty, just move all the text directly into
|
/* If file_top is empty, just move all the text directly into
|
||||||
* it. This is equivalent to tacking the text in top onto the
|
* it. This is equivalent to tacking the text in top onto the
|
||||||
* (lack of) text at the end of file_top. */
|
* (lack of) text at the end of file_top. */
|
||||||
*file_top = openfile->fileage;
|
*file_top = openfile->filetop;
|
||||||
*file_bot = openfile->filebot;
|
*file_bot = openfile->filebot;
|
||||||
|
|
||||||
/* Renumber, starting with file_top. */
|
/* Renumber, starting with file_top. */
|
||||||
@ -335,33 +335,33 @@ void extract_buffer(linestruct **file_top, linestruct **file_bot,
|
|||||||
* file_bot. */
|
* file_bot. */
|
||||||
(*file_bot)->data = charealloc((*file_bot)->data,
|
(*file_bot)->data = charealloc((*file_bot)->data,
|
||||||
strlen((*file_bot)->data) +
|
strlen((*file_bot)->data) +
|
||||||
strlen(openfile->fileage->data) + 1);
|
strlen(openfile->filetop->data) + 1);
|
||||||
strcat((*file_bot)->data, openfile->fileage->data);
|
strcat((*file_bot)->data, openfile->filetop->data);
|
||||||
|
|
||||||
/* Attach the line after top to the line after file_bot. Then,
|
/* Attach the line after top to the line after file_bot. Then,
|
||||||
* if there's more than one line after top, move file_bot down
|
* if there's more than one line after top, move file_bot down
|
||||||
* to bot. */
|
* to bot. */
|
||||||
(*file_bot)->next = openfile->fileage->next;
|
(*file_bot)->next = openfile->filetop->next;
|
||||||
if ((*file_bot)->next != NULL) {
|
if ((*file_bot)->next != NULL) {
|
||||||
(*file_bot)->next->prev = *file_bot;
|
(*file_bot)->next->prev = *file_bot;
|
||||||
*file_bot = openfile->filebot;
|
*file_bot = openfile->filebot;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_node(openfile->fileage);
|
delete_node(openfile->filetop);
|
||||||
|
|
||||||
/* Renumber, starting at the last line of the original buffer. */
|
/* Renumber, starting at the last line of the original buffer. */
|
||||||
renumber(file_bot_save);
|
renumber(file_bot_save);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Since the text has now been saved, remove it from the buffer. */
|
/* Since the text has now been saved, remove it from the buffer. */
|
||||||
openfile->fileage = make_new_node(NULL);
|
openfile->filetop = make_new_node(NULL);
|
||||||
openfile->fileage->data = mallocstrcpy(NULL, "");
|
openfile->filetop->data = mallocstrcpy(NULL, "");
|
||||||
openfile->filebot = openfile->fileage;
|
openfile->filebot = openfile->filetop;
|
||||||
|
|
||||||
/* Restore the current line and cursor position. If the mark begins
|
/* Restore the current line and cursor position. If the mark begins
|
||||||
* inside the partition, set the beginning of the mark to where the
|
* inside the partition, set the beginning of the mark to where the
|
||||||
* saved text used to start. */
|
* saved text used to start. */
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->filetop;
|
||||||
openfile->current_x = top_x;
|
openfile->current_x = top_x;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (mark_inside) {
|
if (mark_inside) {
|
||||||
@ -372,7 +372,7 @@ void extract_buffer(linestruct **file_top, linestruct **file_bot,
|
|||||||
openfile->mark = openfile->current;
|
openfile->mark = openfile->current;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
top_save = openfile->fileage;
|
top_save = openfile->filetop;
|
||||||
|
|
||||||
/* Unpartition the buffer so that it contains all the text
|
/* Unpartition the buffer so that it contains all the text
|
||||||
* again, minus the saved text. */
|
* again, minus the saved text. */
|
||||||
@ -422,13 +422,13 @@ void ingraft_buffer(linestruct *somebuffer)
|
|||||||
* whether the current line is at the top of the edit window. */
|
* whether the current line is at the top of the edit window. */
|
||||||
filepart = partition_buffer(openfile->current, openfile->current_x,
|
filepart = partition_buffer(openfile->current, openfile->current_x,
|
||||||
openfile->current, openfile->current_x);
|
openfile->current, openfile->current_x);
|
||||||
edittop_inside = (openfile->edittop == openfile->fileage);
|
edittop_inside = (openfile->edittop == openfile->filetop);
|
||||||
free_lines(openfile->fileage);
|
free_lines(openfile->filetop);
|
||||||
|
|
||||||
/* Put the top and bottom of the current buffer at the top and
|
/* Put the top and bottom of the current buffer at the top and
|
||||||
* bottom of the passed buffer. */
|
* bottom of the passed buffer. */
|
||||||
openfile->fileage = somebuffer;
|
openfile->filetop = somebuffer;
|
||||||
openfile->filebot = openfile->fileage;
|
openfile->filebot = openfile->filetop;
|
||||||
while (openfile->filebot->next != NULL)
|
while (openfile->filebot->next != NULL)
|
||||||
openfile->filebot = openfile->filebot->next;
|
openfile->filebot = openfile->filebot->next;
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ void ingraft_buffer(linestruct *somebuffer)
|
|||||||
|
|
||||||
/* Refresh the mark's pointer, and compensate the mark's
|
/* Refresh the mark's pointer, and compensate the mark's
|
||||||
* x coordinate for the change in the current line. */
|
* x coordinate for the change in the current line. */
|
||||||
if (openfile->fileage == openfile->filebot) {
|
if (openfile->filetop == openfile->filebot) {
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark && single_line) {
|
if (openfile->mark && single_line) {
|
||||||
openfile->mark = openfile->current;
|
openfile->mark = openfile->current;
|
||||||
@ -453,7 +453,7 @@ void ingraft_buffer(linestruct *somebuffer)
|
|||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (openfile->mark && single_line) {
|
else if (openfile->mark && single_line) {
|
||||||
if (right_side_up)
|
if (right_side_up)
|
||||||
openfile->mark = openfile->fileage;
|
openfile->mark = openfile->filetop;
|
||||||
else {
|
else {
|
||||||
openfile->mark = openfile->current;
|
openfile->mark = openfile->current;
|
||||||
openfile->mark_x += openfile->current_x - current_x_save;
|
openfile->mark_x += openfile->current_x - current_x_save;
|
||||||
@ -466,7 +466,7 @@ void ingraft_buffer(linestruct *somebuffer)
|
|||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
#endif
|
#endif
|
||||||
/* Add the number of characters in the copied text to the file size. */
|
/* Add the number of characters in the copied text to the file size. */
|
||||||
openfile->totsize += get_totsize(openfile->fileage, openfile->filebot);
|
openfile->totsize += get_totsize(openfile->filetop, openfile->filebot);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
statusline(ALERT, "Took: %.2f", (double)(clock() - start) / CLOCKS_PER_SEC);
|
statusline(ALERT, "Took: %.2f", (double)(clock() - start) / CLOCKS_PER_SEC);
|
||||||
#endif
|
#endif
|
||||||
@ -474,9 +474,9 @@ void ingraft_buffer(linestruct *somebuffer)
|
|||||||
/* If we pasted onto the first line of the edit window, the corresponding
|
/* If we pasted onto the first line of the edit window, the corresponding
|
||||||
* record has been freed, so... point at the start of the copied text. */
|
* record has been freed, so... point at the start of the copied text. */
|
||||||
if (edittop_inside)
|
if (edittop_inside)
|
||||||
openfile->edittop = openfile->fileage;
|
openfile->edittop = openfile->filetop;
|
||||||
|
|
||||||
top_save = openfile->fileage;
|
top_save = openfile->filetop;
|
||||||
|
|
||||||
/* Unpartition the buffer so that it contains all the text
|
/* Unpartition the buffer so that it contains all the text
|
||||||
* again, plus the copied text. */
|
* again, plus the copied text. */
|
||||||
@ -516,7 +516,7 @@ void unlink_opennode(openfilestruct *fileptr)
|
|||||||
void delete_opennode(openfilestruct *fileptr)
|
void delete_opennode(openfilestruct *fileptr)
|
||||||
{
|
{
|
||||||
free(fileptr->filename);
|
free(fileptr->filename);
|
||||||
free_lines(fileptr->fileage);
|
free_lines(fileptr->filetop);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
free(fileptr->current_stat);
|
free(fileptr->current_stat);
|
||||||
free(fileptr->lock_filename);
|
free(fileptr->lock_filename);
|
||||||
@ -1145,7 +1145,7 @@ bool scoop_stdin(void)
|
|||||||
/* Read the input into a new buffer. */
|
/* Read the input into a new buffer. */
|
||||||
open_buffer("", TRUE);
|
open_buffer("", TRUE);
|
||||||
read_file(stream, 0, "stdin", TRUE);
|
read_file(stream, 0, "stdin", TRUE);
|
||||||
openfile->edittop = openfile->fileage;
|
openfile->edittop = openfile->filetop;
|
||||||
fprintf(stderr, ".\n");
|
fprintf(stderr, ".\n");
|
||||||
|
|
||||||
/* Reconnect the tty as the input source. */
|
/* Reconnect the tty as the input source. */
|
||||||
|
@ -286,7 +286,7 @@ typedef struct linestruct {
|
|||||||
} linestruct;
|
} linestruct;
|
||||||
|
|
||||||
typedef struct partition {
|
typedef struct partition {
|
||||||
linestruct *fileage;
|
linestruct *filetop;
|
||||||
/* The top line of this portion of the file. */
|
/* The top line of this portion of the file. */
|
||||||
linestruct *top_prev;
|
linestruct *top_prev;
|
||||||
/* The line before the top line of this portion of the file. */
|
/* The line before the top line of this portion of the file. */
|
||||||
@ -360,7 +360,7 @@ typedef struct poshiststruct {
|
|||||||
typedef struct openfilestruct {
|
typedef struct openfilestruct {
|
||||||
char *filename;
|
char *filename;
|
||||||
/* The file's name. */
|
/* The file's name. */
|
||||||
linestruct *fileage;
|
linestruct *filetop;
|
||||||
/* The file's first line. */
|
/* The file's first line. */
|
||||||
linestruct *filebot;
|
linestruct *filebot;
|
||||||
/* The file's last line. */
|
/* The file's last line. */
|
||||||
|
@ -279,7 +279,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
|||||||
if (ISSET(BACKWARDS_SEARCH))
|
if (ISSET(BACKWARDS_SEARCH))
|
||||||
line = openfile->filebot;
|
line = openfile->filebot;
|
||||||
else
|
else
|
||||||
line = openfile->fileage;
|
line = openfile->filetop;
|
||||||
|
|
||||||
if (modus == JUSTFIND) {
|
if (modus == JUSTFIND) {
|
||||||
statusbar(_("Search Wrapped"));
|
statusbar(_("Search Wrapped"));
|
||||||
@ -744,7 +744,7 @@ void ask_for_replacement(void)
|
|||||||
/* Go to the specified line and x position. */
|
/* Go to the specified line and x position. */
|
||||||
void goto_line_posx(ssize_t line, size_t pos_x)
|
void goto_line_posx(ssize_t line, size_t pos_x)
|
||||||
{
|
{
|
||||||
for (openfile->current = openfile->fileage; line > 1 &&
|
for (openfile->current = openfile->filetop; line > 1 &&
|
||||||
openfile->current != openfile->filebot; line--)
|
openfile->current != openfile->filebot; line--)
|
||||||
openfile->current = openfile->current->next;
|
openfile->current = openfile->current->next;
|
||||||
|
|
||||||
@ -804,7 +804,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
|||||||
line = 1;
|
line = 1;
|
||||||
|
|
||||||
/* Iterate to the requested line. */
|
/* Iterate to the requested line. */
|
||||||
for (openfile->current = openfile->fileage; line > 1 &&
|
for (openfile->current = openfile->filetop; line > 1 &&
|
||||||
openfile->current != openfile->filebot; line--)
|
openfile->current != openfile->filebot; line--)
|
||||||
openfile->current = openfile->current->next;
|
openfile->current = openfile->current->next;
|
||||||
|
|
||||||
|
18
src/text.c
18
src/text.c
@ -1035,7 +1035,7 @@ bool execute_command(const char *command)
|
|||||||
add_undo(COUPLE_BEGIN);
|
add_undo(COUPLE_BEGIN);
|
||||||
openfile->undotop->strdata = mallocstrcpy(NULL, _("filtering"));
|
openfile->undotop->strdata = mallocstrcpy(NULL, _("filtering"));
|
||||||
if (openfile->mark == NULL) {
|
if (openfile->mark == NULL) {
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->filetop;
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
}
|
}
|
||||||
add_undo(CUT);
|
add_undo(CUT);
|
||||||
@ -1045,7 +1045,7 @@ bool execute_command(const char *command)
|
|||||||
|
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
close(to_fd[0]);
|
close(to_fd[0]);
|
||||||
send_data(cutbuffer != NULL ? cutbuffer : openfile->fileage, to_fd[1]);
|
send_data(cutbuffer != NULL ? cutbuffer : openfile->filetop, to_fd[1]);
|
||||||
close(to_fd[1]);
|
close(to_fd[1]);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@ -1795,7 +1795,7 @@ bool begpar(const linestruct *const line, int depth)
|
|||||||
|
|
||||||
/* If this is the very first line of the buffer, it counts as a BOP
|
/* If this is the very first line of the buffer, it counts as a BOP
|
||||||
* even when it contains no text. */
|
* even when it contains no text. */
|
||||||
if (line == openfile->fileage)
|
if (line == openfile->filetop)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* If recursion is going too deep, just say it's not a BOP. */
|
/* If recursion is going too deep, just say it's not a BOP. */
|
||||||
@ -2035,7 +2035,7 @@ void do_justify(bool full_justify)
|
|||||||
/* When justifying the entire buffer, start at the top. Otherwise, when
|
/* When justifying the entire buffer, start at the top. Otherwise, when
|
||||||
* in a paragraph but not at its beginning, move back to its first line. */
|
* in a paragraph but not at its beginning, move back to its first line. */
|
||||||
if (full_justify)
|
if (full_justify)
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->filetop;
|
||||||
else if (inpar(openfile->current) && !begpar(openfile->current, 0))
|
else if (inpar(openfile->current) && !begpar(openfile->current, 0))
|
||||||
do_para_begin(&openfile->current);
|
do_para_begin(&openfile->current);
|
||||||
|
|
||||||
@ -2358,7 +2358,7 @@ bool fix_spello(const char *word)
|
|||||||
#endif
|
#endif
|
||||||
/* Otherwise, start from the top of the file. */
|
/* Otherwise, start from the top of the file. */
|
||||||
{
|
{
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->filetop;
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3141,7 +3141,7 @@ void do_wordlinechar_count(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Start at the top of the file. */
|
/* Start at the top of the file. */
|
||||||
openfile->current = openfile->fileage;
|
openfile->current = openfile->filetop;
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
openfile->placewewant = 0;
|
openfile->placewewant = 0;
|
||||||
|
|
||||||
@ -3158,8 +3158,8 @@ void do_wordlinechar_count(void)
|
|||||||
/* Get the total line and character counts, as "wc -l" and "wc -c"
|
/* Get the total line and character counts, as "wc -l" and "wc -c"
|
||||||
* do, but get the latter in multibyte characters. */
|
* do, but get the latter in multibyte characters. */
|
||||||
if (was_mark) {
|
if (was_mark) {
|
||||||
nlines = openfile->filebot->lineno - openfile->fileage->lineno + 1;
|
nlines = openfile->filebot->lineno - openfile->filetop->lineno + 1;
|
||||||
chars = get_totsize(openfile->fileage, 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
|
||||||
* again, and turn the mark back on. */
|
* again, and turn the mark back on. */
|
||||||
@ -3265,7 +3265,7 @@ void complete_a_word(void)
|
|||||||
openfile->last_action = OTHER;
|
openfile->last_action = OTHER;
|
||||||
|
|
||||||
/* Initialize the starting point for searching. */
|
/* Initialize the starting point for searching. */
|
||||||
pletion_line = openfile->fileage;
|
pletion_line = openfile->filetop;
|
||||||
pletion_x = 0;
|
pletion_x = 0;
|
||||||
|
|
||||||
/* Wipe the "No further matches" message. */
|
/* Wipe the "No further matches" message. */
|
||||||
|
@ -452,7 +452,7 @@ void new_magicline(void)
|
|||||||
void remove_magicline(void)
|
void remove_magicline(void)
|
||||||
{
|
{
|
||||||
if (openfile->filebot->data[0] == '\0' &&
|
if (openfile->filebot->data[0] == '\0' &&
|
||||||
openfile->filebot != openfile->fileage) {
|
openfile->filebot != openfile->filetop) {
|
||||||
openfile->filebot = openfile->filebot->prev;
|
openfile->filebot = openfile->filebot->prev;
|
||||||
free_lines(openfile->filebot->next);
|
free_lines(openfile->filebot->next);
|
||||||
openfile->filebot->next = NULL;
|
openfile->filebot->next = NULL;
|
||||||
|
@ -2928,7 +2928,7 @@ int go_back_chunks(int nrows, linestruct **line, size_t *leftedge)
|
|||||||
if (chunk >= i)
|
if (chunk >= i)
|
||||||
return go_forward_chunks(chunk - i, line, leftedge);
|
return go_forward_chunks(chunk - i, line, leftedge);
|
||||||
|
|
||||||
if (*line == openfile->fileage)
|
if (*line == openfile->filetop)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
i -= chunk;
|
i -= chunk;
|
||||||
@ -3414,7 +3414,7 @@ void do_cursorpos(bool force)
|
|||||||
saved_byte = openfile->current->data[openfile->current_x];
|
saved_byte = openfile->current->data[openfile->current_x];
|
||||||
openfile->current->data[openfile->current_x] = '\0';
|
openfile->current->data[openfile->current_x] = '\0';
|
||||||
|
|
||||||
sum = get_totsize(openfile->fileage, openfile->current);
|
sum = get_totsize(openfile->filetop, openfile->current);
|
||||||
|
|
||||||
openfile->current->data[openfile->current_x] = saved_byte;
|
openfile->current->data[openfile->current_x] = saved_byte;
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user