lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev [PATCH 2.8.4dev.10] Enable interruption by ESC


From: Ilya Zakharevich
Subject: lynx-dev [PATCH 2.8.4dev.10] Enable interruption by ESC
Date: Sun, 21 Jan 2001 01:36:14 -0500
User-agent: Mutt/1.2.5i

This patch enables interrupting LYNX by any char bound to INTERRUPT.

Enjoy,
Ilya

--- ./src/LYCookie.c-pre-int    Thu Dec 21 21:44:10 2000
+++ ./src/LYCookie.c    Sat Jan 20 15:50:04 2001
@@ -67,6 +67,7 @@
 #include <LYStrings.h>
 #include <GridText.h>
 #include <LYCookie.h>
+#include <LYKeymap.h>
 
 #include <LYLeaks.h>
 
@@ -2436,11 +2437,10 @@ PRIVATE int LYHandleCookies ARGS4 (
                                return(HT_NO_DATA);
 
                            case 'C':
-                           case LYCharINTERRUPT2:      /* Ctrl-G */
-                           case LYCharINTERRUPT1:      /* Ctrl-C */
                                /*
                                 *  Cancelled. - FM
                                 */
+                             reject:
                                HTUserMsg(CANCELLED);
                                return(HT_NO_DATA);
 
@@ -2524,6 +2524,8 @@ Delete_all_cookies_in_domain:
                                return(HT_NO_DATA);
 
                            default:
+                               if (LYCharIsINTERRUPT(ch))
+                                   goto reject;
                                continue;
                        }
                        break;
--- ./src/HTAlert.c-pre-int     Thu Dec 21 21:44:10 2000
+++ ./src/HTAlert.c     Sat Jan 20 15:48:06 2001
@@ -19,6 +19,7 @@
 #include <GridText.h>
 #include <LYCookie.h>
 #include <LYHistory.h> /* store statusline messages */
+#include <LYKeymap.h>
 
 #include <LYLeaks.h>
 
@@ -358,10 +359,7 @@ PUBLIC int HTConfirmDefault ARGS2(CONST 
                c = TOUPPER(*msg_no);
            }
 #endif /* VMS */
-           if (LYCharIsINTERRUPT(c)) { /* remember we had ^G or ^C */
-               conf_cancelled = YES;
-               result = NO;
-           } else if (c == TOUPPER(*msg_yes)) {
+           if (c == TOUPPER(*msg_yes)) {
                result = YES;
            } else if (c == TOUPPER(*msg_no)) {
                result = NO;
@@ -369,6 +367,9 @@ PUBLIC int HTConfirmDefault ARGS2(CONST 
                result = YES;
            } else if (fallback_n && c == fallback_n) {
                result = NO;
+           } else if (LYCharIsINTERRUPT(c)) { /* remember we had ^G or ^C */
+               conf_cancelled = YES;
+               result = NO;
            } else if (Dft != DFT_CONFIRM) {
                result = Dft;
                break;
@@ -810,11 +811,10 @@ PUBLIC BOOL HTConfirmCookie ARGS4(
                return TRUE;
 
            case 'N':
-           case LYCharINTERRUPT2:      /* Ctrl-G */
-           case LYCharINTERRUPT1:      /* Ctrl-C */
                /*
                **  Reject the cookie.
                */
+             reject:
                HTUserMsg(REJECTING_COOKIE);
                return FALSE;
 
@@ -834,6 +834,8 @@ PUBLIC BOOL HTConfirmCookie ARGS4(
                return TRUE;
 
            default:
+               if (LYCharIsINTERRUPT(ch))
+                   goto reject;
                continue;
        }
     }
--- ./src/LYOptions.c-pre-esc   Thu Dec 21 21:44:10 2000
+++ ./src/LYOptions.c   Sat Jan 20 15:40:56 2001
@@ -523,7 +523,7 @@ draw_options:
     while (response != 'R' &&
           !LYisNonAlnumKeyname(response, LYK_PREV_DOC) &&
           response != '>' && !term_options &&
-          LYCharIsINTERRUPT(response)) {
+          LYCharIsINTERRUPT_NO_letter(response)) {
        if (AddValueAccepted == TRUE) {
            _statusline(VALUE_ACCEPTED);
            AddValueAccepted = FALSE;
@@ -535,7 +535,7 @@ draw_options:
 
        refresh();
        response = LYgetch_single();
-       if (term_options || LYCharIsINTERRUPT(response))
+       if (term_options || LYCharIsINTERRUPT_NO_letter(response))
            response = 'R';
        if (LYisNonAlnumKeyname(response, LYK_REFRESH)) {
            lynx_force_repaint();
@@ -1711,7 +1711,7 @@ PRIVATE int boolean_choice ARGS4(
        if (term_options == FALSE) {
            response = LYgetch_single();
        }
-       if (term_options || LYCharIsINTERRUPT(response)) {
+       if (term_options || LYCharIsINTERRUPT_NO_letter(response)) {
             /*
              *  Control-C or Control-G.
              */
@@ -1940,7 +1940,7 @@ draw_bookmark_list:
 
     while (!term_options &&
           !LYisNonAlnumKeyname(response, LYK_PREV_DOC) &&
-          !LYCharIsINTERRUPT(response) && response != '>') {
+          !LYCharIsINTERRUPT_NO_letter(response) && response != '>') {
 
        move((LYlines - 2), 0);
        lynx_start_prompt_color ();
@@ -1954,7 +1954,7 @@ draw_bookmark_list:
        /*
         *  Check for a cancel.
         */
-       if (term_options || LYCharIsINTERRUPT(response) ||
+       if (term_options || LYCharIsINTERRUPT_NO_letter(response) ||
            LYisNonAlnumKeyname(response, LYK_PREV_DOC))
            continue;
 
--- ./src/LYUtils.c-pre-esc     Sat Jan 20 02:13:38 2001
+++ ./src/LYUtils.c     Sat Jan 20 15:43:58 2001
@@ -2386,7 +2386,7 @@ PUBLIC int HTCheckForInterrupt NOARGS
      */
 
        /** Keyboard 'Z' or 'z', or Control-G or Control-C **/
-    if (TOUPPER(c) == 'Z' || LYCharIsINTERRUPT(c))
+    if (LYCharIsINTERRUPT(c))
        return((int)TRUE);
 
        /* There is a subset of mainloop() actions available at this stage:
@@ -4949,7 +4949,7 @@ PUBLIC int win32_check_interrupt()
     if (kbhit()) {
        c = getch();
        /** Keyboard 'Z' or 'z', or Control-G or Control-C **/
-       if (TOUPPER(c) == 'Z' || LYCharIsINTERRUPT(c) || c == 0x1b) {
+       if (LYCharIsINTERRUPT(c) || c == 0x1b) {
            return TRUE;
        }
     }
--- ./src/LYUtils.h-pre-esc     Thu Dec 21 21:44:10 2000
+++ ./src/LYUtils.h     Sat Jan 20 15:29:00 2001
@@ -34,8 +34,16 @@
 
 #define LYIsPipeCommand(s) ((s)[0] == '|')
 
-/* See definitions in src/LYCharVals.h. */
-#define LYCharIsINTERRUPT(ch)  ((ch) == LYCharINTERRUPT1 || ch == 
LYCharINTERRUPT2)
+/* See definitions in src/LYCharVals.h.  The hardcoded values...
+   This prohibits binding C-c and C-g.  Maybe it is better to remove this? */
+#define LYCharIsINTERRUPT_HARD(ch)     \
+  ((ch) == LYCharINTERRUPT1 || ch == LYCharINTERRUPT2)
+
+#define LYCharIsINTERRUPT(ch)          \
+  (LYCharIsINTERRUPT_HARD(ch) || LKC_TO_LAC(keymap,ch) == LYK_INTERRUPT)
+
+#define LYCharIsINTERRUPT_NO_letter(ch)        \
+  (LYCharIsINTERRUPT(ch) && !isprint(ch))
 
 #if defined(DOSPATH) || defined(__EMX__)
 #define LYIsPathSep(ch) ((ch) == '/' || (ch) == '\\')
--- ./src/LYNews.c-pre-missing  Wed Oct 25 11:35:28 2000
+++ ./src/LYNews.c      Sun Jan 21 00:57:22 2001
@@ -14,6 +14,7 @@
 #include <GridText.h>
 #include <LYCharSets.h>
 #include <LYNews.h>
+#include <LYKeymap.h>
 
 #include <LYGlobalDefs.h>
 
--- ./src/LYMail.c-pre-missing  Thu Dec 21 21:44:10 2000
+++ ./src/LYMail.c      Sun Jan 21 00:51:58 2001
@@ -10,6 +10,7 @@
 #include <GridText.h>
 #include <LYMail.h>
 #include <LYCharSets.h>  /* to get current charset for mail header */
+#include <LYKeymap.h>
 
 #include <LYLeaks.h>

; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]