fix cursor placement problem when inserting into the current buffer at
the top of the edit window git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2097 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
56cf034a12
commit
4a3879f1ed
15
src/files.c
15
src/files.c
|
@ -499,6 +499,8 @@ void do_insertfile(
|
||||||
char *ans = mallocstrcpy(NULL, "");
|
char *ans = mallocstrcpy(NULL, "");
|
||||||
/* The last answer the user typed on the statusbar. */
|
/* The last answer the user typed on the statusbar. */
|
||||||
filestruct *edittop_save = edittop;
|
filestruct *edittop_save = edittop;
|
||||||
|
bool at_edittop = FALSE;
|
||||||
|
/* Whether we're at the top of the edit window. */
|
||||||
|
|
||||||
#ifndef DISABLE_WRAPPING
|
#ifndef DISABLE_WRAPPING
|
||||||
wrap_reset();
|
wrap_reset();
|
||||||
|
@ -591,11 +593,12 @@ void do_insertfile(
|
||||||
#endif
|
#endif
|
||||||
/* If we're not inserting into a new buffer, partition
|
/* If we're not inserting into a new buffer, partition
|
||||||
* the filestruct so that it contains no text and hence
|
* the filestruct so that it contains no text and hence
|
||||||
* looks like a new buffer, and set edittop to the top
|
* looks like a new buffer, and keep track of whether
|
||||||
* of the partition. */
|
* the top of the partition is the top of the edit
|
||||||
|
* window. */
|
||||||
filepart = partition_filestruct(current, current_x,
|
filepart = partition_filestruct(current, current_x,
|
||||||
current, current_x);
|
current, current_x);
|
||||||
edittop = fileage;
|
at_edittop = (fileage == edittop);
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -628,6 +631,12 @@ void do_insertfile(
|
||||||
* partition. */
|
* partition. */
|
||||||
renumber(top_save);
|
renumber(top_save);
|
||||||
|
|
||||||
|
/* If we were at the top of the edit window before, set
|
||||||
|
* the saved value of edittop to the new top of the edit
|
||||||
|
* window. */
|
||||||
|
if (at_edittop)
|
||||||
|
edittop_save = fileage;
|
||||||
|
|
||||||
/* Set edittop back to what it was before. */
|
/* Set edittop back to what it was before. */
|
||||||
edittop = edittop_save;
|
edittop = edittop_save;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue