lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev dev.15 patch 1


From: Klaus Weide
Subject: lynx-dev dev.15 patch 1
Date: Thu, 25 Nov 1999 09:45:10 -0600 (CST)

This is just synching up what I have to dev.15, more changes to follow.

Note that this also re-sends the -nozap / "poor man's scripting" stuff,
but doesn't repeat the description.  Tom, if you don't *want* to include
that - I hope you can reverse-patch it.  Or let me know.

   Klaus

* Changed F1 key bindings so it always invokes DWIMHELP, also in the
  Line Editor (for all three Binding tables).  This means that pressing
  F1 (if you have it, and it is correctly mapped and recognized) while
  in a text form field will now bring up the Line Editor Help Page for
  the currently selected line edit style.  Other keys bound to HELP by
  default ('?', 'h') remain unchanged, they still always go to the main
  Help Page.
* Don't let DWIMHELP show Line Editor help for a text input field that
  is disabled.
* Don't mangle a -cookie_file like /home/user/.lynx_cookies.~1~, only
  interpret the '~' as reference to HOME if it's right at the beginning
  and followed by '/' and then some more.  There are probably other
  instances where '~' gets mistreated (in addition to the intentional
  dropping of "user" from something like "~user/" in file URLs etc.).
* Changed type of EXP_KEYBOARD_LAYOUT tables to LYKbLayout_t.  They hold
  Unicode values, any similarity to LYKeymap_t is just accidental.
* Changed EXP_KEYBOARD_LAYOUT logic so that input characters that are
  unrepresentable in the current display character set (unless it is UTF-8)
  get transformed into '?' instead of some accidentally chosen 8-bit
  character.  For UTF-8, convert to UTF-8 encoding instead.
  Note the Line Editor isn't yet UTF-8 aware; with some care it is possible
  to enter UTF-8 text, but the display will be messed up, esp. the cursor
  position will be shown wrong.
* Some corrections for TPOS, YANK enhanced lineedit functions.
* Added back in a block in LYmbcsstrlen that got lost somehow.


Index: 1.21/src/LYUtils.c
--- 1.21/src/LYUtils.c Thu, 25 Nov 1999 07:30:47 -0600
+++ 1.21(w)/src/LYUtils.c Thu, 25 Nov 1999 07:56:10 -0600
@@ -2114,7 +2114,7 @@
     return;
 }
 
-#ifdef NSL_FORK
+#if defined(NSL_FORK) || defined(MISC_EXP)
 /*
  *  Returns the file descriptor from which keyboard input is expected,
  *  or INVSOC (-1) if not available.
@@ -2149,7 +2149,7 @@
     }
     return fd;
 }
-#endif /* NSL_FORK */
+#endif /* NSL_FORK || MISC_EXP */
 
 PRIVATE int fake_zap = 0;
 
@@ -2180,6 +2180,10 @@
     if (dump_output_immediately)
        return(TRUE);
 
+#ifdef MISC_EXP
+    if (LYNoZapKey)
+       return(TRUE);
+#endif
     /*
      * Avoid checking interrupts more than one per second, since it is a slow
      * and expensive operation - TD
Index: 1.21/src/LYMainLoop.c
--- 1.21/src/LYMainLoop.c Thu, 25 Nov 1999 07:30:47 -0600
+++ 1.21(w)/src/LYMainLoop.c Thu, 25 Nov 1999 08:18:52 -0600
@@ -2399,6 +2399,7 @@
      */
     if (curdoc.link >= 0 && curdoc.link < nlinks &&
        links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
+       !links[curdoc.link].form->disabled &&
        (links[curdoc.link].form->type == F_TEXT_TYPE ||
         links[curdoc.link].form->type == F_TEXT_SUBMIT_TYPE ||
         links[curdoc.link].form->type == F_PASSWORD_TYPE ||
Index: 1.21/src/LYOptions.c
--- 1.21/src/LYOptions.c Thu, 25 Nov 1999 07:30:47 -0600
+++ 1.21(w)/src/LYOptions.c Thu, 25 Nov 1999 08:20:39 -0600
@@ -4195,8 +4195,10 @@
      * Without LYUseFormsOptions set we should maybe not even get here.
      * However, it's possible we do; disable the form in that case. - kw
      */
+#ifndef NO_OPTION_MENU
     if (!LYUseFormsOptions)
        disable_all = TRUE;
+#endif
 
     BeginInternalPage(fp0, OPTIONS_TITLE, NULL); /* help link below */
 
Index: 1.21/src/LYStrings.c
--- 1.21/src/LYStrings.c Thu, 25 Nov 1999 07:30:47 -0600
+++ 1.21(w)/src/LYStrings.c Thu, 25 Nov 1999 08:32:46 -0600
@@ -1,5 +1,6 @@
 #include <HTUtils.h>
 #include <HTCJK.h>
+#include <UCAux.h>
 #include <LYUtils.h>
 #include <LYStrings.h>
 #include <LYGlobalDefs.h>
@@ -558,6 +559,8 @@
  *  characters. - FM
  *  Counts glyph cells if count_gcells is set. (Full-width
  *  characters in CJK mode count as two.)
+ *  Counts character glyphs if count_gcells is unset. (Full-
+ *  width characters in CJK mode count as one.) - kw
  */
 PUBLIC int LYmbcsstrlen ARGS3(
        char *,         str,
@@ -584,6 +587,10 @@
                i++;
                j++;
            }
+       } else if (!utf_flag && HTCJK != NOCJK && !count_gcells &&
+                  !isascii(str[i]) && str[(i + 1)] != '\0' &&
+                   !IsSpecialAttrChar(str[(i + 1)])) {
+           i++;
        }
     }
 
@@ -1468,6 +1475,50 @@
     }
 #endif /* !USE_SLANG || VMS */
 
+#ifdef MISC_EXP
+    if (LYNoZapKey > 1 && errno != EINTR &&
+       (c == EOF
+#ifdef USE_SLANG
+        || c = 0xFFFF
+#endif
+           )) {
+       int fd, kbd_fd;
+       CTRACE((tfp,
+               "nozap: Got EOF, curses %s, stdin is %p, LYNoZapKey reduced 
from %d to 0.\n",
+               LYCursesON ? "on" : "off", stdin, LYNoZapKey));
+       LYNoZapKey = 0;         /* 2 -> 0 */
+       if ((fd = fileno(stdin)) == 0 && !isatty(fd) &&
+           (kbd_fd = LYConsoleInputFD(FALSE)) == fd) {
+           char *term_name;
+           int new_fd = INVSOC;
+           if ((term_name = ttyname(fileno(stdout))) != NULL)
+               new_fd = open(term_name, O_RDONLY);
+           if (new_fd == INVSOC &&
+               (term_name = ttyname(fileno(stderr))) != NULL)
+               new_fd = open(term_name, O_RDONLY);
+           if (new_fd == INVSOC) {
+               term_name = ctermid(NULL);
+               new_fd = open(term_name, O_RDONLY);
+           }
+           CTRACE((tfp, "nozap: open(%s) returned %d.\n", term_name, new_fd));
+           if (new_fd >= 0) {
+               FILE *frp;
+               close(new_fd);
+               freopen(term_name, "r", stdin);
+               CTRACE((tfp,
+               "nozap: freopen(%s,\"r\",stdin) returned %p, stdin is now %p 
with fd %d.\n",
+                       term_name, frp, stdin, fileno(stdin)));
+               if (LYCursesON) {
+                   stop_curses();
+                   start_curses();
+                   refresh();
+               }
+               goto re_read;
+           }
+       }
+    }
+#endif /* MISC_EXP */
+
 #ifdef USE_GETCHAR
     if (c == EOF && errno == EINTR)    /* Ctrl-Z causes EINTR in getchar() */
        goto re_read;
@@ -2506,9 +2557,38 @@
     case LYE_CHAR:
 #ifdef EXP_KEYBOARD_LAYOUT
        if (map_active && ch < 128 && ch >= 0 &&
-           LYKbLayouts[current_layout][ch])
-           ch = UCTransUniChar((long) LYKbLayouts[current_layout][ch],
-               current_char_set);
+           LYKbLayouts[current_layout][ch]) {
+           UCode_t ucode = LYKbLayouts[current_layout][ch];
+           if (LYCharSet_UC[current_char_set].enc == UCT_ENC_UTF8) {
+               if (ucode > 127) {
+                   char utfbuf[8] = "\0\0\0\0\0\0\0";
+                   if (UCConvertUniToUtf8(ucode, utfbuf)) {
+                       int ulen = strlen(utfbuf);
+                       i = 0;
+                       if (ulen > 1) {
+                           if (Pos + ulen - 1 <= (MaxLen) &&
+                               StrLen + ulen - 1 < (MaxLen)) {
+                               for (i = 0; i < ulen-1; i++)
+                                   LYEdit1(edit, utfbuf[i], LYE_CHAR, FALSE);
+                               length = strlen(&Buf[0]);
+                               StrLen = length;
+                           } else {
+                               if (maxMessage)
+                                   _statusline(MAXLEN_REACHED_DEL_OR_MOV);
+                               return 0;
+                           }
+                       }
+                       ch = (unsigned char)utfbuf[i];
+                   }
+               } else {
+                   ch = (unsigned char)ucode;
+               }
+           } else {
+               ch = UCTransUniChar(ucode, current_char_set);
+               if (ch < 0)
+                   ch = '?';
+           }
+       }
 #endif
        /*
         *  ch is (presumably) printable character.
@@ -2792,7 +2872,7 @@
            Mark = Pos-1;
        if (Buf[Pos-1] == Buf[Pos]) {
            Pos++;
-           return(0);
+           break;
        }
        i = Buf[Pos-1]; Buf[Pos-1] = Buf[Pos]; Buf[Pos++] = (char) i;
        break;
@@ -2851,7 +2931,6 @@
 
                for(i = length; i >= Pos; i--)    /* Make room */
                    Buf[i+yanklen] = Buf[i];
-               Buf[length+1]='\0';
                for (i = 0; i < yanklen; i++)
                    Buf[Pos++] = (unsigned char) killbuffer[i];
 
Index: 1.21/src/LYKeymap.c
--- 1.21/src/LYKeymap.c Thu, 25 Nov 1999 07:30:47 -0600
+++ 1.21(w)/src/LYKeymap.c Thu, 25 Nov 1999 08:37:47 -0600
@@ -19,7 +19,7 @@
 #ifdef EXP_KEYBOARD_LAYOUT
 PUBLIC int current_layout = 0;  /* Index into LYKbLayouts[]   */
 
-PUBLIC LYKeymap_t * LYKbLayouts[]={
+PUBLIC LYKbLayout_t * LYKbLayouts[]={
        kb_layout_rot13,
        kb_layout_jcuken,
        kb_layout_yawerty
@@ -234,11 +234,11 @@
 
 #if (defined(_WINDOWS) || defined(__DJGPP__) || defined(__CYGWIN__))
 
-LYK_HELP,              0,              0,             0,
+LYK_DWIMHELP,          0,              0,             0,
 /* F1*/
 #else
 
-LYK_HELP,         LYK_ACTIVATE,     LYK_HOME,       LYK_END,
+LYK_DWIMHELP,     LYK_ACTIVATE,     LYK_HOME,       LYK_END,
 /* F1*/          /* Do key */      /* Find key */  /* Select key */
 
 #endif /* _WINDOWS || __DJGPP__ || __CYGWIN__ */
Index: 1.21/src/LYEditmap.c
--- 1.21/src/LYEditmap.c Thu, 25 Nov 1999 07:30:47 -0600
+++ 1.21(w)/src/LYEditmap.c Thu, 25 Nov 1999 08:40:13 -0600
@@ -136,12 +136,12 @@
 
 #if (defined(_WINDOWS) || defined(__DJGPP__))
 
-LYE_NOP,        LYE_NOP,        LYE_NOP,        LYE_NOP,
+LYE_FORM_PASS,  LYE_NOP,        LYE_NOP,        LYE_NOP,
 /* F1 */
 
 #else
 
-LYE_NOP,        LYE_TAB,        LYE_BOL,        LYE_EOL,
+LYE_FORM_PASS,  LYE_TAB,        LYE_BOL,        LYE_EOL,
 /* F1           Do key          Find key        Select key  */
 
 #endif /* _WINDOWS || __DJGPP__ */
@@ -382,12 +382,12 @@
 
 #if (defined(_WINDOWS) || defined(__DJGPP__))
 
-LYE_NOP,        LYE_NOP,        LYE_NOP,        LYE_NOP,
+LYE_FORM_PASS,  LYE_NOP,        LYE_NOP,        LYE_NOP,
 /* F1 */
 
 #else
 
-LYE_NOP,        LYE_TAB,        LYE_BOL,        LYE_EOL,
+LYE_FORM_PASS,  LYE_TAB,        LYE_BOL,        LYE_EOL,
 /* F1           Do key          Find key        Select key  */
 
 #endif /* _WINDOWS || __DJGPP__ */
Index: 1.21/src/LYKeymap.h
--- 1.21/src/LYKeymap.h Thu, 25 Nov 1999 07:30:47 -0600
+++ 1.21(w)/src/LYKeymap.h Thu, 25 Nov 1999 08:42:59 -0600
@@ -32,8 +32,9 @@
 extern LYKeymap_t keymap[KEYMAP_SIZE]; /* main keymap matrix */
 
 #ifdef EXP_KEYBOARD_LAYOUT
+typedef unsigned short LYKbLayout_t;
 extern int current_layout;
-extern LYKeymap_t * LYKbLayouts[];
+extern LYKbLayout_t * LYKbLayouts[];
 extern char * LYKbLayoutNames[];
 extern int LYSetKbLayout PARAMS((char *layout_id));
 #endif
Index: 1.21/src/LYGlobalDefs.h
--- 1.21/src/LYGlobalDefs.h Thu, 25 Nov 1999 07:30:47 -0600
+++ 1.21(w)/src/LYGlobalDefs.h Thu, 25 Nov 1999 08:44:09 -0600
@@ -394,6 +394,10 @@
 extern BOOLEAN LYUseBuiltinSuffixes;
 extern BOOLEAN dont_wrap_pre;
 
+#ifdef MISC_EXP
+extern int LYNoZapKey;  /* 0: off (do 'z' checking), 1: full, 2: initially */
+#endif
+
 #ifdef EXP_JUSTIFY_ELTS
 extern BOOL ok_justify;
 #endif
Index: 1.21/src/LYMain.c
--- 1.21/src/LYMain.c Thu, 25 Nov 1999 07:30:47 -0600
+++ 1.21(w)/src/LYMain.c Thu, 25 Nov 1999 08:54:59 -0600
@@ -458,6 +458,10 @@
 PUBLIC BOOLEAN LYReuseTempfiles = FALSE;
 PUBLIC BOOLEAN LYUseBuiltinSuffixes = TRUE;
 
+#ifdef MISC_EXP
+PUBLIC int LYNoZapKey = 0; /* 0: off (do z checking), 1: full, 2: initially */
+#endif
+
 /* These are declared in cutil.h for current freeWAIS libraries. - FM */
 #ifdef DECLARE_WAIS_LOGFILES
 PUBLIC char *log_file_name = NULL; /* for WAIS log file name   in libWWW */
@@ -1587,12 +1591,12 @@
        if(LYCookieFile == NULL) {
           LYAddPathToHome(LYCookieFile = malloc(LY_MAXPATH), LY_MAXPATH, 
COOKIE_FILE);
        } else {
-           if ((cp = strchr(LYCookieFile, '~'))) {
+           if (LYCookieFile[0] == '~' && LYCookieFile[1] == '/' &&
+               LYCookieFile[2] != '\0') {
                temp = NULL;
-               *(cp++) = '\0';
-               StrAllocCopy(temp, cp);
-               LYTrimPathSep(temp);
+               StrAllocCopy(temp, LYCookieFile + 2);
                StrAllocCopy(LYCookieFile, wwwName(Home_Dir()));
+               LYAddPathSep(&LYCookieFile);
                StrAllocCat(LYCookieFile, temp);
                FREE(temp);
            }
@@ -2712,6 +2716,21 @@
    return 0;
 }
 
+#ifdef MISC_EXP
+/* -nozap */
+static int nozap_fun ARGS1(
+       char *,                 next_arg)
+{
+    LYNoZapKey = 1; /* everything but "initially" treated as "full" - kw */
+    if (next_arg != 0) {
+       if (strcasecomp(next_arg, "initially") == 0)
+           LYNoZapKey = 2;
+       
+    }
+   return 0;
+}
+#endif /* MISC_EXP */
+
 /* -pauth */
 static int pauth_fun ARGS1(
        char *,                 next_arg)
@@ -3315,6 +3334,12 @@
       "nounderline",   FUNCTION_ARG,           nounderline_fun,
       "disable underline video-attribute"
    ),
+#ifdef MISC_EXP
+   PARSE_FUN(
+      "nozap",         FUNCTION_ARG,           nozap_fun,
+      "=DURATION (\"initially\" or \"full\") disable checks for 'z' key"
+   ),
+#endif
    PARSE_SET(
       "number_fields", SET_ARG,                &number_fields,
       "force numbering of links as well as form input fields"
@@ -3591,9 +3616,13 @@
 
     fprintf (stdout, gettext("USAGE: %s [options] [file]\n"), pgm);
     fprintf (stdout, gettext("Options are:\n"));
+#ifdef VMS
     print_help_strings("",
 "receive the arguments from stdin (enclose\n\
 in double-quotes (\"-\") on VMS)", NULL);
+#else
+    print_help_strings("", "receive options and arguments from stdin", NULL);
+#endif /* VMS */
 
     for (p = Arg_Table; p->name != 0; p++) {
        char temp[LINESIZE], *value = temp;
Index: 1.21/lynx.cfg
--- 1.21/lynx.cfg Thu, 25 Nov 1999 07:30:47 -0600
+++ 1.21(w)/lynx.cfg Thu, 25 Nov 1999 09:10:11 -0600
@@ -1825,13 +1825,13 @@
 #       Left Arrow: 0x103
 #        Page Down: 0x104
 #          Page Up: 0x105
-#      Keypad Home: 0x106
-#       Keypad End: 0x107
+#      Keypad Home: 0x106 (see also 0x10A)
+#       Keypad End: 0x107 (see also 0x10B)
 #   Function key 1: 0x108
 # vt100   Help Key: 0x108
 # vt100     Do Key: 0x109
-# vt100   Find Key: 0x10A
-# vt100 Select Key: 0x10B
+# vt100   Find Key: 0x10A (The key with label "Home" may be treated as Find)
+# vt100 Select Key: 0x10B (The key with label "End" may be treated as Select)
 #       Insert Key: 0x10C
 # Remove (Del) Key: 0x10D
 #      ignored key  0x10E (reserved for internal use, DO_NOTHING)
@@ -1873,8 +1873,8 @@
 #KEYMAP:0x10B:END      # Function key Select - Go to bottom of current document
 #KEYMAP:0x100:PREV_LINK        # Move to the previous link or page
 #KEYMAP:0x101:NEXT_LINK        # Move to the next link or page
-#KEYMAP:0x10F:FASTBACKW_LINK   # Move always to previous link or text area
-#KEYMAP:^I:FASTFORW_LINK       # Move always to next link or text area
+#KEYMAP:0x10F:FASTBACKW_LINK # Back Tab - Move to previous link or text area
+#KEYMAP:^I:FASTFORW_LINK     # Tab key - Move always to next link or text area
 #KEYMAP:<:UP_LINK       # Move to the link above
 #KEYMAP:>:DOWN_LINK    # Move to the link below
 #KEYMAP:0x7F:HISTORY   # Show the history list
@@ -1885,7 +1885,7 @@
 #KEYMAP:g:GOTO         # Goto a random URL
 #KEYMAP:G:ECGOTO       # Edit the current document's URL and go to it
 #KEYMAP:H:HELP         # Show default help screen
-#KEYMAP:0x108:HELP     # Function key Help - Show default help screen
+#KEYMAP:0x108:DWIMHELP # Function key Help - Show a help screen
 #KEYMAP:i:INDEX                # Show default index
 #*** Edit FORM_LINK_* messages in LYMessages_en.h if you change NOCACHE ***
 #KEYMAP:x:NOCACHE      # Force submission of form or link with no-cache
@@ -1927,7 +1927,7 @@
 # line-editor to normal KEYMAP handling, i.e. this flag acts like an implied
 # ^V escape.  It overrides any line-editor binding for the key.  For example,
 #
-#KEYMAP:0x108:HELP:PASS  # Function key Help (or F1) - Always default help
+#KEYMAP:0x10C:UP_TWO:PASS # Function key Insert - Move display up two lines
 #
 # In addition, the following functions are not directly mapped to any keys
 # by default, although some of them may be mapped in specific line-editor
Index: 1.21/src/chrtrans/jcuken_kb.h
--- 1.21/src/chrtrans/jcuken_kb.h Wed, 06 Oct 1999 13:57:53 -0500
+++ 1.21(w)/src/chrtrans/jcuken_kb.h Thu, 25 Nov 1999 09:13:46 -0600
@@ -1,4 +1,4 @@
-static LYKeymap_t kb_layout_jcuken[128] = { 
+static LYKbLayout_t kb_layout_jcuken[128] = { 
 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, /* 00..07 */ 
 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, /* 08..0F */ 
 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, /* 10..17 */ 
Index: 1.21/src/chrtrans/rot13_kb.h
--- 1.21/src/chrtrans/rot13_kb.h Wed, 06 Oct 1999 13:57:53 -0500
+++ 1.21(w)/src/chrtrans/rot13_kb.h Thu, 25 Nov 1999 09:13:48 -0600
@@ -1,4 +1,4 @@
-static LYKeymap_t kb_layout_rot13[128] = { 
+static LYKbLayout_t kb_layout_rot13[128] = { 
 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, /* 00..07 */ 
 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, /* 08..0F */ 
 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, /* 10..17 */ 
Index: 1.21/src/chrtrans/yawerty_kb.h
--- 1.21/src/chrtrans/yawerty_kb.h Wed, 06 Oct 1999 13:57:53 -0500
+++ 1.21(w)/src/chrtrans/yawerty_kb.h Thu, 25 Nov 1999 09:13:49 -0600
@@ -1,4 +1,4 @@
-static LYKeymap_t kb_layout_yawerty[128] = { 
+static LYKbLayout_t kb_layout_yawerty[128] = { 
 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, /* 00..07 */ 
 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, /* 08..0F */ 
 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, /* 10..17 */ 
Index: 1.21/lynx_help/keystrokes/bashlike_edit_help.html
--- 1.21/lynx_help/keystrokes/bashlike_edit_help.html Thu, 25 Nov 1999 07:30:47 
-0600
+++ 1.21(w)/lynx_help/keystrokes/bashlike_edit_help.html Thu, 25 Nov 1999 
09:16:34 -0600
@@ -161,7 +161,7 @@
             M-e      EDITTEXTAREA   C-e C-e
             M-g      GROWTEXTAREA   (none, C-v $ suggested?)
             M-i      INSERTFILE     (none, C-v # suggested?)
-            M-F1     DWIMHELP       (none, F1 suggested)
+            M-F1     DWIMHELP       F1
             M-Find   WHEREIS        C-v /
             M-Select NEXT           C-v n
 


reply via email to

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