tweaks: move the saving and restoring of flags to where it is needed
Этот коммит содержится в:
родитель
0f23729253
Коммит
d9cb12f6e3
14
src/text.c
14
src/text.c
@ -2322,6 +2322,7 @@ void do_int_speller(const char *tempfile_name)
|
|||||||
int spell_fd[2], sort_fd[2], uniq_fd[2], tempfile_fd = -1;
|
int spell_fd[2], sort_fd[2], uniq_fd[2], tempfile_fd = -1;
|
||||||
pid_t pid_spell, pid_sort, pid_uniq;
|
pid_t pid_spell, pid_sort, pid_uniq;
|
||||||
int spell_status, sort_status, uniq_status;
|
int spell_status, sort_status, uniq_status;
|
||||||
|
unsigned stash[sizeof(flags) / sizeof(flags[0])];
|
||||||
|
|
||||||
/* Create all three pipes up front. */
|
/* Create all three pipes up front. */
|
||||||
if (pipe(spell_fd) == -1 || pipe(sort_fd) == -1 || pipe(uniq_fd) == -1) {
|
if (pipe(spell_fd) == -1 || pipe(sort_fd) == -1 || pipe(uniq_fd) == -1) {
|
||||||
@ -2446,6 +2447,9 @@ void do_int_speller(const char *tempfile_name)
|
|||||||
terminal_init();
|
terminal_init();
|
||||||
doupdate();
|
doupdate();
|
||||||
|
|
||||||
|
/* Save the settings of the global flags. */
|
||||||
|
memcpy(stash, flags, sizeof(flags));
|
||||||
|
|
||||||
/* Do any replacements case-sensitively, forward, and without regexes. */
|
/* Do any replacements case-sensitively, forward, and without regexes. */
|
||||||
SET(CASE_SENSITIVE);
|
SET(CASE_SENSITIVE);
|
||||||
UNSET(BACKWARDS_SEARCH);
|
UNSET(BACKWARDS_SEARCH);
|
||||||
@ -2476,6 +2480,9 @@ void do_int_speller(const char *tempfile_name)
|
|||||||
free(misspellings);
|
free(misspellings);
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
|
|
||||||
|
/* Restore the settings of the global flags. */
|
||||||
|
memcpy(flags, stash, sizeof(flags));
|
||||||
|
|
||||||
/* Process the end of the three processes. */
|
/* Process the end of the three processes. */
|
||||||
waitpid(pid_spell, &spell_status, 0);
|
waitpid(pid_spell, &spell_status, 0);
|
||||||
waitpid(pid_sort, &sort_status, 0);
|
waitpid(pid_sort, &sort_status, 0);
|
||||||
@ -2498,7 +2505,6 @@ void do_spell(void)
|
|||||||
{
|
{
|
||||||
FILE *stream;
|
FILE *stream;
|
||||||
char *temp_name;
|
char *temp_name;
|
||||||
unsigned stash[sizeof(flags) / sizeof(flags[0])];
|
|
||||||
bool okay;
|
bool okay;
|
||||||
|
|
||||||
ran_a_tool = TRUE;
|
ran_a_tool = TRUE;
|
||||||
@ -2513,9 +2519,6 @@ void do_spell(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the settings of the global flags. */
|
|
||||||
memcpy(stash, flags, sizeof(flags));
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark)
|
if (openfile->mark)
|
||||||
okay = write_region_to_file(temp_name, stream, TEMPORARY, OVERWRITE);
|
okay = write_region_to_file(temp_name, stream, TEMPORARY, OVERWRITE);
|
||||||
@ -2540,9 +2543,6 @@ void do_spell(void)
|
|||||||
unlink(temp_name);
|
unlink(temp_name);
|
||||||
free(temp_name);
|
free(temp_name);
|
||||||
|
|
||||||
/* Restore the settings of the global flags. */
|
|
||||||
memcpy(flags, stash, sizeof(flags));
|
|
||||||
|
|
||||||
/* Ensure the help lines will be redrawn and a selection is retained. */
|
/* Ensure the help lines will be redrawn and a selection is retained. */
|
||||||
currmenu = MMOST;
|
currmenu = MMOST;
|
||||||
shift_held = TRUE;
|
shift_held = TRUE;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user