speller: make replace_buffer() use the cutting functions directly
parent
4c66a6259c
commit
b5f15cb574
14
src/files.c
14
src/files.c
|
@ -512,6 +512,7 @@ void replace_buffer(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int descriptor;
|
int descriptor;
|
||||||
|
filestruct *was_cutbuffer = cutbuffer;
|
||||||
|
|
||||||
/* Open the file quietly. */
|
/* Open the file quietly. */
|
||||||
descriptor = open_file(filename, FALSE, TRUE, &f);
|
descriptor = open_file(filename, FALSE, TRUE, &f);
|
||||||
|
@ -520,15 +521,16 @@ void replace_buffer(const char *filename)
|
||||||
if (descriptor < 0)
|
if (descriptor < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Reinitialize the text of the current buffer. */
|
/* Throw away the text of the file. */
|
||||||
free_filestruct(openfile->fileage);
|
cutbuffer = NULL;
|
||||||
initialize_buffer_text();
|
openfile->current = openfile->fileage;
|
||||||
|
openfile->current_x = 0;
|
||||||
|
do_cut_text(FALSE, FALSE, TRUE);
|
||||||
|
free_filestruct(cutbuffer);
|
||||||
|
cutbuffer = was_cutbuffer;
|
||||||
|
|
||||||
/* Insert the processed file into its place. */
|
/* Insert the processed file into its place. */
|
||||||
read_file(f, descriptor, filename, FALSE);
|
read_file(f, descriptor, filename, FALSE);
|
||||||
|
|
||||||
/* Put current at a place that is certain to exist. */
|
|
||||||
openfile->current = openfile->fileage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
|
Loading…
Reference in New Issue