pointing to a different memory block, there will be a segfault
when the value of def is copied into it via strcpy(). (bort,
Christian Weisgarber, David Benbennick, and DLR)
+ - Remove the last editbot references, to avoid any potential
+ segfaults related to them. Also remove fix_editbot(), as it's
+ no longer needed. (David Benbennick)
- files.c:
do_insertfile()
- Wrap one reference to NANO_EXTCMD_KEY in a NANO_SMALL #ifdef.
fileage->data[0] = '\0';
filebot = fileage;
edittop = fileage;
- editbot = fileage;
current = fileage;
current_x = 0;
totlines = 1;
#endif
set_modified();
- /* Here we want to rebuild the edit window */
- fix_editbot();
-
#ifdef ENABLE_MULTIBUFFER
/* If we've loaded another file, update the titlebar's contents */
if (loading_file) {
#endif
/* If we've gone off the bottom, recenter; otherwise, just redraw */
- if (current->lineno > editbot->lineno)
- edit_update(current, CENTER);
- else
- edit_refresh();
+ edit_refresh();
} else {
statusbar(_("Cancelled"));
filestruct *edittop = NULL; /* Pointer to the top of the edit
buffer with respect to the
file struct */
-filestruct *editbot = NULL; /* Same for the bottom */
filestruct *filebot = NULL; /* Last node in the file struct */
filestruct *cutbuffer = NULL; /* A place to store cut text */
cutbuffer = NULL;
current = NULL;
edittop = NULL;
- editbot = NULL;
totlines = 0;
totsize = 0;
placewewant = 0;
/* When a character is inserted on the current magicline, it means
* we need a new one! */
- if (filebot == current) {
+ if (filebot == current)
new_magicline();
- fix_editbot();
- }
/* More dangerousness fun =) */
current->data = charealloc(current->data, current_len + 2);
strcat(current->data, current->next->data);
foo = current->next;
- if (filebot == foo) {
+ if (filebot == foo)
filebot = current;
- editbot = current;
- }
unlink_node(foo);
delete_node(foo);
}
*tmp = '\0';
- if (current->next == NULL) {
+ if (current->next == NULL)
filebot = newnode;
- editbot = newnode;
- }
splice_node(current, newnode, current->next);
totsize++;
int flags_save = flags;
long totsize_save = totsize;
filestruct *edittop_save = edittop;
- filestruct *editbot_save = editbot;
#ifndef NANO_SMALL
filestruct *mark_beginbuf_save = mark_beginbuf;
int mark_beginx_save = mark_beginx;
current_x = current_x_save;
current_y = current_y_save;
edittop = edittop_save;
- editbot = editbot_save;
if (first_mod_line != NULL) {
filestruct *cutbottom = get_cutbottom();
#endif /* HAVE_WRESIZE */
#endif /* HAVE_RESIZETERM */
- fix_editbot();
-
- if (current_y > editwinrows - 1)
- edit_update(editbot, CENTER);
- erase();
-
- /* Do these because width may have changed. */
- refresh();
- titlebar(NULL);
- edit_refresh();
display_main_list();
blank_statusbar();
total_refresh();
wclear(bottomwin);
wrefresh(bottomwin);
window_init();
- fix_editbot();
edit_refresh();
display_main_list();
break;
extern int resetstatuspos;
extern struct stat fileinfo;
-extern filestruct *current, *fileage, *edittop, *editbot, *filebot;
+extern filestruct *current, *fileage, *edittop, *filebot;
extern filestruct *cutbuffer;
#ifndef NANO_SMALL
extern filestruct *mark_beginbuf;
int line_len(const char *ptr);
int do_help(void);
void do_replace_highlight(int highlight_flag, const char *word);
-void fix_editbot(void);
#ifdef DEBUG
void dump_buffer(const filestruct *inptr);
void dump_buffer_reverse(void);
wattroff(edit, A_REVERSE);
}
-/* Fix editbot, based on the assumption that edittop is correct. */
-void fix_editbot(void)
-{
- int i;
-
- editbot = edittop;
- for (i = 0; i < editwinrows && editbot->next != NULL; i++)
- editbot = editbot->next;
-}
-
#ifdef DEBUG
/* Dump the passed-in file structure to stderr. */
void dump_buffer(const filestruct *inptr)