From 3ee1c3b3f6398c97c7138fc536e582c6b31265ed Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Wed, 30 Oct 2002 21:38:33 +0000 Subject: [PATCH] * ext.c (exec_extension): Don't create self-destructing scripts for the viewer - remove those scripts manually after calling view(). This fixes the problem with double F8 in the viewer on parsed files. Reported by David Martin --- src/ChangeLog | 8 +++++++- src/TODO | 3 --- src/ext.c | 17 +++++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index a69502bcc..24f8b8b2f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,11 +1,17 @@ 2002-10-30 Pavel Roskin + * ext.c (exec_extension): Don't create self-destructing scripts + for the viewer - remove those scripts manually after calling + view(). This fixes the problem with double F8 in the viewer on + parsed files. + Reported by David Martin + * ext.c (exec_extension): Don't rely on working #! - explicitly run /bin/sh on the temporary script. * mouse.h: Use definitions for GPM_B_DOWN and GPM_B_UP compatible with gpm-1.20. - Reported by by David Martin + Reported by David Martin 2002-10-29 Pavel Roskin diff --git a/src/TODO b/src/TODO index ad2ea9472..952b51a86 100644 --- a/src/TODO +++ b/src/TODO @@ -12,9 +12,6 @@ security issues. Consider applying a patch from PLD to make M-o propagate the current directory to the other panel. -Pressing F8 twice in the viewer causes error messages if the file was -preprocessed (i.e. gzipped files, manpages). - ncurses 5.2 turns off keypad under heavy load on xterm. Check if anything can be done about it. diff --git a/src/ext.c b/src/ext.c index f0a5c8a27..17d545f35 100644 --- a/src/ext.c +++ b/src/ext.c @@ -205,8 +205,15 @@ exec_extension (const char *filename, const char *data, int *move_dir, } } /* for */ - /* Make sure that the file removes itself when it finishes */ - fprintf (cmd_file, "\n/bin/rm -f %s\n", file_name); + /* + * Make the script remove itself when it finishes. + * Don't do it for the viewer - it may need to rerun the script, + * so we clean up after calling view(). + */ + if (!run_view) { + fprintf (cmd_file, "\n/bin/rm -f %s\n", file_name); + } + fclose (cmd_file); if ((run_view && !written_nonspace) || is_cd) { @@ -234,10 +241,12 @@ exec_extension (const char *filename, const char *data, int *move_dir, /* If we've written whitespace only, then just load filename * into view */ - if (written_nonspace) + if (written_nonspace) { view (cmd, filename, move_dir, start_line); - else + unlink (file_name); + } else { view (0, filename, move_dir, start_line); + } if (changed_hex_mode && !altered_hex_mode) default_hex_mode = def_hex_mode; if (changed_nroff_flag && !altered_nroff_flag)