mirror of git://git.sv.gnu.org/nano.git
- Fix screen getting trashed on signals nano can catch (TERM and HUP). New global variable curses_ended changes to winio.c:statubar() and nano.c:die()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1413 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
cff6e6f60f
commit
a0d89977b7
|
@ -27,6 +27,9 @@ CVS Code -
|
||||||
in syntax higlighting. (David Benbennick).
|
in syntax higlighting. (David Benbennick).
|
||||||
- Fix justify failing for certain lines, new function
|
- Fix justify failing for certain lines, new function
|
||||||
nano.c:breakable() (David Benbennick).
|
nano.c:breakable() (David Benbennick).
|
||||||
|
- Fix screen getting trashed on signals nano can catch
|
||||||
|
(TERM and HUP). New global variable curses_ended,
|
||||||
|
changes to winio.c:statubar() and nano.c:die().
|
||||||
- cut.c:
|
- cut.c:
|
||||||
do_cut_text()
|
do_cut_text()
|
||||||
- Fix incorrect cursor location when cutting long lines
|
- Fix incorrect cursor location when cutting long lines
|
||||||
|
|
1
files.c
1
files.c
|
@ -1339,6 +1339,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
|
||||||
statusbar(_("Cancelled"));
|
statusbar(_("Cancelled"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (!tmp)
|
||||||
titlebar(NULL);
|
titlebar(NULL);
|
||||||
fileptr = fileage;
|
fileptr = fileage;
|
||||||
|
|
||||||
|
|
5
global.c
5
global.c
|
@ -147,6 +147,11 @@ regmatch_t regmatches[10]; /* Match positions for parenthetical
|
||||||
subexpressions, max of 10 */
|
subexpressions, max of 10 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int curses_ended = FALSE; /* Indicates to statusbar() to simply
|
||||||
|
* write to stderr, since endwin() has
|
||||||
|
* ended curses mode. */
|
||||||
|
|
||||||
|
|
||||||
int length_of_list(const shortcut *s)
|
int length_of_list(const shortcut *s)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
10
nano.c
10
nano.c
|
@ -105,14 +105,12 @@ void die(const char *msg, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
endwin();
|
||||||
|
curses_ended = TRUE;
|
||||||
|
|
||||||
/* Restore the old term settings */
|
/* Restore the old term settings */
|
||||||
tcsetattr(0, TCSANOW, &oldterm);
|
tcsetattr(0, TCSANOW, &oldterm);
|
||||||
|
|
||||||
clear();
|
|
||||||
refresh();
|
|
||||||
resetty();
|
|
||||||
endwin();
|
|
||||||
|
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
vfprintf(stderr, msg, ap);
|
vfprintf(stderr, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
@ -2804,7 +2802,7 @@ void signal_init(void)
|
||||||
/* Handler for SIGHUP and SIGTERM */
|
/* Handler for SIGHUP and SIGTERM */
|
||||||
RETSIGTYPE handle_hupterm(int signal)
|
RETSIGTYPE handle_hupterm(int signal)
|
||||||
{
|
{
|
||||||
die(_("Received SIGHUP or SIGTERM"));
|
die(_("Received SIGHUP or SIGTERM\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* What do we do when we catch the suspend signal */
|
/* What do we do when we catch the suspend signal */
|
||||||
|
|
2
proto.h
2
proto.h
|
@ -115,6 +115,8 @@ extern historyheadtype search_history;
|
||||||
extern historyheadtype replace_history;
|
extern historyheadtype replace_history;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern int curses_ended;
|
||||||
|
|
||||||
/* Functions we want available */
|
/* Functions we want available */
|
||||||
|
|
||||||
/* Public functions in color.c */
|
/* Public functions in color.c */
|
||||||
|
|
11
winio.c
11
winio.c
|
@ -1355,10 +1355,19 @@ void statusbar(const char *msg, ...)
|
||||||
int start_x = 0;
|
int start_x = 0;
|
||||||
size_t foo_len;
|
size_t foo_len;
|
||||||
|
|
||||||
|
va_start(ap, msg);
|
||||||
|
|
||||||
|
/* Curses mode is turned off. If we use wmove() now, it will muck up
|
||||||
|
the terminal settings. So we just use vfprintf(). */
|
||||||
|
if (curses_ended) {
|
||||||
|
vfprintf(stderr, msg, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
assert(COLS >= 4);
|
assert(COLS >= 4);
|
||||||
foo = charalloc(COLS - 3);
|
foo = charalloc(COLS - 3);
|
||||||
|
|
||||||
va_start(ap, msg);
|
|
||||||
vsnprintf(foo, COLS - 3, msg, ap);
|
vsnprintf(foo, COLS - 3, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue