tweaks: reshuffle some declarations, and rename a variable
parent
d12191db5a
commit
222e67300e
12
src/text.c
12
src/text.c
|
@ -2537,16 +2537,15 @@ const char *do_int_speller(const char *tempfile_name)
|
||||||
* termination, and the error string otherwise. */
|
* termination, and the error string otherwise. */
|
||||||
const char *do_alt_speller(char *tempfile_name)
|
const char *do_alt_speller(char *tempfile_name)
|
||||||
{
|
{
|
||||||
int alt_spell_status;
|
ssize_t lineno_save = openfile->current->lineno;
|
||||||
size_t current_x_save = openfile->current_x;
|
size_t current_x_save = openfile->current_x;
|
||||||
size_t pww_save = openfile->placewewant;
|
size_t pww_save = openfile->placewewant;
|
||||||
ssize_t lineno_save = openfile->current->lineno;
|
|
||||||
bool was_at_eol = (openfile->current->data[openfile->current_x] == '\0');
|
bool was_at_eol = (openfile->current->data[openfile->current_x] == '\0');
|
||||||
bool replaced = FALSE;
|
|
||||||
struct stat spellfileinfo;
|
struct stat spellfileinfo;
|
||||||
time_t timestamp;
|
time_t timestamp;
|
||||||
pid_t pid_spell;
|
|
||||||
static char **spellargs = NULL;
|
static char **spellargs = NULL;
|
||||||
|
pid_t pid_spell;
|
||||||
|
int program_status;
|
||||||
|
|
||||||
/* Get the timestamp and the size of the temporary file. */
|
/* Get the timestamp and the size of the temporary file. */
|
||||||
stat(tempfile_name, &spellfileinfo);
|
stat(tempfile_name, &spellfileinfo);
|
||||||
|
@ -2573,14 +2572,14 @@ const char *do_alt_speller(char *tempfile_name)
|
||||||
/* Block SIGWINCHes while waiting for the alternate spell checker's end,
|
/* Block SIGWINCHes while waiting for the alternate spell checker's end,
|
||||||
* so nano doesn't get pushed past the wait(). */
|
* so nano doesn't get pushed past the wait(). */
|
||||||
block_sigwinch(TRUE);
|
block_sigwinch(TRUE);
|
||||||
wait(&alt_spell_status);
|
wait(&program_status);
|
||||||
block_sigwinch(FALSE);
|
block_sigwinch(FALSE);
|
||||||
|
|
||||||
/* Set the desired terminal state again, and reenter curses mode. */
|
/* Set the desired terminal state again, and reenter curses mode. */
|
||||||
terminal_init();
|
terminal_init();
|
||||||
doupdate();
|
doupdate();
|
||||||
|
|
||||||
if (!WIFEXITED(alt_spell_status) || WEXITSTATUS(alt_spell_status) != 0)
|
if (!WIFEXITED(program_status) || WEXITSTATUS(program_status) != 0)
|
||||||
return invocation_error(alt_speller);
|
return invocation_error(alt_speller);
|
||||||
|
|
||||||
/* Stat the temporary file again. */
|
/* Stat the temporary file again. */
|
||||||
|
@ -2588,6 +2587,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||||
|
|
||||||
/* Use the spell-checked file only when it changed. */
|
/* Use the spell-checked file only when it changed. */
|
||||||
if (spellfileinfo.st_mtime != timestamp) {
|
if (spellfileinfo.st_mtime != timestamp) {
|
||||||
|
bool replaced = FALSE;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Replace the marked text (or entire text) with the corrected text. */
|
/* Replace the marked text (or entire text) with the corrected text. */
|
||||||
if (openfile->mark) {
|
if (openfile->mark) {
|
||||||
|
|
Loading…
Reference in New Issue