Restore mousemask before exit

This commit is contained in:
Arun Prakash Jana 2019-08-24 19:44:49 +05:30
parent 3b7d07207d
commit eb3a9ad2ee
No known key found for this signature in database
GPG Key ID: A75979F35C080412
2 changed files with 7 additions and 4 deletions

View File

@ -15,6 +15,7 @@
<a href="https://travis-ci.org/jarun/nnn"><img src="https://img.shields.io/travis/jarun/nnn/master.svg?label=travis" alt="Travis Status" /></a>
<a href="https://circleci.com/gh/jarun/workflows/nnn"><img src="https://img.shields.io/circleci/project/github/jarun/nnn.svg?label=circleci" alt="CircleCI Status" /></a>
<a href="https://github.com/jarun/nnn/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-BSD%202--Clause-yellow.svg?maxAge=2592000" alt="License" /></a>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RMLTQ76JSXJ4Q"><img src="https://img.shields.io/badge/PayPal-donate-1eb0fc.svg" alt="Donate via PayPal!" /></a>
</p>
<p align="center">

View File

@ -917,7 +917,7 @@ static void resetcpind(void)
}
/* Initialize curses mode */
static bool initcurses(void)
static bool initcurses(mmask_t *oldmask)
{
short i;
@ -942,9 +942,9 @@ static bool initcurses(void)
//intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
#if NCURSES_MOUSE_VERSION <= 1
mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED, NULL);
mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED, oldmask);
#else
mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON4_PRESSED | BUTTON5_PRESSED, NULL);
mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON4_PRESSED | BUTTON5_PRESSED, oldmask);
#endif
mouseinterval(400);
curs_set(FALSE); /* Hide cursor */
@ -4704,6 +4704,7 @@ static void cleanup(void)
int main(int argc, char *argv[])
{
mmask_t mask;
char *arg = NULL;
int opt;
#ifdef __linux__
@ -4971,10 +4972,11 @@ int main(int argc, char *argv[])
read_history(g_buf);
#endif
if (!initcurses())
if (!initcurses(&mask))
return _FAILURE;
browse(initpath);
mousemask(mask, NULL);
exitcurses();
#ifndef NORL