]> Sergey Matveev's repositories - nnn.git/commitdiff
Restore mousemask before exit
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 24 Aug 2019 14:14:49 +0000 (19:44 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 24 Aug 2019 14:14:49 +0000 (19:44 +0530)
README.md
src/nnn.c

index bf83b2e52c6d0014ca3f232925b554e2013d7789..201e1619e55fb0e89ef7b2effc62b25ada882982 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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">
index 4773bfe0721ae6dd70d0bdcf014cfb7a1421e7fa..dec86810bf255ba8de730a377cf7605e392a43e7 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -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