lynx-dev
[Top][All Lists]
Advanced

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

[2.8.1rel.2] lineedit cleanup/enhancement (was: Re: lynx-dev [lynx2.8.1r


From: Kim DeVaughn
Subject: [2.8.1rel.2] lineedit cleanup/enhancement (was: Re: lynx-dev [lynx2.8.1rel.2] lineedit bug fix (and enhancement))
Date: Tue, 3 Nov 1998 00:54:52 -0800

On Mon, Nov 02, 1998, Dick Wesseling (address@hidden) said:
|
| address@hidden said:
| >
| > And as long as I'm doing a bit of cleanup in this area, let me
| > reiterate the question I asked previously:
| >
| >  "is there some rationale for all the trailing whitespace in
| > LYEditmap.c:LYLineeditNames[] for the "Default Binding     "
| > string?"
|
| This served to align items in the Options screen. The line edit style
| is now on a line by itself, but I seem to remember that it once shared
| a line with another item that was to the right of it.

Oh, OK.  In the current old-style options menu, it's fine without the
trailing whitespace, and is a non sequitur for the new-style forms type
options page (which unfathomably omits line-editor binding options).

The attached patch now removes the redundent LYE_DELC case code from
LYStrings.c, and add the new LYE_DELEOL case (which deletes characters
from the current cursor position, thru the end-of-line).

Default binding for DELEOL is ^\ (formerly a NOP).

References to LYE_DELC are removed from the maps, and documentation, and
it is equated to LYE_DELN for backward compatibility reasons.

I've cleaned up the help files a bit, to make it clear that the setting
of emacs/vi keys ON, has no effect on the line-editor bindings (a point
which confused the Hell out of me for awhile).  I also clarified what the
next/current char is (WRT cursor style), and removed references to DELC,
etc.

Whether my "Better Bindings" map gets included in the distribution or
not doesn't concern me much, but I do hope the new LYE_DELEOL function
does, as well as the doc and LYE_DELC cleanup.

/kim


diff -uNr lynx-2.8.1-rel.2.orig/src/LYStrings.c 
lynx-2.8.1-rel.2+kd/src/LYStrings.c
--- lynx-2.8.1-rel.2.orig/src/LYStrings.c       Mon Nov  2 15:47:16 1998
+++ lynx-2.8.1-rel.2+kd/src/LYStrings.c Mon Nov  2 22:49:25 1998
@@ -1514,14 +1514,28 @@
        }
        break;
 
+    case LYE_DELEOL:
+        /*
+        *  Delete from current cursor position thru EOL.
+        */
+        {
+            int pos0 = Pos;
+           LYEdit1(edit, 0, LYE_EOL, FALSE);
+            pos0 = Pos - pos0;
+           while (pos0--)
+                LYEdit1(edit, 0, LYE_DELP, FALSE);
+       }
+        break;
+
     case LYE_DELN:
        /*
-        *  Delete next character
+        *  Delete next character (I-beam style cursor), or current
+        *  character (box/underline style cursor).
         */
        if (Pos >= length)
            break;
        Pos++;
-       /* fall through */
+       /* fall through - DO NOT RELOCATE the LYE_DELN case wrt LYE_DELP */
 
     case LYE_DELP:
        /*
@@ -1530,18 +1544,6 @@
        if (length == 0 || Pos == 0)
            break;
        Pos--;
-       for (i = Pos; i < length; i++)
-           Buf[i] = Buf[i+1];
-       i--;
-       Buf[i] = 0;
-       break;
-
-    case LYE_DELC:
-       /*
-        *  Delete current character.
-        */
-       if (length == 0 || Pos == length)
-           break;
        for (i = Pos; i < length; i++)
            Buf[i] = Buf[i+1];
        i--;
diff -uNr lynx-2.8.1-rel.2.orig/src/LYStrings.h 
lynx-2.8.1-rel.2+kd/src/LYStrings.h
--- lynx-2.8.1-rel.2.orig/src/LYStrings.h       Mon Nov  2 15:47:16 1998
+++ lynx-2.8.1-rel.2+kd/src/LYStrings.h Mon Nov  2 16:52:35 1998
@@ -122,9 +122,9 @@
 #define LYE_TAB   (LYE_ENTER +1)  /* Input complete, return TAB  */
 #define LYE_ABORT (LYE_TAB   +1)  /* Input cancelled       */
 
-#define LYE_DELN  (LYE_ABORT +1)  /* Delete next    char   */
-#define LYE_DELC  (LYE_DELN  +1)  /* Delete current char   */
-#define LYE_DELP  (LYE_DELC  +1)  /* Delete prev    char   */
+#define LYE_DELN  (LYE_ABORT +1)  /* Delete next/curr char */
+#define LYE_DELC  (LYE_DELN)      /* Obsolete (DELC case was equiv to DELN) */
+#define LYE_DELP  (LYE_DELN  +1)  /* Delete prev      char */
 #define LYE_DELNW (LYE_DELP  +1)  /* Delete next word      */
 #define LYE_DELPW (LYE_DELNW +1)  /* Delete prev word      */
 
@@ -143,6 +143,8 @@
 #define LYE_LKCMD (LYE_UPPER +1)  /* Invoke command prompt */
 
 #define LYE_AIX   (LYE_LKCMD +1)  /* Hex 97               */
+
+#define LYE_DELEOL (LYE_AIX  +1)  /* Delete thru EOL       */
 
 #if defined(USE_KEYMAPS)
 extern int lynx_initialize_keymaps NOPARAMS;
diff -uNr lynx-2.8.1-rel.2.orig/src/LYEditmap.c 
lynx-2.8.1-rel.2+kd/src/LYEditmap.c
--- lynx-2.8.1-rel.2.orig/src/LYEditmap.c       Mon Nov  2 15:47:16 1998
+++ lynx-2.8.1-rel.2+kd/src/LYEditmap.c Mon Nov  2 18:38:56 1998
@@ -15,7 +15,7 @@
 LYE_NOP,        LYE_BOL,        LYE_DELPW,      LYE_ABORT,
 /* nul          ^A              ^B              ^C      */
 
-LYE_DELC,       LYE_EOL,        LYE_DELNW,      LYE_ABORT,
+LYE_DELN,       LYE_EOL,        LYE_DELNW,      LYE_ABORT,
 /* ^D           ^E              ^F              ^G      */
 
 LYE_DELP,       LYE_ENTER,      LYE_ENTER,      LYE_LOWER,
@@ -33,7 +33,7 @@
 LYE_ERASE,      LYE_NOP,        LYE_NOP,        LYE_NOP,
 /* ^X           ^Y              ^Z              ESC     */
 
-LYE_NOP,        LYE_NOP,        LYE_NOP,        LYE_NOP,
+LYE_DELEOL,     LYE_NOP,        LYE_NOP,        LYE_NOP,
 /* ^\           ^]              ^^              ^_      */
 
 /* sp .. RUBOUT                                         */
@@ -114,9 +114,115 @@
 };
 
 /*
- * Add your favorite key binding HERE
+ * Add your favorite key bindings HERE
  */
 
+/* 01 */ /* Default except that  ^F=cursor-forward  and  ^B=cursor-backward */
+/*    */
+
+PRIVATE char BetterEditBinding[]={
+
+LYE_NOP,        LYE_BOL,        LYE_BACK,       LYE_ABORT,
+/* nul          ^A              ^B              ^C      */
+
+LYE_DELN,       LYE_EOL,        LYE_FORW,       LYE_ABORT,
+/* ^D           ^E              ^F              ^G      */
+
+LYE_DELP,       LYE_ENTER,      LYE_ENTER,      LYE_DELEOL,
+/* bs           tab             nl              ^K      */
+
+LYE_NOP,        LYE_ENTER,      LYE_FORWW,      LYE_ABORT,
+/* ^L           cr              ^N              ^O      */
+
+LYE_BACKW,      LYE_NOP,        LYE_DELPW,      LYE_NOP,
+/* ^P           XON             ^R              XOFF    */
+
+LYE_DELNW,      LYE_ERASE,      LYE_LKCMD,      LYE_NOP,
+/* ^T           ^U              ^V              ^W      */
+
+LYE_ERASE,      LYE_NOP,        LYE_NOP,        LYE_NOP,
+/* ^X           ^Y              ^Z              ESC     */
+
+LYE_DELEOL,     LYE_NOP,        LYE_UPPER,      LYE_LOWER,
+/* ^\           ^]              ^^              ^_      */
+
+/* sp .. RUBOUT                                         */
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_DELP,
+
+/* 80..9F ISO-8859-1 8-bit escape characters. */
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_AIX,
+/*                                               97 AIX    */
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+
+/* A0..FF (permissible ISO-8859-1) 8-bit characters. */
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+LYE_CHAR,       LYE_CHAR,       LYE_CHAR,       LYE_CHAR,
+
+/* 100..10E function key definitions in LYStrings.h */
+LYE_NOP,        LYE_NOP,        LYE_FORW,       LYE_BACK,
+/* UPARROW      DNARROW         RTARROW         LTARROW     */
+
+LYE_NOP,        LYE_NOP,        LYE_BOL,        LYE_EOL,
+/* PGDOWN       PGUP            HOME            END         */
+
+LYE_NOP,        LYE_TAB,        LYE_BOL,        LYE_EOL,
+/* F1           Do key          Find key        Select key  */
+
+LYE_NOP,        LYE_DELP,       LYE_NOP,        LYE_NOP,
+/* Insert key   Remove key      DO_NOTHING      ...         */
+};
+
 
 /*
  * Add the array name to LYLineEditors
@@ -124,6 +230,7 @@
 
 PUBLIC char * LYLineEditors[]={
         DefaultEditBinding,     /* You can't please everyone, so you ... DW */
+       BetterEditBinding,      /* No, you certainly can't ... /ked 10/27/98*/
 };
 
 /*
@@ -131,7 +238,8 @@
  * The order of LYLineEditors and LyLineditNames MUST be the same
  */
 PUBLIC char * LYLineeditNames[]={
-        "Default Binding     ",
+        "Default Binding",
+       "Better Bindings",
         (char *) 0
 };
 
diff -uNr lynx-2.8.1-rel.2.orig/lynx_help/Lynx_users_guide.html 
lynx-2.8.1-rel.2+kd/lynx_help/Lynx_users_guide.html
--- lynx-2.8.1-rel.2.orig/lynx_help/Lynx_users_guide.html       Tue Oct 27 
18:08:12 1998
+++ lynx-2.8.1-rel.2+kd/lynx_help/Lynx_users_guide.html Mon Nov  2 23:01:03 1998
@@ -761,12 +761,16 @@
            uppercase H, J, K, and L keys remain mapped to their configured
            bindings (normally HELP, JUMP, KEYMAP, and LIST, respectively).
 
+         <p>Note: this has no effect on the line-editor's key bindings.
+
    <dt>Emacs keys
        <dd>If set to ON then the CTRL-P, CTRL-N, CTRL-F, and CTRL-B keys
            will be mapped to up-arrow, down-arrow, right-arrow, and
            left-arrow, respectively.  Otherwise, they remain mapped to
            their configured bindings (normally UP_TWO lines, DOWN_TWO
            lines, NEXT_PAGE, and PREV_PAGE, respectively).
+
+         <p>Note: this has no effect on the line-editor's key bindings.
 
    <dt>Show dot files
        <dd>If display/creation of hidden (dot) files/directories is
diff -uNr lynx-2.8.1-rel.2.orig/lynx_help/keystrokes/edit_help.html 
lynx-2.8.1-rel.2+kd/lynx_help/keystrokes/edit_help.html
--- lynx-2.8.1-rel.2.orig/lynx_help/keystrokes/edit_help.html   Mon Nov 24 
10:22:32 1997
+++ lynx-2.8.1-rel.2+kd/lynx_help/keystrokes/edit_help.html     Mon Nov  2 
18:42:40 1998
@@ -10,31 +10,41 @@
 Lynx invokes a built-in <em>Line Editor</em> for entering strings in
 response to prompts, in forms, and for email messages if an external editor
 has not been defined.  Administrators can offer alternate key bindings
-by adding them in LYEditmap.c before compiling Lynx, and they can
-be selected via the 'o'ptions menu.  This is the <em>Default Binding</em>:
-<pre>
-     ENTER  Input complete       -  RETURN
-     TAB    Input complete       -  TAB, Do
-     ABORT  Input cancelled      -  Ctrl-G, Ctrl-O, Ctrl-C
-     ERASE  Erase the line       -  Ctrl-U, Ctrl-X
-
-     BACK   Cursor back    char  -  Left-Arrow
-     FORW   Cursor forward char  -  Right-Arrow
-     BACKW  Cursor back    word  -  Ctrl-P
-     FORWW  Cursor forward word  -  Ctrl-N
-     BOL    Go to begin of line  -  Ctrl-A, Home, Find
-     EOL    Go to end   of line  -  Ctrl-E, End,  Select
-
-     DELP   Delete prev    char  -  Ctrl-H, DELETE, Remove
-     DELC   Delete current char  -  Ctrl-D
-     DELN   Delete next    char  -  Ctrl-R
-     DELPW  Delete prev    word  -  Ctrl-B
-     DELNW  Delete next    word  -  Ctrl-F
+by adding them in LYEditmap.c before compiling Lynx.  If available, they may
+be selected via the old-style 'o'ptions menu (see -forms_options command
+line option), or by editing lineedit_mode in the .lynxrc file.
 
-     LOWER  Lower case the line  -  Ctrl-K
-     UPPER  Upper case the line  -  Ctrl-T
+<p>Note: setting emacs/vi keys ON has no effect on line-editor bindings.
 
-     LKCMD  Invoke cmd prompt    -  Ctrl-V (in form text fields, only)
+<p>This is the <em>Default Binding</em>:
+
+<p><pre>
+     ENTER  Input complete        -  RETURN
+     TAB    Input complete        -  TAB, Do
+     ABORT  Input cancelled       -  Ctrl-G, Ctrl-O, Ctrl-C
+     ERASE  Erase the line        -  Ctrl-U, Ctrl-X
+
+     BACK   Cursor back     char  -  Left-Arrow
+     FORW   Cursor forward  char  -  Right-Arrow
+     BACKW  Cursor back     word  -  Ctrl-P
+     FORWW  Cursor forward  word  -  Ctrl-N
+     BOL    Go to begin of  line  -  Ctrl-A, Home, Find
+     EOL    Go to end   of  line  -  Ctrl-E, End,  Select
+
+     DELP   Delete prev     char  -  Ctrl-H, DELETE, Remove
+     DELN   Delete next [*] char  -  Ctrl-D, Ctrl-R
+     DELPW  Delete prev     word  -  Ctrl-B
+     DELNW  Delete next     word  -  Ctrl-F
+     DELEOL Delete to end of line -  Ctrl-\
+
+     LOWER  Lower case the line   -  Ctrl-K
+     UPPER  Upper case the line   -  Ctrl-T
+
+     LKCMD  Invoke cmd prompt     -  Ctrl-V (in form text fields, only)
+
+[*] "next" means the character "under" a box or underline type cursor; it
+     means "to the immediate right of" an I-beam type (between characters)
+     cursor.
 </pre>
 </body>
 </html>
#--eof--#

reply via email to

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