about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CHANGES9
-rw-r--r--PACKAGE/lynx.nsi18
-rw-r--r--README44
-rw-r--r--WWW/Library/Implementation/HTTCP.c4
-rw-r--r--WWW/Library/Implementation/HTTP.c30
-rw-r--r--aclocal.m412
-rwxr-xr-xconfigure4
-rw-r--r--samples/lynx-keymaps13
-rw-r--r--src/GridText.c14
-rw-r--r--src/HTAlert.c6
-rw-r--r--src/HTML.c4
-rw-r--r--src/LYBookmark.c4
-rw-r--r--src/LYCharUtils.c4
-rw-r--r--src/LYDownload.c22
-rw-r--r--src/LYEditmap.c224
-rw-r--r--src/LYForms.c78
-rw-r--r--src/LYGetFile.c4
-rw-r--r--src/LYIcon.rc33
-rw-r--r--src/LYJump.c14
-rw-r--r--src/LYKeymap.c19
-rw-r--r--src/LYLocal.c6
-rw-r--r--src/LYMail.c12
-rw-r--r--src/LYMain.c4
-rw-r--r--src/LYMainLoop.c36
-rw-r--r--src/LYNews.c12
-rw-r--r--src/LYOptions.c36
-rw-r--r--src/LYPrint.c14
-rw-r--r--src/LYSearch.c14
-rw-r--r--src/LYStrings.c2054
-rw-r--r--src/LYStrings.h181
-rw-r--r--src/LYUpload.c4
-rw-r--r--src/LYUtils.c16
-rw-r--r--src/LYrcFile.c4
-rw-r--r--src/makefile.in4
-rw-r--r--src/tidy_tls.c10
35 files changed, 1458 insertions, 1509 deletions
diff --git a/CHANGES b/CHANGES
index ce0ecf82..f900e113 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,14 @@
--- $LynxId: CHANGES,v 1.678 2013/10/11 09:47:44 tom Exp $
+-- $LynxId: CHANGES,v 1.682 2013/10/13 23:09:45 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
-2013-10-11 (2.8.8dev.17)
+2013-10-13 (2.8.8dev.17)
+* add version-info to LYIcon.rc -TD
+* add symbols in Keysym_Strings[] and table in setup_vtXXX_keymap() for
+  function keys 2-12, to improve keymap-configurability -TD
+* change extra-key #define's in LYStrings.h to enum -TD
+* cleanup pre-2.7 debris from LYStrings.c and LYStrings.h -TD
 * modify tables for edit-bindings to allow them to be reloaded to their initial
   values -TD
 * add check in get_connection() for ftp-connections to ensure that a password
diff --git a/PACKAGE/lynx.nsi b/PACKAGE/lynx.nsi
index c7c0e51b..4aae5a34 100644
--- a/PACKAGE/lynx.nsi
+++ b/PACKAGE/lynx.nsi
@@ -1,4 +1,4 @@
-; $LynxId: lynx.nsi,v 1.5 2013/10/10 09:34:22 tom Exp $

+; $LynxId: lynx.nsi,v 1.8 2013/10/13 21:28:18 tom Exp $

 ; Script originally generated with the Venis Install Wizard, but customized.

 ; The Inno Setup script is preferred; but this can be built via cross-compiling.

 

@@ -9,7 +9,7 @@
 !define VERSION_EPOCH "2"

 !define VERSION_MAJOR "8"

 !define VERSION_MINOR "8"

-!define VERSION_LEVEL "17"

+!define VERSION_LEVEL "1017"

 !define VERSION_PATCH "dev.17"

 

 !define SUBKEY "Lynx"

@@ -27,7 +27,7 @@ CRCCheck on
 SetCompressor /SOLID lzma

 

 VIAddVersionKey ProductName "${SUBKEY}"

-VIAddVersionKey CompanyName "Thomas E. Dickey"

+VIAddVersionKey CompanyName "http://lynx.isc.org"

 VIAddVersionKey LegalCopyright "© 1997-2012,2013, Thomas E. Dickey"

 VIAddVersionKey FileDescription "Lynx Installer (MinGW)"

 VIAddVersionKey FileVersion "${VERSION}"

@@ -36,6 +36,16 @@ VIAddVersionKey Comments "This installer was built with NSIS and cross-compiling
 VIAddVersionKey InternalName "setup-${APPNAME}-${VERSION}.exe"

 VIProductVersion "${VERSION_EPOCH}.${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_LEVEL}"

 

+; adapted from http://nsis.sourceforge.net/Readme_Page_Based_on_MUI_License_Page

+!macro MUI_EXTRAPAGE_README UN TheFile

+   !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)"

+   !insertmacro MUI_${UN}PAGE_LICENSE "${TheFile}"

+!macroend

+!define ReadmeRun "!insertmacro MUI_EXTRAPAGE_README"

+!macro MUI_PAGE_README TheFile

+    ${ReadmeRun} "" "${TheFile}"

+!macroend

+

 ; Modern interface settings

 !include "MUI.nsh"

 

@@ -43,8 +53,8 @@ VIProductVersion "${VERSION_EPOCH}.${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_L
 !define MUI_FINISHPAGE_RUN "$INSTDIR\${EXENAME}"

 

 !insertmacro MUI_PAGE_WELCOME

-; FIXME "..\README"

 !insertmacro MUI_PAGE_LICENSE "..\COPYHEADER"

+!insertmacro MUI_PAGE_README "..\README"

 !insertmacro MUI_PAGE_COMPONENTS

 !insertmacro MUI_PAGE_DIRECTORY

 !insertmacro MUI_PAGE_INSTFILES

diff --git a/README b/README
index 53c49283..2dcb99cd 100644
--- a/README
+++ b/README
@@ -1,4 +1,3 @@
-
                              Lynx README file
 
 Lynx Version 2.8.7 is the latest release (July 2009).
@@ -10,8 +9,11 @@ FOR REAL NOVICES
 To use this package, you need a compiler & a bit of experience
 at very simple programming.  If you just want something which will work
 `out-of-the-box', you can get pre-compiled versions of Lynx
-by following the links from  <URL: http://lynx.isc.org/> ;
-for DOS or Windows, goto <URL: http://www.fdisk.com/doslynx/lynxport.htm>.
+by following the links from
+        <URL: http://lynx.isc.org/> ;
+
+For DOS or Windows, go to
+        <URL: http://www.fdisk.com/doslynx/lynxport.htm>.
 
 WHAT IS LYNX?
 
@@ -22,8 +24,8 @@ WHAT IS LYNX?
    documents containing links to files on the local system, as well as files on
    remote systems running http, gopher, ftp, wais, nntp, finger, or cso/ph/qi
    servers, and services accessible via logins to telnet, tn3270 or rlogin
-   accounts.  Current versions of Lynx run on Unix, VMS, Windows95/NT, 386DOS
-   and OS/2 EMX.
+   accounts.  Current versions of Lynx run on Unix, VMS, Windows95
+   through Windows 8, 386DOS and OS/2 EMX.
 
    Lynx can be used to access information on the WWW, or to establish
    information systems intended primarily for local access.  Lynx has been
@@ -32,11 +34,13 @@ WHAT IS LYNX?
 
 HOW TO GET LYNX
 
-   For the latest release of Lynx goto:
+   For the latest release of Lynx go to:
        <URL: http://lynx.isc.org/release>;
        <URL: ftp://lynx.isc.org/release>;
-   the latest development version is at:
+
+   The latest development version is at:
        <URL: http://lynx.isc.org/current>.
+
    The Lynx homepage is <URL: http://lynx.isc.org/>.
    The on-line help page (enter `h') has links to many useful things.
 
@@ -97,21 +101,20 @@ INSTALLING THE DOCUMENTATION
    place on your system, or into your $HOME directory if you are a single
    user.  Finally, edit the lynx.cfg file  so that the HELPFILE line is
    defined as follows:
-
-      HELPFILE:file://localhost/[public_path]/lynx_help/lynx_help_main.html
+       HELPFILE:file://localhost/[public_path]/lynx_help/lynx_help_main.html
 
    where [public_path] is the absolute path to the lynx_help directory.
    Customizing the help menu system is just a matter of editing a set of
    HTML files.  Additional information about installing and customizing
-   the help file set is available at <URL:http://www.irm.nara.kindai.ac.jp/
-   lynxdev/README.help>.
+   the help file set is available at
+       <URL: http://www.irm.nara.kindai.ac.jp/lynxdev/README.help>.
 
 INSTALLING LYNX
 
    To install Lynx, follow the steps in the INSTALLATION file, which is
    located in the top directory of the source distribution.  Win32 users
    who need pre-compiled distributions should visit the site
-   <URL:http://www.fdisk.com/doslynx/lynxport.htm>.
+       <URL: http://www.fdisk.com/doslynx/lynxport.htm>.
 
 PROBLEMS
 
@@ -124,29 +127,28 @@ PROBLEMS
 LYNX-DEV MAILING LIST
 
    To subscribe to lynx-dev, send email to
-   <URL: mailto:lynx-dev-request@nongnu.org>
+       <URL: mailto:lynx-dev-request@nongnu.org>
    with "subscribe" for a subject line.
 
    If you wish to unsubscribe from lynx-dev, send email to
-   <URL: mailto:lynx-dev-request@nongnu.org> 
+       <URL: mailto:lynx-dev-request@nongnu.org>
    with "unsubscribe" for a subject line.
 
    Any messages you wish to post should be sent to
-   <URL: mailto:lynx-dev@nongnu.org>.
+       <URL: mailto:lynx-dev@nongnu.org>.
+
    PLEASE use the lynx-dev list, NOT private email to the developers,
    for questions or discussion about Lynx, or contributions of patches.
-   Patches should use the unified diff format (diff -u), which can be
-   generated by building the target, "make lynx.patch" after unpacking
-   a pristine copy of the source into a subdirectory called "orig".
+   Patches should use the unified diff format (diff -u).
 
    You need not be subscribed to the lynx-dev list in order to post.  If
    you post without subscribing, though, you should read replies to your
    questions or comments in the archive since more often than not nobody
    will send a carbon copy to you.  View the archives at:
+       "lynx-dev Mailing list archives"
+       <URL: http://mail.gnu.org/mailman/listinfo/lynx-dev/>
 
-                    "lynx-dev Mailing list archives"
-                <URL:http://mail.gnu.org/mailman/listinfo/lynx-dev/>
 ------------------------------------------------------------------------------
 -- vile:txtmode fc=72 noti
--- $LynxId: README,v 1.28 2013/10/09 23:10:22 tom Exp $
+-- $LynxId: README,v 1.29 2013/10/13 17:33:49 tom Exp $
 ------------------------------------------------------------------------------
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index 42514ad3..35680a12 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTCP.c,v 1.126 2013/07/21 00:22:52 tom Exp $
+ * $LynxId: HTTCP.c,v 1.127 2013/10/13 23:42:55 tom Exp $
  *
  *			Generic Communication Code		HTTCP.c
  *			==========================
@@ -1384,8 +1384,6 @@ static int HTParseInet(SockA * soc_in, const char *str)
 
 	    if (!phost)
 		goto failed;
-	    if (!phost)
-		goto failed;
 	    if (phost->h_length != sizeof soc_in->sin_addr) {
 		HTAlwaysAlert(host, gettext("Address length looks invalid"));
 	    }
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 19016457..5176ceb8 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTTP.c,v 1.131 2013/10/02 14:33:32 tom Exp $
+ * $LynxId: HTTP.c,v 1.132 2013/10/13 23:30:26 tom Exp $
  *
  * HyperText Tranfer Protocol	- Client implementation		HTTP.c
  * ==========================
@@ -1285,31 +1285,29 @@ static int HTLoadHTTP(const char *arg,
 
 		host2 = HTParse(docname, "", PARSE_HOST);
 		path2 = HTParse(docname, "", PARSE_PATH | PARSE_PUNCTUATION);
-		if (host2) {
-		    if ((colon = HTParsePort(host2, &port2)) != NULL) {
-			/* Use non-default port number */
-			*colon = '\0';
-		    }
+		if ((colon = HTParsePort(host2, &port2)) != NULL) {
+		    /* Use non-default port number */
+		    *colon = '\0';
 		}
+
 		/*
 		 * This composeAuth() does file access, i.e., for the ultimate
 		 * target of the request.  - AJL
 		 */
 		auth_proxy = NO;
-		if ((auth = HTAA_composeAuth(host2, port2, path2,
-					     auth_proxy)) != NULL &&
-		    *auth != '\0') {
+		auth = HTAA_composeAuth(host2, port2, path2, auth_proxy);
+		if (auth == NULL) {
+		    CTRACE((tfp, "HTTP: Not sending authorization (yet).\n"));
+		} else if (*auth != '\0') {
 		    /*
-		     * If auth is not NULL nor zero-length, it's an
-		     * Authorization header to be included.  - FM
+		     * We have an Authorization header to be included.
 		     */
 		    HTBprintf(&command, "%s%c%c", auth, CR, LF);
 		    CTRACE((tfp, "HTTP: Sending authorization: %s\n", auth));
-		} else if (auth && *auth == '\0') {
+		} else {
 		    /*
-		     * If auth is a zero-length string, the user either
-		     * cancelled or goofed at the username and password prompt.
-		     * - FM
+		     * The user either cancelled or made a mistake with the
+		     * username and password prompt.
 		     */
 		    if (!(traversal || dump_output_immediately) &&
 			HTConfirm(CONFIRM_WO_PASSWORD)) {
@@ -1330,8 +1328,6 @@ static int HTLoadHTTP(const char *arg,
 			status = HT_NOT_LOADED;
 			goto done;
 		    }
-		} else {
-		    CTRACE((tfp, "HTTP: Not sending authorization (yet).\n"));
 		}
 		/*
 		 * Add 'Cookie:' header, if it's HTTP or HTTPS document being
diff --git a/aclocal.m4 b/aclocal.m4
index bc31581a..de88e80c 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-dnl $LynxId: aclocal.m4,v 1.205 2013/10/08 21:47:05 tom Exp $
+dnl $LynxId: aclocal.m4,v 1.206 2013/10/12 20:03:53 tom Exp $
 dnl Macros for auto-configure script.
 dnl by Thomas E. Dickey <dickey@invisible-island.net>
 dnl and Jim Spath <jspath@mail.bcpl.lib.md.us>
@@ -881,7 +881,7 @@ $2])
 done
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12
+dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05
 dnl ------------------
 dnl Append to a search-list for a nonstandard header/lib-file
 dnl	$1 = the variable to return as result
@@ -3237,7 +3237,7 @@ AC_DEFUN([CF_HELP_MESSAGE],
 [AC_DIVERT_HELP([$1])dnl
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_INET_ADDR version: 6 updated: 2012/11/08 20:57:52
+dnl CF_INET_ADDR version: 7 updated: 2013/10/08 17:47:05
 dnl ------------
 dnl For Lynx, check if the libraries we have found give us inet_aton, or
 dnl inet_addr.  If not, try to find the latter function with -lbind or
@@ -3588,7 +3588,7 @@ ifelse($1,,[
 fi
 ])
 dnl ---------------------------------------------------------------------------
-dnl CF_MIXEDCASE_FILENAMES version: 5 updated: 2013/09/07 13:54:05
+dnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05
 dnl ----------------------
 dnl Check if the file-system supports mixed-case filenames.  If we're able to
 dnl create a lowercase name and see it as uppercase, it doesn't support that.
@@ -3978,7 +3978,7 @@ EOF
 test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_NETLIBS version: 9 updated: 2012/11/08 20:57:52
+dnl CF_NETLIBS version: 10 updated: 2013/10/08 17:47:05
 dnl ----------
 dnl After checking for functions in the default $LIBS, make a further check
 dnl for the functions that are netlib-related (these aren't always in the
@@ -6875,6 +6875,8 @@ define([CF__ICONV_HEAD],[
 #include <iconv.h>]
 )dnl
 dnl ---------------------------------------------------------------------------
+dnl CF__INET_HEAD version: 1 updated: 2013/10/08 17:47:05
+dnl -------------
 dnl Header-files needed for inet.h compile-checks
 define([CF__INET_HEAD],[
 #if defined(__MINGW32__)
diff --git a/configure b/configure
index a06d24c6..b745e845 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in 2.8.8dev.16.
+# From configure.in 2.8.8dev.17.
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by Autoconf 2.52.20121002.
 #
@@ -1271,7 +1271,7 @@ rm conftest.sed
 
 PACKAGE=lynx
 # $Format: "VERSION=$ProjectVersion$"$
-VERSION=2.8.8dev.16
+VERSION=2.8.8dev.17
 
 echo "$as_me:1276: checking for DESTDIR" >&5
 echo $ECHO_N "checking for DESTDIR... $ECHO_C" >&6
diff --git a/samples/lynx-keymaps b/samples/lynx-keymaps
index 0a1c3214..2801bb7a 100644
--- a/samples/lynx-keymaps
+++ b/samples/lynx-keymaps
@@ -1,3 +1,5 @@
+# $LynxId: lynx-keymaps,v 1.7 2013/10/13 20:40:00 tom Exp $
+#
 # This is a sample key sequence definition file.  It is used by Lynx when
 # built with ncurses or slang, to augment the definitions from your terminal's
 # termcap or terminfo description.
@@ -34,6 +36,17 @@
 #       HOME
 #       END
 #       F1
+#       F2
+#       F3
+#       F4
+#       F5
+#       F6
+#       F7
+#       F8
+#       F9
+#       F10
+#       F11
+#       F12
 #       DO_KEY
 #       FIND_KEY
 #       SELECT_KEY
diff --git a/src/GridText.c b/src/GridText.c
index b15d2d19..7dce2483 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.269 2013/10/03 12:13:18 tom Exp $
+ * $LynxId: GridText.c,v 1.273 2013/10/13 20:23:07 tom Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -6008,7 +6008,7 @@ static void HText_trimHightext(HText *text,
 
 		StrnAllocCopy(hi_string,
 			      line_ptr2->data,
-			      (actual_len - hilite_len));
+			      (size_t) (actual_len - hilite_len));
 		actual_len -= (int) strlen(hi_string);
 		/*handle LY_SOFT_NEWLINEs -VH */
 		hi_offset += remove_special_attr_chars(hi_string);
@@ -7697,12 +7697,12 @@ int do_www_search(DocInfo *doc)
     QueryNum = QueryTotal;
 
   get_query:
-    if ((ch = LYgetBString(&searchstring, VISIBLE, 0, recall)) < 0 ||
+    if ((ch = LYgetBString(&searchstring, FALSE, 0, recall)) < 0 ||
 	isBEmpty(searchstring) ||
-	ch == UPARROW ||
-	ch == DNARROW) {
+	ch == UPARROW_KEY ||
+	ch == DNARROW_KEY) {
 
-	if (recall && ch == UPARROW) {
+	if (recall && ch == UPARROW_KEY) {
 	    if (PreviousSearch) {
 		/*
 		 * Use the second to last query in the list.  -FM
@@ -7734,7 +7734,7 @@ int do_www_search(DocInfo *doc)
 		}
 		goto get_query;
 	    }
-	} else if (recall && ch == DNARROW) {
+	} else if (recall && ch == DNARROW_KEY) {
 	    if (PreviousSearch) {
 		/*
 		 * Use the first query in the list.  -FM
diff --git a/src/HTAlert.c b/src/HTAlert.c
index 641b36e3..59569d4e 100644
--- a/src/HTAlert.c
+++ b/src/HTAlert.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAlert.c,v 1.99 2013/05/03 08:41:08 tom Exp $
+ * $LynxId: HTAlert.c,v 1.100 2013/10/12 14:52:24 tom Exp $
  *
  *	Displaying messages and getting input for Lynx Browser
  *	==========================================================
@@ -656,7 +656,7 @@ char *HTPrompt(const char *Msg, const char *deflt)
     BStrCopy0(data, deflt ? deflt : "");
 
     if (!dump_output_immediately)
-	(void) LYgetBString(&data, VISIBLE, 0, NORECALL);
+	(void) LYgetBString(&data, FALSE, 0, NORECALL);
 
     StrAllocCopy(rep, data->str);
 
@@ -676,7 +676,7 @@ char *HTPromptPassword(const char *Msg)
     if (!dump_output_immediately) {
 	_statusline(Msg ? Msg : PASSWORD_PROMPT);
 	BStrCopy0(data, "");
-	(void) LYgetBString(&data, HIDDEN, 0, NORECALL);
+	(void) LYgetBString(&data, TRUE, 0, NORECALL);
 	StrAllocCopy(result, data->str);
 	BStrFree(data);
     } else {
diff --git a/src/HTML.c b/src/HTML.c
index f059af99..025d39e8 100644
--- a/src/HTML.c
+++ b/src/HTML.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTML.c,v 1.162 2013/10/02 22:22:06 tom Exp $
+ * $LynxId: HTML.c,v 1.163 2013/10/13 14:24:33 tom Exp $
  *
  *		Structured stream to Rich hypertext converter
  *		============================================
@@ -6385,7 +6385,7 @@ static int HTML_end_element(HTStructured * me, int element_number,
 		    HTChunkPuts(&me->object, "</OBJECT>");
 		    if (!include)	/* error, should not happen */
 			include = &me->xinclude;
-		    StrnAllocCat(*include, me->object.data, me->object.size);
+		    StrnAllocCat(*include, me->object.data, (size_t) me->object.size);
 		    clear_objectdata(me);
 		    /* an internal fake call to keep our stack happy: */
 		    HTML_start_element(me, HTML_OBJECT, NULL, NULL,
diff --git a/src/LYBookmark.c b/src/LYBookmark.c
index 6b79f298..b5425f4c 100644
--- a/src/LYBookmark.c
+++ b/src/LYBookmark.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYBookmark.c,v 1.74 2013/05/02 10:43:29 tom Exp $
+ * $LynxId: LYBookmark.c,v 1.75 2013/10/12 14:51:18 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAlert.h>
@@ -298,7 +298,7 @@ void save_bookmark_link(const char *address,
 	}
 	LYReduceBlanks(string_data->str);
 	LYMBM_statusline(TITLE_PROMPT);
-	LYgetBString(&string_data, VISIBLE, 0, NORECALL);
+	LYgetBString(&string_data, FALSE, 0, NORECALL);
 	if (isBEmpty(string_data)) {
 	    LYMBM_statusline(CANCELLED);
 	    LYSleepMsg();
diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c
index cb455aac..4d240ddf 100644
--- a/src/LYCharUtils.c
+++ b/src/LYCharUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYCharUtils.c,v 1.123 2013/06/04 20:42:47 tom Exp $
+ * $LynxId: LYCharUtils.c,v 1.124 2013/10/13 14:26:51 tom Exp $
  *
  *  Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM
  *  ==========================================================================
@@ -1992,7 +1992,7 @@ void LYParseRefreshURL(char *content,
 	cp1 = cp;
 	while (*cp1 && isdigit(UCH(*cp1)))
 	    cp1++;
-	StrnAllocCopy(Seconds, cp, (int) (cp1 - cp));
+	StrnAllocCopy(Seconds, cp, (size_t) (cp1 - cp));
     }
     *p_seconds = Seconds;
     *p_address = LYParseTagParam(content, "URL");
diff --git a/src/LYDownload.c b/src/LYDownload.c
index 23ce2f66..ffaf24e4 100644
--- a/src/LYDownload.c
+++ b/src/LYDownload.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYDownload.c,v 1.66 2012/02/09 18:55:26 tom Exp $ */
+/* $LynxId: LYDownload.c,v 1.69 2013/10/13 20:23:07 tom Exp $ */
 #include <HTUtils.h>
 #include <HTParse.h>
 #include <HTList.h>
@@ -140,12 +140,12 @@ void LYDownload(char *line)
 	}
 
       check_recall:
-	if ((ch = LYgetBString(&buffer, VISIBLE, 0, recall)) < 0 ||
+	if ((ch = LYgetBString(&buffer, FALSE, 0, recall)) < 0 ||
 	    isBEmpty(buffer) ||
-	    ch == UPARROW ||
-	    ch == DNARROW) {
+	    ch == UPARROW_KEY ||
+	    ch == DNARROW_KEY) {
 
-	    if (recall && ch == UPARROW) {
+	    if (recall && ch == UPARROW_KEY) {
 		if (FirstRecall) {
 		    FirstRecall = FALSE;
 		    /*
@@ -177,7 +177,7 @@ void LYDownload(char *line)
 		    }
 		    goto check_recall;
 		}
-	    } else if (recall && ch == DNARROW) {
+	    } else if (recall && ch == DNARROW_KEY) {
 		if (FirstRecall) {
 		    FirstRecall = FALSE;
 		    /*
@@ -306,12 +306,12 @@ void LYDownload(char *line)
 		}
 
 	      check_again:
-		if ((ch = LYgetBString(&buffer, VISIBLE, 0, recall)) < 0 ||
+		if ((ch = LYgetBString(&buffer, FALSE, 0, recall)) < 0 ||
 		    isBEmpty(buffer) ||
-		    ch == UPARROW ||
-		    ch == DNARROW) {
+		    ch == UPARROW_KEY ||
+		    ch == DNARROW_KEY) {
 
-		    if (recall && ch == UPARROW) {
+		    if (recall && ch == UPARROW_KEY) {
 			if (FirstRecall) {
 			    FirstRecall = FALSE;
 			    /*
@@ -344,7 +344,7 @@ void LYDownload(char *line)
 			    }
 			    goto check_again;
 			}
-		    } else if (recall && ch == DNARROW) {
+		    } else if (recall && ch == DNARROW_KEY) {
 			if (FirstRecall) {
 			    FirstRecall = FALSE;
 			    /*
diff --git a/src/LYEditmap.c b/src/LYEditmap.c
index eadc6aca..e49475ca 100644
--- a/src/LYEditmap.c
+++ b/src/LYEditmap.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYEditmap.c,v 1.42 2013/10/12 00:16:50 tom Exp $
+ * $LynxId: LYEditmap.c,v 1.54 2013/10/13 20:23:07 tom Exp $
  *
  * LYEditMap.c
  * Keybindings for line and form editing.
@@ -41,13 +41,8 @@ static LYEditCode DefaultEditBinding[KEYMAP_SIZE - 1];
 static LYEditCode BetterEditBinding[KEYMAP_SIZE - 1];
 static LYEditCode BashlikeEditBinding[KEYMAP_SIZE - 1];
 
-/* Oh no, not another one of those tables...
- *
- * If modifier bit is set in a lynxkeycode, it is first looked up here.  Note
- * the type different from the previous tables (short vs.  char), since we want
- * to hold larger values.  OTOH we can keep the size shorter, everything beyond
- * the end is effectively LYE_UNMOD (ignore modifier) by virtue of the
- * LKC_TO_LEC_M1 macro.
+/*
+ * If a modifier bit is set in a lynxkeycode, it is first looked up here.
  *
  * Currently this table isn't specific to the current_lineedit value, it is
  * shared by all alternative "Bindings" to save space.  However, if the
@@ -274,13 +269,13 @@ static const LYEditInit initMod1Binding[] =
     {253, LYE_UNMOD},
     {254, LYE_UNMOD},
     {255, LYE_UNMOD},
-    {256, LYE_UNMOD},		/* UPARROW */
-    {257, LYE_UNMOD},		/* DNARROW */
-    {258, LYE_UNMOD},		/* RTARROW */
-    {259, LYE_UNMOD},		/* LTARROW */
-    {260, LYE_UNMOD},		/* PGDOWN */
-    {261, LYE_UNMOD},		/* PGUP */
-    {262, LYE_FORM_PASS},	/* HOME */
+    {256, LYE_UNMOD},		/* UPARROW_KEY */
+    {257, LYE_UNMOD},		/* DNARROW_KEY */
+    {258, LYE_UNMOD},		/* RTARROW_KEY */
+    {259, LYE_UNMOD},		/* LTARROW_KEY */
+    {260, LYE_UNMOD},		/* PGDOWN_KEY */
+    {261, LYE_UNMOD},		/* PGUP_KEY */
+    {262, LYE_FORM_PASS},	/* HOME_KEY */
     {263, LYE_FORM_PASS},	/* END_KEY */
     {264, LYK_DWIMHELP | LYE_FORM_LAC},		/* F1 */
     {265, LYE_UNMOD},		/* DO_KEY */
@@ -565,15 +560,15 @@ static const LYEditInit initDefaultEditor[] =
     {253, LYE_CHAR},
     {254, LYE_CHAR},
     {255, LYE_CHAR},
-    {256, LYE_FORM_PASS},	/* UPARROW */
-    {257, LYE_FORM_PASS},	/* DNARROW */
-    {258, LYE_FORW},		/* RTARROW */
-    {259, LYE_BACK},		/* LTARROW */
-    {260, LYE_FORM_PASS},	/* PGDOWN */
-    {261, LYE_FORM_PASS},	/* PGUP */
-    {262, LYE_BOL},		/* HOME */
+    {256, LYE_FORM_PASS},	/* UPARROW_KEY */
+    {257, LYE_FORM_PASS},	/* DNARROW_KEY */
+    {258, LYE_FORW},		/* RTARROW_KEY */
+    {259, LYE_BACK},		/* LTARROW_KEY */
+    {260, LYE_FORM_PASS},	/* PGDOWN_KEY */
+    {261, LYE_FORM_PASS},	/* PGUP_KEY */
+    {262, LYE_BOL},		/* HOME_KEY */
     {263, LYE_EOL},		/* END_KEY */
-    {264, LYE_FORM_PASS},	/* F1 */
+    {264, LYE_FORM_PASS},	/* F1_KEY */
 #if !(defined(_WINDOWS) || defined(__DJGPP__))
     {265, LYE_TAB},		/* DO_KEY */
     {266, LYE_BOL},		/* FIND_KEY */
@@ -844,15 +839,15 @@ static const LYEditInit initBetterEditor[] =
     {253, LYE_CHAR},
     {254, LYE_CHAR},
     {255, LYE_CHAR},
-    {256, LYE_FORM_PASS},	/* UPARROW */
-    {257, LYE_FORM_PASS},	/* DNARROW */
-    {258, LYE_FORW},		/* RTARROW */
-    {259, LYE_BACK},		/* LTARROW */
-    {260, LYE_FORM_PASS},	/* PGDOWN */
-    {261, LYE_FORM_PASS},	/* PGUP */
-    {262, LYE_BOL},		/* HOME */
+    {256, LYE_FORM_PASS},	/* UPARROW_KEY */
+    {257, LYE_FORM_PASS},	/* DNARROW_KEY */
+    {258, LYE_FORW},		/* RTARROW_KEY */
+    {259, LYE_BACK},		/* LTARROW_KEY */
+    {260, LYE_FORM_PASS},	/* PGDOWN_KEY */
+    {261, LYE_FORM_PASS},	/* PGUP_KEY */
+    {262, LYE_BOL},		/* HOME_KEY */
     {263, LYE_EOL},		/* END_KEY */
-    {264, LYE_FORM_PASS},	/* F1 */
+    {264, LYE_FORM_PASS},	/* F1_KEY */
 #if !(defined(_WINDOWS) || defined(__DJGPP__))
     {265, LYE_TAB},		/* DO_KEY */
     {266, LYE_BOL},		/* FIND_KEY */
@@ -1124,15 +1119,15 @@ static const LYEditInit initBashlikeEditor[] =
     {253, LYE_CHAR},
     {254, LYE_CHAR},
     {255, LYE_CHAR},
-    {256, LYE_FORM_PASS},	/* UPARROW */
-    {257, LYE_FORM_PASS},	/* DNARROW */
-    {258, LYE_FORW},		/* RTARROW */
-    {259, LYE_BACK},		/* LTARROW */
-    {260, LYE_FORM_PASS},	/* PGDOWN */
-    {261, LYE_FORM_PASS},	/* PGUP */
-    {262, LYE_BOL},		/* HOME */
+    {256, LYE_FORM_PASS},	/* UPARROW_KEY */
+    {257, LYE_FORM_PASS},	/* DNARROW_KEY */
+    {258, LYE_FORW},		/* RTARROW_KEY */
+    {259, LYE_BACK},		/* LTARROW_KEY */
+    {260, LYE_FORM_PASS},	/* PGDOWN_KEY */
+    {261, LYE_FORM_PASS},	/* PGUP_KEY */
+    {262, LYE_BOL},		/* HOME_KEY */
     {263, LYE_EOL},		/* END_KEY */
-    {264, LYE_FORM_PASS},	/* F1 */
+    {264, LYE_FORM_PASS},	/* F1_KEY */
 #if !(defined(_WINDOWS) || defined(__DJGPP__))
     {265, LYE_TAB},		/* DO_KEY */
     {266, LYE_BOL},		/* FIND_KEY */
@@ -1157,7 +1152,7 @@ LYEditConfig LYLineEditors[] =
 #endif
 };
 
-const char *LYLineeditNames[TABLESIZE(LYLineEditors) + 1];
+const char *LYEditorNames[TABLESIZE(LYLineEditors) + 1];
 
 /*
  * Add the URL (relative to helpfilepath) used for context-dependent
@@ -1237,46 +1232,45 @@ BOOL LYRemapEditBinding(int xlkc,
     int c = xlkc & LKC_MASK;
     BOOLEAN success = FALSE;
 
-    if (xlkc < 0 || (xlkc & LKC_ISLAC) || c >= KEYMAP_SIZE + 1)
-	return FALSE;
+    if (xlkc >= 0 && !(xlkc & LKC_ISLAC) && (c < KEYMAP_SIZE + 1)) {
+	LYEditCode code = (LYEditCode) lec;
+
 #ifdef USE_ALT_BINDINGS
-    if (xlkc & LKC_MOD1) {
-	if (c > LAST_MOD1_LKC)
-	    return FALSE;
-	else
-	    Mod1Binding[c] = (short) lec;
-	return TRUE;
-    } else if (xlkc & LKC_MOD2) {
-	if (c > LAST_MOD2_LKC)
-	    return FALSE;
-	else
-	    Mod2Binding[c] = (short) lec;
-	return TRUE;
-    } else if (xlkc & LKC_MOD3) {
-	if (c > LAST_MOD3_LKC)
-	    return FALSE;
-	else
-	    Mod3Binding[c] = (short) lec;
-	return TRUE;
-    } else
+	if (xlkc & LKC_MOD1) {
+	    if (c <= LAST_MOD1_LKC) {
+		Mod1Binding[c] = code;
+		success = TRUE;
+	    }
+	} else if (xlkc & LKC_MOD2) {
+	    if (c <= LAST_MOD2_LKC) {
+		Mod2Binding[c] = code;
+		success = TRUE;
+	    }
+	} else if (xlkc & LKC_MOD3) {
+	    if (c <= LAST_MOD3_LKC) {
+		Mod3Binding[c] = code;
+		success = TRUE;
+	    }
+	} else
 #endif /* USE_ALT_BINDINGS */
-    {
+	{
 #ifndef UCHAR_MAX
 #define UCHAR_MAX 255
 #endif
-	if ((unsigned int) lec > UCHAR_MAX)
-	    return FALSE;	/* cannot do, doesn't fit in a char - kw */
-	if (select_edi > 0) {
-	    if ((unsigned int) select_edi < TABLESIZE(LYLineEditors)) {
-		LYLineEditors[select_edi - 1].used[c] = (LYEditCode) lec;
-		success = TRUE;
-	    }
-	} else {
-	    for (j = 0; j < (int) TABLESIZE(LYLineEditors); j++) {
-		success = TRUE;
-		if (select_edi < 0 && j + 1 + select_edi == 0)
-		    continue;
-		LYLineEditors[j].used[c] = (LYEditCode) lec;
+	    if ((unsigned int) lec <= UCHAR_MAX) {
+		if (select_edi > 0) {
+		    if ((unsigned int) select_edi < TABLESIZE(LYLineEditors)) {
+			LYLineEditors[select_edi - 1].used[c] = code;
+			success = TRUE;
+		    }
+		} else {
+		    for (j = 0; j < (int) TABLESIZE(LYLineEditors); j++) {
+			success = TRUE;
+			if ((select_edi < 0) && ((j + 1 + select_edi) == 0))
+			    continue;
+			LYLineEditors[j].used[c] = code;
+		    }
+		}
 	    }
 	}
     }
@@ -1505,7 +1499,11 @@ int LYEditmapDeclared(void)
 }
 
 #if 0
-static void printEditMap(LYEditConfig * table)
+/*
+ * This function was useful in converting the hand-crafted key-bindings to
+ * their reusable form in 2.8.8 -TD
+ */
+static void checkEditMap(LYEditConfig * table)
 {
     unsigned j, k;
     char comment[80];
@@ -1578,66 +1576,13 @@ static void printEditMap(LYEditConfig * table)
 		} else if (j < 127) {
 		    sprintf(comment, "\t/* %c */", j);
 		} else {
-		    const char *what;
+		    const char *what = LYextraKeysToName(j);
 
-		    switch (j) {
-		    case UPARROW:
-			what = "UPARROW";
-			break;
-		    case DNARROW:
-			what = "DNARROW";
-			break;
-		    case RTARROW:
-			what = "RTARROW";
-			break;
-		    case LTARROW:
-			what = "LTARROW";
-			break;
-		    case PGDOWN:
-			what = "PGDOWN";
-			break;
-		    case PGUP:
-			what = "PGUP";
-			break;
-		    case HOME:
-			what = "HOME";
-			break;
-		    case END_KEY:
-			what = "END_KEY";
-			break;
-		    case F1:
-			what = "F1";
-			break;
-		    case DO_KEY:
-			what = "DO_KEY";
-			break;
-		    case FIND_KEY:
-			what = "FIND_KEY";
-			break;
-		    case SELECT_KEY:
-			what = "SELECT_KEY";
-			break;
-		    case INSERT_KEY:
-			what = "INSERT_KEY";
-			break;
-		    case REMOVE_KEY:
-			what = "REMOVE_KEY";
-			break;
-		    case DO_NOTHING:
-			what = "DO_NOTHING";
-			break;
-		    case BACKTAB_KEY:
-			what = "BACKTAB_KEY";
-			break;
-		    case MOUSE_KEY:
-			what = "MOUSE_KEY";
-			break;
-		    default:
-			what = "";
-			break;
-		    }
-		    if (*what) {
-			sprintf(comment, "\t/* %s */", what);
+		    if (Non_Empty(what)) {
+			sprintf(comment, "\t/* %s%s */", what,
+				((strchr(what, '_') != 0)
+				 ? ""
+				 : "_KEY"));
 		    } else {
 			strcpy(comment, "");
 		    }
@@ -1661,7 +1606,7 @@ static void printEditMap(LYEditConfig * table)
 }
 
 #else
-#define printEditMap(table)	/* nothing */
+#define checkEditMap(table)	/* nothing */
 #endif
 
 static void initLineEditor(LYEditConfig * table)
@@ -1673,11 +1618,10 @@ static void initLineEditor(LYEditConfig * table)
     memset(used, 0, sizeof(LYEditCode) * (KEYMAP_SIZE - 1));
     for (k = 0; init[k].code >= 0; ++k) {
 	int code = init[k].code;
-	int edit = init[k].edit;
 
-	used[code] = edit;
+	used[code] = init[k].edit;
     }
-    printEditMap(table);
+    checkEditMap(table);
 }
 
 /*
@@ -1688,7 +1632,7 @@ void LYinitEditmap(void)
     unsigned j;
 
     for (j = 0; j < TABLESIZE(LYLineEditors); ++j) {
-	LYLineeditNames[j] = LYLineEditors[j].name;
+	LYEditorNames[j] = LYLineEditors[j].name;
 	initLineEditor(&LYLineEditors[j]);
     }
     for (j = 0; j < TABLESIZE(LYModifierBindings); ++j) {
diff --git a/src/LYForms.c b/src/LYForms.c
index a21436df..6c9e93e4 100644
--- a/src/LYForms.c
+++ b/src/LYForms.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYForms.c,v 1.104 2013/10/12 00:03:00 tom Exp $ */
+/* $LynxId: LYForms.c,v 1.110 2013/10/13 18:39:48 tom Exp $ */
 #include <HTUtils.h>
 #include <HTCJK.h>
 #include <HTTP.h>
@@ -21,9 +21,9 @@
 #endif
 
 #if defined(VMS) && !defined(USE_SLANG)
-#define CTRL_W_HACK DO_NOTHING
+#define RepaintKey() 12		/* CTRL-L for repaint */
 #else
-#define CTRL_W_HACK 23		/* CTRL-W refresh without clearok */
+#define RepaintKey() ((!enable_scrollback) ? 23 : 12) /* CTRL-W or CTRL-L */
 #endif /* VMS && !USE_SLANG */
 
 static int form_getstr(int cur,
@@ -114,12 +114,7 @@ int change_form_link_ex(int cur,
 				     form->size_l,
 				     FormIsReadonly(form),
 				     FALSE);
-#if CTRL_W_HACK != DO_NOTHING
-	    if (!enable_scrollback)
-		c = CTRL_W_HACK;	/* CTRL-W refresh without clearok */
-	    else
-#endif
-		c = 12;		/* CTRL-L for repaint */
+	    c = RepaintKey();
 	    break;
 	}
 	form->num_value = LYhandlePopupList(form->num_value,
@@ -148,12 +143,7 @@ int change_form_link_ex(int cur,
 	     */
 	    form->value_cs = opt_ptr->value_cs;
 	}
-#if CTRL_W_HACK != DO_NOTHING
-	if (!enable_scrollback)
-	    c = CTRL_W_HACK;	/* CTRL-W refresh without clearok */
-	else
-#endif
-	    c = 12;		/* CTRL-L for repaint */
+	c = RepaintKey();
 	break;
 
     case F_RADIO_TYPE:
@@ -383,7 +373,7 @@ static int form_getstr(int cur,
     BOOL refresh_mb = TRUE;
 #endif
 
-    EditFieldData MyEdit, *edit = &MyEdit;
+    FieldEditor MyEdit, *edit = &MyEdit;
     BOOLEAN Edited = FALSE;	/* Value might be updated? */
 
     /*
@@ -424,26 +414,26 @@ static int form_getstr(int cur,
      * Print panned line
      */
     LYSetupEdit(edit, link_value, form->maxlength, (far_col - startcol));
-    edit->pad = '_';
-    edit->hidden = (BOOL) (form->type == F_PASSWORD_TYPE);
+    edit->efPadChar = '_';
+    edit->efIsMasked = (BOOL) (form->type == F_PASSWORD_TYPE);
     if (use_last_tfpos &&
 	LastTFPos >= 0 &&
-	LastTFPos < (int) edit->buffer_used) {
+	LastTFPos < (int) edit->efBufInUse) {
 #if defined(TEXTFIELDS_MAY_NEED_ACTIVATION) && defined(INACTIVE_INPUT_STYLE_VH)
 	if (redraw_only) {
-	    if (!(edit->buffer_used >= edit->dspwdth &&
-		  LastTFPos >= edit->dspwdth - edit->margin)) {
-		edit->pos = LastTFPos;
-		if (edit->buffer_used >= edit->dspwdth)
+	    if (!(edit->efBufInUse >= edit->efWide &&
+		  LastTFPos >= edit->efWide - edit->efPanMargin)) {
+		edit->efEditAt = LastTFPos;
+		if (edit->efBufInUse >= edit->efWide)
 		    textinput_redrawn = FALSE;
 	    }
 	} else
 #endif /* TEXTFIELDS_MAY_NEED_ACTIVATION && INACTIVE_INPUT_STYLE_VH */
-	    edit->pos = LastTFPos;
+	    edit->efEditAt = LastTFPos;
 #ifdef ENHANCED_LINEEDIT
-	if (edit->pos == 0)
+	if (edit->efEditAt == 0)
 	    /* Do not show the region. */
-	    edit->mark = -(int) (1 + edit->buffer_used);
+	    edit->efEditMark = -(int) (1 + edit->efBufInUse);
 #endif
     }
     /* Try to prepare for setting position based on the last mouse event */
@@ -451,7 +441,7 @@ static int form_getstr(int cur,
     if (!redraw_only) {
 	if (peek_mouse_levent()) {
 	    if (!use_last_tfpos && !textinput_redrawn) {
-		edit->pos = 0;
+		edit->efEditAt = 0;
 	    }
 	}
 	textinput_redrawn = FALSE;
@@ -459,7 +449,7 @@ static int form_getstr(int cur,
 #else
     if (peek_mouse_levent()) {
 	if (!use_last_tfpos)
-	    edit->pos = 0;
+	    edit->efEditAt = 0;
     }
 #endif /* TEXTFIELDS_MAY_NEED_ACTIVATION && INACTIVE_INPUT_STYLE_VH */
     LYRefreshEdit(edit);
@@ -537,7 +527,7 @@ static int form_getstr(int cur,
 		 * within a mouse menu.  Let's at least make sure here that the
 		 * cursor position gets restored.  - kw
 		 */
-		edit->dirty = TRUE;
+		edit->efIsDirty = TRUE;
 	    }
 	} else
 #  endif /* NCURSES || PDCURSES */
@@ -545,8 +535,8 @@ static int form_getstr(int cur,
 
 	{
 	    if (!(ch & LKC_ISLECLAC))
-		ch |= edit->current_modifiers;
-	    edit->current_modifiers = 0;
+		ch |= edit->efInputMods;
+	    edit->efInputMods = 0;
 	    if (last_xlkc != -1) {
 		if (ch == last_xlkc)
 		    ch |= LKC_MOD3;
@@ -568,14 +558,14 @@ static int form_getstr(int cur,
 	    /*
 	     * Set flag for modifier 1.
 	     */
-	    edit->current_modifiers |= LKC_MOD1;
+	    edit->efInputMods |= LKC_MOD1;
 	    continue;
 	}
 	if (action == LYE_SETM2) {
 	    /*
 	     * Set flag for modifier 2.
 	     */
-	    edit->current_modifiers |= LKC_MOD2;
+	    edit->efInputMods |= LKC_MOD2;
 	    continue;
 	}
 	/*
@@ -637,7 +627,7 @@ static int form_getstr(int cur,
 		    StrAllocCopy(buf, (char *) e1 + 1);		/* Survive _release() */
 		get_clip_release();
 		_statusline(ENTER_TEXT_ARROWS_OR_TAB);
-		if (strcmp(link_value, edit->buffer) != 0) {
+		if (strcmp(link_value, edit->efBuffer) != 0) {
 		    Edited = TRUE;
 		}
 		if (buf) {
@@ -678,9 +668,9 @@ static int form_getstr(int cur,
 	    break;
 #else
 #ifdef ENHANCED_LINEEDIT
-	    if (edit->mark >= 0)
+	    if (edit->efEditMark >= 0)
 		/* Disable. */
-		edit->mark = -(int) (1 + edit->buffer_used);
+		edit->efEditMark = -(int) (1 + edit->efBufInUse);
 #endif
 #endif
 	}
@@ -699,12 +689,12 @@ static int form_getstr(int cur,
 	     * Left arrow in column 0 deserves special treatment here, else
 	     * you can get trapped in a form without submit button!
 	     */
-	    if (action == LYE_BACK && edit->pos == 0 && repeat == -1) {
+	    if (action == LYE_BACK && edit->efEditAt == 0 && repeat == -1) {
 		int c = YES;	/* Go back immediately if no changes */
 
 		if (textfield_prompt_at_left_edge) {
 		    c = HTConfirmDefault(PREV_DOC_QUERY, NO);
-		} else if (strcmp(edit->buffer, link_value)) {
+		} else if (strcmp(edit->efBuffer, link_value)) {
 		    c = HTConfirmDefault(PREV_DOC_QUERY, NO);
 		}
 		if (c == YES) {
@@ -753,7 +743,7 @@ static int form_getstr(int cur,
 	    if (repeat < 0)
 		repeat = 1;
 	    while (repeat--) {
-		int rc = LYEdit1(edit, ch, action & ~LYE_DF, TRUE);
+		int rc = LYDoEdit(edit, ch, action & ~LYE_DF, TRUE);
 
 		if (rc < 0) {
 		    ch = -rc;
@@ -794,20 +784,20 @@ static int form_getstr(int cur,
 			refresh_mb = TRUE;
 		} else {
 		    if (!refresh_mb) {
-			LYEdit1(edit, 0, LYE_DELP, TRUE);
+			LYDoEdit(edit, 0, LYE_DELP, TRUE);
 		    }
 		}
 #endif /* SUPPORT_MULTIBYTE_EDIT */
 	    }
 	    _statusline(ENTER_TEXT_ARROWS_OR_TAB);
-	    if (strcmp(link_value, edit->buffer)) {
+	    if (strcmp(link_value, edit->efBuffer)) {
 		Edited = TRUE;
 	    }
 #ifdef SUPPORT_MULTIBYTE_EDIT
 	    if (refresh_mb)
 #endif
 		LYRefreshEdit(edit);
-	    LYSetLastTFPos(edit->pos);
+	    LYSetLastTFPos(edit->efEditAt);
 	}
     }
   breakfor:
@@ -821,7 +811,7 @@ static int form_getstr(int cur,
 	     * The previous value did fit in the line buffer, so replace it
 	     * with the new value.  - FM
 	     */
-	    StrAllocCopy(form->value, edit->buffer);
+	    StrAllocCopy(form->value, edit->efBuffer);
 	} else {
 	    int old_len = (int) strlen(form->value);
 	    int new_len = (int) strlen(link_value);
@@ -830,7 +820,7 @@ static int form_getstr(int cur,
 	     * Combine the modified tail with the unmodified head.  - FM
 	     */
 	    form->value[(old_len > new_len) ? (old_len - new_len) : 0] = '\0';
-	    StrAllocCat(form->value, edit->buffer);
+	    StrAllocCat(form->value, edit->efBuffer);
 	    HTUserMsg(FORM_TAIL_COMBINED_WITH_HEAD);
 	}
 
diff --git a/src/LYGetFile.c b/src/LYGetFile.c
index c979b5f9..3feebcc1 100644
--- a/src/LYGetFile.c
+++ b/src/LYGetFile.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYGetFile.c,v 1.89 2013/05/01 00:21:02 tom Exp $ */
+/* $LynxId: LYGetFile.c,v 1.90 2013/10/12 14:51:18 tom Exp $ */
 #include <HTUtils.h>
 #include <HTTP.h>
 #include <HTAnchor.h>		/* Anchor class */
@@ -1138,7 +1138,7 @@ int follow_link_number(int c,
     /*
      * Get the number, possibly with a letter suffix, from the user.
      */
-    if (LYgetBString(&temp, VISIBLE, sizeof(temp), NORECALL) < 0 ||
+    if (LYgetBString(&temp, FALSE, sizeof(temp), NORECALL) < 0 ||
 	isBEmpty(temp)) {
 	HTInfoMsg(CANCELLED);
 	return (DO_NOTHING);
diff --git a/src/LYIcon.rc b/src/LYIcon.rc
index 9b6054c1..7f243447 100644
--- a/src/LYIcon.rc
+++ b/src/LYIcon.rc
@@ -1 +1,34 @@
+// $LynxId: LYIcon.rc,v 1.3 2013/10/13 23:03:48 tom Exp $
+
+#include <windows.h>
+
 100	ICON	"../samples/lynx.ico"
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION    2,8,8,17
+PRODUCTVERSION 2,8,8,17
+FILEFLAGSMASK  VS_FFI_FILEFLAGSMASK
+FILEFLAGS      0
+FILEOS         VOS_NT_WINDOWS32
+FILETYPE       VFT_APP
+FILESUBTYPE    VFT2_UNKNOWN
+BEGIN
+  BLOCK "StringFileInfo"
+  BEGIN
+    BLOCK "040904B0"
+    BEGIN
+      VALUE "CompanyName",      "http://lynx.isc.org"
+      VALUE "FileDescription",  "Lynx - web browser"
+      VALUE "FileVersion",      "2.8.8.17"
+      VALUE "InternalName",     "Lynx"
+      VALUE "LegalCopyright",   "©1997-2013 Thomas E. Dickey"
+      VALUE "OriginalFilename", "lynx.exe"
+      VALUE "ProductName",      "Lynx - web browser"
+      VALUE "ProductVersion",   "2.8.8.17"
+    END
+  END
+  BLOCK "VarFileInfo"
+  BEGIN
+     VALUE "Translation", 0x409, 1200
+  END
+END
diff --git a/src/LYJump.c b/src/LYJump.c
index 96df697f..70886b8a 100644
--- a/src/LYJump.c
+++ b/src/LYJump.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYJump.c,v 1.45 2013/01/05 00:28:46 tom Exp $
+ * $LynxId: LYJump.c,v 1.48 2013/10/13 20:23:07 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAlert.h>
@@ -234,7 +234,7 @@ char *LYJump(int key)
     }
 
     statusline(jtp->msg);
-    if ((ch = LYgetBString(&buf, VISIBLE, 0, recall)) < 0) {
+    if ((ch = LYgetBString(&buf, FALSE, 0, recall)) < 0) {
 	/*
 	 * User cancelled the Jump via ^G. - FM
 	 */
@@ -248,7 +248,7 @@ char *LYJump(int key)
 	bp++;
     bp = LYSkipBlanks(bp);
     if (*bp == '\0' &&
-	!(recall && (ch == UPARROW || ch == DNARROW))) {
+	!(recall && (ch == UPARROW_KEY || ch == DNARROW_KEY))) {
 	/*
 	 * User cancelled the Jump via a zero-length string. - FM
 	 */
@@ -275,7 +275,7 @@ char *LYJump(int key)
     }
 #endif /* PERMIT_GOTO_FROM_JUMP */
 
-    if (recall && ch == UPARROW) {
+    if (recall && ch == UPARROW_KEY) {
 	if (FirstShortcutRecall) {
 	    /*
 	     * Use last Shortcut in the list. - FM
@@ -305,7 +305,7 @@ char *LYJump(int key)
 	    } else {
 		_statusline(EDIT_A_PREV_SHORTCUT);
 	    }
-	    if ((ch = LYgetBString(&buf, VISIBLE, 0, recall)) < 0) {
+	    if ((ch = LYgetBString(&buf, FALSE, 0, recall)) < 0) {
 		/*
 		 * User cancelled the jump via ^G.
 		 */
@@ -314,7 +314,7 @@ char *LYJump(int key)
 	    }
 	    goto check_recall;
 	}
-    } else if (recall && ch == DNARROW) {
+    } else if (recall && ch == DNARROW_KEY) {
 	if (FirstShortcutRecall) {
 	    /*
 	     * Use the first Shortcut in the list. - FM
@@ -344,7 +344,7 @@ char *LYJump(int key)
 	    } else {
 		_statusline(EDIT_A_PREV_SHORTCUT);
 	    }
-	    if ((ch = LYgetBString(&buf, VISIBLE, 0, recall)) < 0) {
+	    if ((ch = LYgetBString(&buf, FALSE, 0, recall)) < 0) {
 		/*
 		 * User cancelled the jump via ^G.
 		 */
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index 26c7164d..e3e4cd9b 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYKeymap.c,v 1.86 2013/10/12 00:04:22 tom Exp $ */
+/* $LynxId: LYKeymap.c,v 1.95 2013/10/13 20:23:07 tom Exp $ */
 #include <HTUtils.h>
 #include <LYUtils.h>
 #include <LYGlobalDefs.h>
@@ -1003,16 +1003,17 @@ static const struct {
     { ' ',		"<space>" },
     { '<',		"<" },
     { '>',		">" },
+    /* LYExtraKeys */
     { CH_DEL,		"<delete>" },
-    { UPARROW,		"Up Arrow" },
-    { DNARROW,		"Down Arrow" },
-    { RTARROW,		"Right Arrow" },
-    { LTARROW,		"Left Arrow" },
-    { PGDOWN,		"Page Down" },
-    { PGUP,		"Page Up" },
-    { HOME,		"Home" },
+    { UPARROW_KEY,	"Up Arrow" },
+    { DNARROW_KEY,	"Down Arrow" },
+    { RTARROW_KEY,	"Right Arrow" },
+    { LTARROW_KEY,	"Left Arrow" },
+    { PGDOWN_KEY,	"Page Down" },
+    { PGUP_KEY,		"Page Up" },
+    { HOME_KEY,		"Home" },
     { END_KEY,		"End" },
-    { F1,		"F1" },
+    { F1_KEY,		"F1" },
     { DO_KEY,		"Do key" },
     { FIND_KEY,		"Find key" },
     { SELECT_KEY,	"Select key" },
diff --git a/src/LYLocal.c b/src/LYLocal.c
index 78c35e03..4ee4325b 100644
--- a/src/LYLocal.c
+++ b/src/LYLocal.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYLocal.c,v 1.125 2013/05/03 08:43:42 tom Exp $
+ * $LynxId: LYLocal.c,v 1.126 2013/10/12 14:51:18 tom Exp $
  *
  *  Routines to manipulate the local filesystem.
  *  Written by: Rick Mallett, Carleton University
@@ -807,7 +807,7 @@ static int modify_tagged(char *testpath)
     _statusline(gettext("Enter new location for tagged items: "));
 
     BStrCopy0(given_target, "");
-    (void) LYgetBString(&given_target, VISIBLE, 0, NORECALL);
+    (void) LYgetBString(&given_target, FALSE, 0, NORECALL);
     if (!isBEmpty(given_target)) {
 	/*
 	 * Replace ~/ references to the home directory.
@@ -2210,7 +2210,7 @@ static int get_filename(const char *prompt,
 
     _statusline(prompt);
 
-    (void) LYgetBString(&buf, VISIBLE, 0, NORECALL);
+    (void) LYgetBString(&buf, FALSE, 0, NORECALL);
     if (strstr(buf->str, "../") != NULL) {
 	HTAlert(gettext("Illegal filename; request ignored."));
 	return FALSE;
diff --git a/src/LYMail.c b/src/LYMail.c
index 7d4e8e1c..ec86dff5 100644
--- a/src/LYMail.c
+++ b/src/LYMail.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMail.c,v 1.94 2013/05/05 21:41:23 tom Exp $
+ * $LynxId: LYMail.c,v 1.95 2013/10/12 14:51:18 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTParse.h>
@@ -266,7 +266,7 @@ static int header_prompt(const char *label,
 
     LYaddstr(gettext(label));
     LYaddstr(": ");
-    ok = (LYGetStr(buffer, VISIBLE, limit, NORECALL) >= 0
+    ok = (LYGetStr(buffer, FALSE, limit, NORECALL) >= 0
 	  && !term_letter);
     LYaddstr("\n");
 
@@ -698,7 +698,7 @@ void mailform(const char *mailto_address,
 	}
     }
     _statusline(SUBJECT_PROMPT);
-    if (LYGetStr(subject, VISIBLE, MAX_SUBJECT, NORECALL) < 0) {
+    if (LYGetStr(subject, FALSE, MAX_SUBJECT, NORECALL) < 0) {
 	/*
 	 * User cancelled via ^G. - FM
 	 */
@@ -713,7 +713,7 @@ void mailform(const char *mailto_address,
 	sprintf(self, "%.*s", MAX_SUBJECT,
 		isEmpty(personal_mail_address) ? "" : personal_mail_address);
 	_statusline("Cc: ");
-	if (LYGetStr(self, VISIBLE, MAX_SUBJECT, NORECALL) < 0) {
+	if (LYGetStr(self, FALSE, MAX_SUBJECT, NORECALL) < 0) {
 	    /*
 	     * User cancelled via ^G. - FM
 	     */
@@ -1565,7 +1565,7 @@ void reply_by_mail(char *mail_address,
 	LYaddstr("\n\n");
 	LYrefresh();
 	*user_input = '\0';
-	if (LYGetStr(user_input, VISIBLE, sizeof(user_input), NORECALL) < 0 ||
+	if (LYGetStr(user_input, FALSE, sizeof(user_input), NORECALL) < 0 ||
 	    term_letter || STREQ(user_input, ".")) {
 	    goto cancelled;
 	}
@@ -1575,7 +1575,7 @@ void reply_by_mail(char *mail_address,
 	    remove_tildes(user_input);
 	    fprintf(fd, "%s\n", user_input);
 	    *user_input = '\0';
-	    if (LYGetStr(user_input, VISIBLE,
+	    if (LYGetStr(user_input, FALSE,
 			 sizeof(user_input), NORECALL) < 0) {
 		goto cancelled;
 	    }
diff --git a/src/LYMain.c b/src/LYMain.c
index 6d924436..aecdfb48 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMain.c,v 1.245 2013/10/11 10:06:51 tom Exp $
+ * $LynxId: LYMain.c,v 1.246 2013/10/13 20:35:38 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -2884,7 +2884,7 @@ static int nocolor_fun(char *next_arg GCC_UNUSED)
 {
     LYShowColor = SHOW_COLOR_NEVER;
 #ifdef USE_SLANG
-    Lynx_Color_Flags &= ~SL_LYNX_USE_COLOR;
+    Lynx_Color_Flags &= ~(unsigned) SL_LYNX_USE_COLOR;
     Lynx_Color_Flags |= SL_LYNX_OVERRIDE_COLOR;
 #endif
     return 0;
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 280de6cf..011432b7 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMainLoop.c,v 1.219 2013/10/12 00:24:53 tom Exp $
+ * $LynxId: LYMainLoop.c,v 1.224 2013/10/13 20:23:07 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAccess.h>
@@ -750,14 +750,14 @@ static BOOL do_check_recall(int ch,
 	 */
 	LYTrimAllStartfile((*user_input)->str);
 	if (isBEmpty(*user_input) &&
-	    !(recall && (ch == UPARROW || ch == DNARROW))) {
+	    !(recall && (ch == UPARROW_KEY || ch == DNARROW_KEY))) {
 	    BStrCopy0((*user_input), *old_user_input);
 	    FREE(*old_user_input);
 	    HTInfoMsg(CANCELLED);
 	    ret = FALSE;
 	    break;
 	}
-	if (recall && ch == UPARROW) {
+	if (recall && ch == UPARROW_KEY) {
 	    if (*FirstURLRecall) {
 		/*
 		 * Use last URL in the list.  - FM
@@ -788,7 +788,7 @@ static BOOL do_check_recall(int ch,
 		} else {
 		    _statusline(EDIT_A_PREV_GOTO);
 		}
-		if ((ch = LYgetBString(user_input, VISIBLE, 0, recall)) < 0) {
+		if ((ch = LYgetBString(user_input, FALSE, 0, recall)) < 0) {
 		    /*
 		     * User cancelled the Goto via ^G.  Restore
 		     * user_input and break.  - FM
@@ -801,7 +801,7 @@ static BOOL do_check_recall(int ch,
 		}
 		continue;
 	    }
-	} else if (recall && ch == DNARROW) {
+	} else if (recall && ch == DNARROW_KEY) {
 	    if (*FirstURLRecall) {
 		/*
 		 * Use the first URL in the list.  - FM
@@ -830,7 +830,7 @@ static BOOL do_check_recall(int ch,
 		} else {
 		    _statusline(EDIT_A_PREV_GOTO);
 		}
-		if ((ch = LYgetBString(user_input, VISIBLE, 0, recall)) < 0) {
+		if ((ch = LYgetBString(user_input, FALSE, 0, recall)) < 0) {
 		    /*
 		     * User cancelled the Goto via ^G.  Restore
 		     * user_input and break.  - FM
@@ -937,7 +937,7 @@ static int DoTraversal(int c,
 	if (lookup_link(links[curdoc.link].lname)) {
 	    if (more_links ||
 		(curdoc.link > -1 && curdoc.link < nlinks - 1)) {
-		c = DNARROW;
+		c = DNARROW_KEY;
 	    } else {
 		if (STREQ(curdoc.title, "Entry into main screen") ||
 		    (nhist <= 0)) {
@@ -947,7 +947,7 @@ static int DoTraversal(int c,
 		    }
 		    c = -1;
 		} else {
-		    c = LTARROW;
+		    c = LTARROW_KEY;
 		}
 	    }
 	} else {
@@ -955,7 +955,7 @@ static int DoTraversal(int c,
 			 links[curdoc.link].lname);
 	    if (!isLYNXIMGMAP(traversal_link_to_add))
 		*crawl_ok = TRUE;
-	    c = RTARROW;
+	    c = RTARROW_KEY;
 	}
     } else {			/* no good right link, so only down and left arrow ok */
 	if (rlink_exists /* && !rlink_rejected */ )
@@ -963,7 +963,7 @@ static int DoTraversal(int c,
 	    add_to_reject_list(links[curdoc.link].lname);
 	if (more_links ||
 	    (curdoc.link > -1 && curdoc.link < nlinks - 1)) {
-	    c = DNARROW;
+	    c = DNARROW_KEY;
 	} else {
 	    /*
 	     * curdoc.title doesn't always work, so bail out if the history
@@ -977,7 +977,7 @@ static int DoTraversal(int c,
 		}
 		c = -1;
 	    } else {
-		c = LTARROW;
+		c = LTARROW_KEY;
 	    }
 	}
     }
@@ -1806,7 +1806,7 @@ static int handle_LYK_COMMAND(bstring **user_input)
 
     BStrCopy0((*user_input), "");
     _statusline(": ");
-    if (LYgetBString(user_input, VISIBLE, 0, RECALL_CMD) >= 0) {
+    if (LYgetBString(user_input, FALSE, 0, RECALL_CMD) >= 0) {
 	src = LYSkipBlanks((*user_input)->str);
 	tmp = LYSkipNonBlanks(src);
 	*tmp = 0;
@@ -2510,7 +2510,7 @@ static int handle_LYK_ECGOTO(int *ch,
      * Offer the current document's URL for editing.  - FM
      */
     _statusline(EDIT_CURDOC_URL);
-    if (((*ch = LYgetBString(user_input, VISIBLE, 0, RECALL_URL)) >= 0) &&
+    if (((*ch = LYgetBString(user_input, FALSE, 0, RECALL_URL)) >= 0) &&
 	!isBEmpty(*user_input) &&
 	strcmp((*user_input)->str, curdoc.address)) {
 	LYTrimAllStartfile((*user_input)->str);
@@ -2753,7 +2753,7 @@ static int handle_LYK_ELGOTO(int *ch,
      * Offer the current link's URL for editing.  - FM
      */
     _statusline(EDIT_CURLINK_URL);
-    if (((*ch = LYgetBString(user_input, VISIBLE, 0, RECALL_URL)) >= 0) &&
+    if (((*ch = LYgetBString(user_input, FALSE, 0, RECALL_URL)) >= 0) &&
 	!isBEmpty(*user_input) &&
 	strcmp((*user_input)->str,
 	       ((links[curdoc.link].type == WWW_FORM_LINK_TYPE)
@@ -3006,7 +3006,7 @@ static BOOLEAN handle_LYK_GOTO(int *ch,
      * Ask the user.
      */
     _statusline(URL_TO_OPEN);
-    if ((*ch = LYgetBString(user_input, VISIBLE, 0, *recall)) < 0) {
+    if ((*ch = LYgetBString(user_input, FALSE, 0, *recall)) < 0) {
 	/*
 	 * User cancelled the Goto via ^G.  Restore user_input and
 	 * break.  - FM
@@ -3565,7 +3565,7 @@ static BOOLEAN check_JUMP_param(char **url_template)
 	if (encoded)
 	    FREE(encoded);
 
-	if (LYgetBString(&input, VISIBLE, 0, recall) < 0) {
+	if (LYgetBString(&input, FALSE, 0, recall) < 0) {
 	    /*
 	     * cancelled via ^G
 	     */
@@ -3651,7 +3651,7 @@ static BOOLEAN handle_LYK_JUMP(int c,
 		*FirstURLRecall = TRUE;
 		if (!strcasecomp(ret, "Go :")) {
 		    if (recall) {
-			*ch = UPARROW;
+			*ch = UPARROW_KEY;
 			return TRUE;
 		    }
 		    FREE(*old_user_input);
@@ -5247,7 +5247,7 @@ void handle_LYK_CHDIR(void)
     }
 
     _statusline(gettext("cd to:"));
-    if (LYgetBString(&buf, VISIBLE, 0, NORECALL) < 0 || isBEmpty(buf)) {
+    if (LYgetBString(&buf, FALSE, 0, NORECALL) < 0 || isBEmpty(buf)) {
 	HTInfoMsg(CANCELLED);
 	return;
     }
diff --git a/src/LYNews.c b/src/LYNews.c
index f226da4a..8d0a54a6 100644
--- a/src/LYNews.c
+++ b/src/LYNews.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYNews.c,v 1.59 2013/05/04 13:15:30 tom Exp $
+ * $LynxId: LYNews.c,v 1.60 2013/10/12 14:51:18 tom Exp $
  */
 #include <HTUtils.h>
 #ifndef DISABLE_NEWS
@@ -195,7 +195,7 @@ char *LYNewsPost(char *newsgroups,
     LYaddstr(gettext("\n\n Please provide your mail address for the From: header\n"));
     sprintf(user_input, "From: %.*s", (int) sizeof(user_input) - 8,
 	    NonNull(personal_mail_address));
-    if (LYGetStr(user_input, VISIBLE,
+    if (LYGetStr(user_input, FALSE,
 		 sizeof(user_input), NORECALL) < 0 ||
 	term_message) {
 	HTInfoMsg(NEWS_POST_CANCELLED);
@@ -241,7 +241,7 @@ char *LYNewsPost(char *newsgroups,
 	LYStrNCpy(user_input + len, kp, (int) sizeof(user_input) - len - 1);
     }
     cp = NULL;
-    if (LYGetStr(user_input, VISIBLE,
+    if (LYGetStr(user_input, FALSE,
 		 sizeof(user_input), NORECALL) < 0 ||
 	term_message) {
 	HTInfoMsg(NEWS_POST_CANCELLED);
@@ -300,7 +300,7 @@ char *LYNewsPost(char *newsgroups,
     LYStrNCpy(user_input, cp, (sizeof(user_input) - 16));
     FREE(cp);
     LYaddstr(gettext("\n\n Please provide or edit the Organization: header\n"));
-    if (LYGetStr(user_input, VISIBLE,
+    if (LYGetStr(user_input, FALSE,
 		 sizeof(user_input), NORECALL) < 0 ||
 	term_message) {
 	HTInfoMsg(NEWS_POST_CANCELLED);
@@ -362,7 +362,7 @@ char *LYNewsPost(char *newsgroups,
 	LYaddstr("\n\n");
 	LYrefresh();
 	*user_input = '\0';
-	if (LYGetStr(user_input, VISIBLE,
+	if (LYGetStr(user_input, FALSE,
 		     sizeof(user_input), NORECALL) < 0 ||
 	    term_message) {
 	    HTInfoMsg(NEWS_POST_CANCELLED);
@@ -376,7 +376,7 @@ char *LYNewsPost(char *newsgroups,
 	    if (!nonempty && strlen(user_input))
 		nonempty = TRUE;
 	    *user_input = '\0';
-	    if (LYGetStr(user_input, VISIBLE,
+	    if (LYGetStr(user_input, FALSE,
 			 sizeof(user_input), NORECALL) < 0) {
 		HTInfoMsg(NEWS_POST_CANCELLED);
 		LYCloseTempFP(fd);	/* Close the temp file. */
diff --git a/src/LYOptions.c b/src/LYOptions.c
index 8f9cda57..2b0e81f8 100644
--- a/src/LYOptions.c
+++ b/src/LYOptions.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYOptions.c,v 1.155 2013/10/10 23:29:51 tom Exp $ */
+/* $LynxId: LYOptions.c,v 1.157 2013/10/12 14:51:18 tom Exp $ */
 #include <HTUtils.h>
 #include <HTFTP.h>
 #include <HTTP.h>		/* 'reloading' flag */
@@ -548,7 +548,7 @@ void LYoptions(void)
 
     LYmove(L_Lineed, 5);
     addlbl("li(N)e edit style            : ");
-    LYaddstr(LYLineeditNames[current_lineedit]);
+    LYaddstr(LYEditorNames[current_lineedit]);
 
 #ifdef EXP_KEYBOARD_LAYOUT
     LYmove(L_Layout, 5);
@@ -651,7 +651,7 @@ void LYoptions(void)
 		_statusline(ACCEPT_DATA);
 		LYmove(L_EDITOR, COL_OPTION_VALUES);
 		lynx_start_bold();
-		ch = LYgetBString(&my_data, VISIBLE, 0, NORECALL);
+		ch = LYgetBString(&my_data, FALSE, 0, NORECALL);
 		lynx_stop_bold();
 		LYmove(L_EDITOR, COL_OPTION_VALUES);
 		if (term_options || ch == -1) {
@@ -686,7 +686,7 @@ void LYoptions(void)
 	    _statusline(ACCEPT_DATA);
 	    LYmove(L_DISPLAY, COL_OPTION_VALUES);
 	    lynx_start_bold();
-	    ch = LYgetBString(&my_data, VISIBLE, 0, NORECALL);
+	    ch = LYgetBString(&my_data, FALSE, 0, NORECALL);
 	    lynx_stop_bold();
 	    LYmove(L_DISPLAY, COL_OPTION_VALUES);
 
@@ -801,7 +801,7 @@ void LYoptions(void)
 		_statusline(ACCEPT_DATA);
 		LYmove(L_HOME, C_DEFAULT);
 		lynx_start_bold();
-		ch = LYgetBString(&my_data, VISIBLE, 0, NORECALL);
+		ch = LYgetBString(&my_data, FALSE, 0, NORECALL);
 		lynx_stop_bold();
 		LYmove(L_HOME, C_DEFAULT);
 		BStrAlloc(my_data, my_data->len + LY_MAXPATH);	/* lengthen */
@@ -867,7 +867,7 @@ void LYoptions(void)
 	    _statusline(ACCEPT_DATA);
 	    LYmove(L_MAIL_ADDRESS, COL_OPTION_VALUES);
 	    lynx_start_bold();
-	    ch = LYgetBString(&my_data, VISIBLE, 0, NORECALL);
+	    ch = LYgetBString(&my_data, FALSE, 0, NORECALL);
 	    lynx_stop_bold();
 	    LYmove(L_MAIL_ADDRESS, COL_OPTION_VALUES);
 	    if (term_options || ch == -1) {
@@ -1080,7 +1080,7 @@ void LYoptions(void)
 	    _statusline(ACCEPT_DATA);
 	    LYmove(L_LANGUAGE, COL_OPTION_VALUES);
 	    lynx_start_bold();
-	    ch = LYgetBString(&my_data, VISIBLE, 0, NORECALL);
+	    ch = LYgetBString(&my_data, FALSE, 0, NORECALL);
 	    lynx_stop_bold();
 	    LYmove(L_LANGUAGE, COL_OPTION_VALUES);
 	    if (term_options || ch == -1) {
@@ -1114,7 +1114,7 @@ void LYoptions(void)
 	    _statusline(ACCEPT_DATA);
 	    LYmove(L_PREF_CHARSET, COL_OPTION_VALUES);
 	    lynx_start_bold();
-	    ch = LYgetBString(&my_data, VISIBLE, 0, NORECALL);
+	    ch = LYgetBString(&my_data, FALSE, 0, NORECALL);
 	    lynx_stop_bold();
 	    LYmove(L_PREF_CHARSET, COL_OPTION_VALUES);
 	    if (term_options || ch == -1) {
@@ -1321,16 +1321,16 @@ void LYoptions(void)
 	    if (!LYSelectPopups) {
 		current_lineedit = LYChooseEnum(current_lineedit,
 						L_Lineed, -1,
-						LYLineeditNames);
+						LYEditorNames);
 	    } else {
 		current_lineedit = LYChoosePopup(current_lineedit,
 						 L_Lineed, -1,
-						 LYLineeditNames,
+						 LYEditorNames,
 						 0, FALSE, FALSE);
 #if defined(VMS) || defined(USE_SLANG)
 		LYmove(L_Lineed, COL_OPTION_VALUES);
 		LYclrtoeol();
-		LYaddstr(LYLineeditNames[current_lineedit]);
+		LYaddstr(LYEditorNames[current_lineedit]);
 #endif /* VMS || USE_SLANG */
 	    }
 	    response = ' ';
@@ -1445,7 +1445,7 @@ void LYoptions(void)
 		_statusline(ACCEPT_DATA_OR_DEFAULT);
 		LYmove(L_User_Agent, COL_OPTION_VALUES);
 		lynx_start_bold();
-		ch = LYgetBString(&my_data, VISIBLE, 0, NORECALL);
+		ch = LYgetBString(&my_data, FALSE, 0, NORECALL);
 		lynx_stop_bold();
 		LYmove(L_User_Agent, COL_OPTION_VALUES);
 		if (term_options || ch == -1) {
@@ -1969,7 +1969,7 @@ void edit_bookmarks(void)
 		    BStrCopy0(my_data,
 			      (!MBM_A_subdescript[a] ?
 			       "" : MBM_A_subdescript[a]));
-		    (void) LYgetBString(&my_data, VISIBLE, 0, NORECALL);
+		    (void) LYgetBString(&my_data, FALSE, 0, NORECALL);
 		    lynx_stop_bold();
 
 		    if (isBEmpty(my_data)) {
@@ -2003,7 +2003,7 @@ void edit_bookmarks(void)
 
 		lynx_start_bold();
 		BStrCopy0(my_data, NonNull(MBM_A_subbookmark[a]));
-		(void) LYgetBString(&my_data, VISIBLE, 0, NORECALL);
+		(void) LYgetBString(&my_data, FALSE, 0, NORECALL);
 		lynx_stop_bold();
 
 		if (isBEmpty(my_data)) {
@@ -2820,7 +2820,7 @@ int postoptions(DocInfo *newdoc)
 	    int j;
 
 	    /* prevent spoofing attempt */
-	    for (j = 0; LYLineeditNames[j]; j++) {
+	    for (j = 0; LYEditorNames[j]; j++) {
 		if (j == newval)
 		    current_lineedit = newval;
 	    }
@@ -3660,14 +3660,14 @@ static int gen_options(char **newfile)
     EndSelect(fp0);
 
     /* Line edit style: SELECT */
-    if (LYLineeditNames[1]) {	/* well, at least 2 line edit styles available */
+    if (LYEditorNames[1]) {	/* well, at least 2 line edit styles available */
 	PutLabel(fp0, gettext("Line edit style"), lineedit_mode_string);
 	BeginSelect(fp0, lineedit_mode_string);
-	for (i = 0; LYLineeditNames[i]; i++) {
+	for (i = 0; LYEditorNames[i]; i++) {
 	    char temp[16];
 
 	    sprintf(temp, "%d", i);
-	    PutOption(fp0, i == current_lineedit, temp, LYLineeditNames[i]);
+	    PutOption(fp0, i == current_lineedit, temp, LYEditorNames[i]);
 	}
 	EndSelect(fp0);
     }
diff --git a/src/LYPrint.c b/src/LYPrint.c
index b4020815..f5543ffe 100644
--- a/src/LYPrint.c
+++ b/src/LYPrint.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYPrint.c,v 1.98 2013/05/04 13:15:47 tom Exp $
+ * $LynxId: LYPrint.c,v 1.101 2013/10/13 20:23:07 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAccess.h>
@@ -180,9 +180,9 @@ static int RecallFilename(bstring **filename,
     }
     recall = ((*total >= 1) ? RECALL_URL : NORECALL);
 
-    if ((ch = LYgetBString(filename, VISIBLE, 0, recall)) < 0 ||
-	*filename == '\0' || ch == UPARROW || ch == DNARROW) {
-	if (recall && ch == UPARROW) {
+    if ((ch = LYgetBString(filename, FALSE, 0, recall)) < 0 ||
+	*filename == '\0' || ch == UPARROW_KEY || ch == DNARROW_KEY) {
+	if (recall && ch == UPARROW_KEY) {
 	    if (*first) {
 		*first = FALSE;
 		/*
@@ -214,7 +214,7 @@ static int RecallFilename(bstring **filename,
 		}
 		return FN_READ;
 	    }
-	} else if (recall && ch == DNARROW) {
+	} else if (recall && ch == DNARROW_KEY) {
 	    if (*first) {
 		*first = FALSE;
 		/*
@@ -504,7 +504,7 @@ static void send_file_to_mail(DocInfo *newdoc,
 
     _statusline(MAIL_ADDRESS_PROMPT);
     BStrCopy0(user_response, NonNull(personal_mail_address));
-    if (LYgetBString(&user_response, VISIBLE, 0, RECALL_MAIL) < 0 ||
+    if (LYgetBString(&user_response, FALSE, 0, RECALL_MAIL) < 0 ||
 	isBEmpty(user_response)) {
 	CancelPrint(MAIL_REQUEST_CANCELLED);
     }
@@ -969,7 +969,7 @@ static void send_file_to_screen(DocInfo *newdoc,
     }
 
     BStrCopy0(prompt, "");
-    if (LYgetBString(&prompt, VISIBLE, 0, NORECALL) < 0) {
+    if (LYgetBString(&prompt, FALSE, 0, NORECALL) < 0) {
 	CancelPrint(PRINT_REQUEST_CANCELLED);
     } else {
 	outfile_fp = stdout;
diff --git a/src/LYSearch.c b/src/LYSearch.c
index f989bf31..a56de21b 100644
--- a/src/LYSearch.c
+++ b/src/LYSearch.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYSearch.c,v 1.37 2013/10/03 12:27:55 tom Exp $
+ * $LynxId: LYSearch.c,v 1.40 2013/10/13 20:23:07 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAlert.h>
@@ -197,7 +197,7 @@ BOOL textsearch(DocInfo *cur_doc,
 	 */
 	_statusline(ENTER_WHEREIS_QUERY);
 
-	ch = LYgetBString(prev_target, VISIBLE, 0, recall);
+	ch = LYgetBString(prev_target, FALSE, 0, recall);
 	if (ch < 0) {
 	    /*
 	     * User cancelled the search via ^G.  Restore prev_target and
@@ -211,7 +211,7 @@ BOOL textsearch(DocInfo *cur_doc,
 
   check_recall:
     if (strlen((*prev_target)->str) == 0 &&
-	!(recall && (ch == UPARROW || ch == DNARROW))) {
+	!(recall && (ch == UPARROW_KEY || ch == DNARROW_KEY))) {
 	/*
 	 * No entry.  Simply return, retaining the current buffer.  Because
 	 * prev_target is now reset, highlighting of the previous search string
@@ -222,7 +222,7 @@ BOOL textsearch(DocInfo *cur_doc,
 	return (FALSE);
     }
 
-    if (recall && ch == UPARROW) {
+    if (recall && ch == UPARROW_KEY) {
 	if (FirstRecall) {
 	    /*
 	     * Use the current string or last query in the list.  - FM
@@ -262,7 +262,7 @@ BOOL textsearch(DocInfo *cur_doc,
 	    } else {
 		_statusline(EDIT_A_PREV_QUERY);
 	    }
-	    ch = LYgetBString(prev_target, VISIBLE, 0, recall);
+	    ch = LYgetBString(prev_target, FALSE, 0, recall);
 	    if (ch < 0) {
 		/*
 		 * User canceled the search via ^G.  Restore prev_target and
@@ -274,7 +274,7 @@ BOOL textsearch(DocInfo *cur_doc,
 	    }
 	    goto check_recall;
 	}
-    } else if (recall && ch == DNARROW) {
+    } else if (recall && ch == DNARROW_KEY) {
 	if (FirstRecall) {
 	    /*
 	     * Use the current string or first query in the list.  - FM
@@ -314,7 +314,7 @@ BOOL textsearch(DocInfo *cur_doc,
 	    } else {
 		_statusline(EDIT_A_PREV_QUERY);
 	    }
-	    ch = LYgetBString(prev_target, VISIBLE, 0, recall);
+	    ch = LYgetBString(prev_target, FALSE, 0, recall);
 	    if (ch < 0) {
 		/*
 		 * User cancelled the search via ^G.  Restore prev_target and
diff --git a/src/LYStrings.c b/src/LYStrings.c
index ac5405c3..66acf897 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYStrings.c,v 1.215 2013/10/02 23:58:20 tom Exp $ */
+/* $LynxId: LYStrings.c,v 1.253 2013/10/13 20:47:25 tom Exp $ */
 #include <HTUtils.h>
 #include <HTCJK.h>
 #include <UCAux.h>
@@ -54,6 +54,12 @@
 #define CTRACE_EDIT(p)		/*nothing */
 #endif
 
+#ifdef SUPPORT_MULTIBYTE_EDIT
+#define IsWordChar(c) (isalnum(UCH(c)) || is8bits(c))
+#else
+#define IsWordChar(c) isalnum(UCH(c))
+#endif
+
 /*
  * The edit_history lists allow the user to press tab when entering URL to get
  * the closest match in the closet
@@ -406,7 +412,7 @@ static int set_clicked_link(int x,
 	else if (clicks > 1) {
 	    if (x < left + toolbar)
 		c = (code == FOR_PROMPT && y)
-		    ? HOME : LAC_TO_LKC0(LYK_MAIN_MENU);
+		    ? HOME_KEY : LAC_TO_LKC0(LYK_MAIN_MENU);
 	    else if (x > right)
 		c = (code == FOR_PROMPT && y)
 		    ? END_KEY : LAC_TO_LKC0(LYK_VLINKS);
@@ -417,7 +423,7 @@ static int set_clicked_link(int x,
 	} else {
 	    if (x < left + toolbar)
 		c = (code == FOR_PROMPT && y)
-		    ? LTARROW
+		    ? LTARROW_KEY
 		    : (
 #ifdef USE_COLOR_STYLE
 			  (s_forw_backw != NOSTYLE && x - toolbar >= 3)
@@ -429,7 +435,7 @@ static int set_clicked_link(int x,
 		    );
 	    else if (x > right)
 		c = (code == FOR_PROMPT && y)
-		    ? RTARROW : LAC_TO_LKC0(LYK_HISTORY);
+		    ? RTARROW_KEY : LAC_TO_LKC0(LYK_HISTORY);
 	    else if (y)		/* Last row */
 		c = LAC_TO_LKC0(LYK_NEXT_PAGE);
 	    else		/* First row */
@@ -569,28 +575,28 @@ static int set_clicked_link(int x,
 #endif /* USE_MOUSE */
 
 /*
- * LYstrncpy() terminates strings with a null byte.  Writes a null byte into
- * the n+1 byte of dst.
+ * LYstrncpy() ensures that the copied strings end with a nul byte.
+ * The nul is written to the n+1 position of the target.
  */
-char *LYstrncpy(char *dst,
-		const char *src,
+char *LYstrncpy(char *target,
+		const char *source,
 		int n)
 {
-    char *val = dst;
+    char *val = target;
     int len;
 
-    if (src == 0)
-	src = "";
-    len = (int) strlen(src);
+    if (source == 0)
+	source = "";
+    len = (int) strlen(source);
 
     if (n > 0) {
 	if (n > len)
 	    n = len;
-	(void) StrNCpy(dst, src, n);
+	(void) StrNCpy(target, source, n);
     } else {
 	n = 0;
     }
-    dst[n] = '\0';
+    target[n] = '\0';
     return val;
 }
 
@@ -599,17 +605,17 @@ char *LYstrncpy(char *dst,
 
 /*
  * LYmbcsstrncpy() terminates strings with a null byte.  It takes account of
- * multibyte characters.  The src string is copied until either end of string
+ * multibyte characters.  The source string is copied until either end of string
  * or max number of either bytes or glyphs (mbcs sequences) (CJK or UTF8).  The
  * utf_flag argument should be TRUE for UTF8.  - KW & FM
  */
-char *LYmbcsstrncpy(char *dst,
-		    const char *src,
+char *LYmbcsstrncpy(char *target,
+		    const char *source,
 		    int n_bytes,
 		    int n_glyphs,
 		    int utf_flag)
 {
-    char *val = dst;
+    char *val = target;
     int i_bytes = 0, i_glyphs = 0;
 
     if (n_bytes < 0)
@@ -617,16 +623,16 @@ char *LYmbcsstrncpy(char *dst,
     if (n_glyphs < 0)
 	n_glyphs = 0;
 
-    for (; *src != '\0' && i_bytes < n_bytes; i_bytes++) {
-	if (IS_NEW_GLYPH(*src)) {
+    for (; *source != '\0' && i_bytes < n_bytes; i_bytes++) {
+	if (IS_NEW_GLYPH(*source)) {
 	    if (i_glyphs++ >= n_glyphs) {
-		*dst = '\0';
+		*target = '\0';
 		return val;
 	    }
 	}
-	*(dst++) = *(src++);
+	*(target++) = *(source++);
     }
-    *dst = '\0';
+    *target = '\0';
 
     return val;
 }
@@ -900,8 +906,8 @@ void ena_csi(int flag)
 			    (unsigned) code, \
 			    Keymap_List)
 #if SLANG_VERSION < 20000
-#define expand_substring(dst, first, last, final) \
- 	(SLexpand_escaped_string(dst, \
+#define expand_substring(target, first, last, final) \
+ 	(SLexpand_escaped_string(target, \
 				 (char *)first, \
 				 (char *)last), 1)
 static int SLang_get_error(void)
@@ -911,8 +917,8 @@ static int SLang_get_error(void)
 #else
 int LY_Slang_UTF8_Mode = 0;
 
-#define expand_substring(dst, first, last, final) \
-	(SLexpand_escaped_string(dst, \
+#define expand_substring(target, first, last, final) \
+	(SLexpand_escaped_string(target, \
 				 (char *)first, \
 				 (char *)last, \
 				 LY_Slang_UTF8_Mode), 1)
@@ -934,28 +940,40 @@ static SLKeyMap_List_Type *Keymap_List;
 # else
 #  define EXTERN_KEY(string,string1,lynx,curses) {string,lynx},{string1,lynx}
 # endif
-# define INTERN_KEY(string,lynx,curses)          {string,lynx}
+# define INTERN_KEY(string,lynx,curses)          {string,lynx,lynx}
 #else
-#define INTERN_KEY(string,lynx,curses)           {string,curses}
-#define EXTERN_KEY(string,string1,lynx,curses)   {string,curses}
+# define INTERN_KEY(string,lynx,curses)          {string,curses,lynx}
+# define EXTERN_KEY(string,string1,lynx,curses)  {string,curses,lynx}
 #endif
 
 typedef struct {
     const char *string;
     int value;
+    LYExtraKeys internal;
 } Keysym_String_List;
 /* *INDENT-OFF* */
 static Keysym_String_List Keysym_Strings [] =
 {
-    INTERN_KEY( "UPARROW",	UPARROW,	KEY_UP ),
-    INTERN_KEY( "DNARROW",	DNARROW,	KEY_DOWN ),
-    INTERN_KEY( "RTARROW",	RTARROW,	KEY_RIGHT ),
-    INTERN_KEY( "LTARROW",	LTARROW,	KEY_LEFT ),
-    INTERN_KEY( "PGDOWN",	PGDOWN,		KEY_NPAGE ),
-    INTERN_KEY( "PGUP",		PGUP,		KEY_PPAGE ),
-    INTERN_KEY( "HOME",		HOME,		KEY_HOME ),
+    INTERN_KEY( "UPARROW",	UPARROW_KEY,	KEY_UP ),
+    INTERN_KEY( "DNARROW",	DNARROW_KEY,	KEY_DOWN ),
+    INTERN_KEY( "RTARROW",	RTARROW_KEY,	KEY_RIGHT ),
+    INTERN_KEY( "LTARROW",	LTARROW_KEY,	KEY_LEFT ),
+    INTERN_KEY( "PGDOWN",	PGDOWN_KEY,	KEY_NPAGE ),
+    INTERN_KEY( "PGUP",		PGUP_KEY,	KEY_PPAGE ),
+    INTERN_KEY( "HOME",		HOME_KEY,	KEY_HOME ),
     INTERN_KEY( "END",		END_KEY,	KEY_END ),
-    INTERN_KEY( "F1",		F1,		KEY_F(1) ),
+    INTERN_KEY( "F1",		F1_KEY,		KEY_F(1) ),
+    INTERN_KEY( "F2",		F2_KEY,		KEY_F(2) ),
+    INTERN_KEY( "F3",		F3_KEY,		KEY_F(3) ),
+    INTERN_KEY( "F4",		F4_KEY,		KEY_F(4) ),
+    INTERN_KEY( "F5",		F5_KEY,		KEY_F(5) ),
+    INTERN_KEY( "F6",		F6_KEY,		KEY_F(7) ),
+    INTERN_KEY( "F7",		F7_KEY,		KEY_F(7) ),
+    INTERN_KEY( "F8",		F8_KEY,		KEY_F(8) ),
+    INTERN_KEY( "F9",		F9_KEY,		KEY_F(9) ),
+    INTERN_KEY( "F10",		F10_KEY,	KEY_F(10) ),
+    INTERN_KEY( "F11",		F11_KEY,	KEY_F(11) ),
+    INTERN_KEY( "F12",		F12_KEY,	KEY_F(12) ),
     INTERN_KEY( "DO_KEY",	DO_KEY,		KEY_F(16) ),
     INTERN_KEY( "FIND_KEY",	FIND_KEY,	KEY_FIND ),
     INTERN_KEY( "SELECT_KEY",	SELECT_KEY,	KEY_SELECT ),
@@ -1070,7 +1088,7 @@ static const char *expand_tichar(const char *first, char **result, char *final)
     return first;
 }
 
-static BOOLEAN expand_substring(char *dst,
+static BOOLEAN expand_substring(char *target,
 				const char *first,
 				const char *last,
 				char *final)
@@ -1080,27 +1098,27 @@ static BOOLEAN expand_substring(char *dst,
     while (first < last) {
 	switch (ch = *first++) {
 	case ESCAPE:
-	    first = expand_tichar(first, &dst, final);
+	    first = expand_tichar(first, &target, final);
 	    break;
 	case '^':
 	    ch = *first++;
 	    if (ch == LPAREN) {
 		const char *s = strchr(first, RPAREN);
-		char *was = dst;
+		char *was = target;
 
 		if (s == 0)
 		    s = first + strlen(first);
-		first = expand_tiname(first, (size_t) (s - first), &dst, final);
-		if (dst == was)
+		first = expand_tiname(first, (size_t) (s - first), &target, final);
+		if (target == was)
 		    return FALSE;
 		if (*first)
 		    first++;
 	    } else if (ch == '?') {	/* ASCII delete? */
-		*dst++ = 127;
+		*target++ = 127;
 	    } else if ((ch & 0x3f) < 0x20) {	/* ASCII control char? */
-		*dst++ = (char) (ch & 0x1f);
+		*target++ = (char) (ch & 0x1f);
 	    } else {
-		*dst++ = '^';
+		*target++ = '^';
 		first--;	/* not legal... */
 	    }
 	    break;
@@ -1108,11 +1126,11 @@ static BOOLEAN expand_substring(char *dst,
 	    ch = 0200;
 	    /* FALLTHRU */
 	default:
-	    *dst++ = (char) ch;
+	    *target++ = (char) ch;
 	    break;
 	}
     }
-    *dst = '\0';
+    *target = '\0';
     return TRUE;
 }
 #endif
@@ -1132,27 +1150,43 @@ static void unescaped_char(const char *parse, int *keysym)
     }
 }
 
-static BOOLEAN unescape_string(char *src, char *dst, char *final)
+static BOOLEAN unescape_string(char *source, char *target, char *final)
 {
     BOOLEAN ok = FALSE;
 
-    if (*src == SQUOTE) {
+    if (*source == SQUOTE) {
 	int keysym = -1;
 
-	unescaped_char(src, &keysym);
+	unescaped_char(source, &keysym);
 	if (keysym >= 0) {
-	    dst[0] = (char) keysym;
-	    dst[1] = '\0';
+	    target[0] = (char) keysym;
+	    target[1] = '\0';
 	    ok = TRUE;
 	}
-    } else if (*src == DQUOTE) {
-	if (expand_substring(dst, src + 1, src + strlen(src) - 1, final))
+    } else if (*source == DQUOTE) {
+	if (expand_substring(target, source + 1, source + strlen(source) - 1, final))
 	    ok = TRUE;
 	(void) final;
     }
     return ok;
 }
 
+static Keysym_String_List *lookupKeysymByName(const char *name)
+{
+    Keysym_String_List *k;
+    Keysym_String_List *result = 0;
+
+    k = Keysym_Strings;
+    while (k->string != NULL) {
+	if (0 == strcasecomp(k->string, name)) {
+	    result = k;
+	    break;
+	}
+	k++;
+    }
+    return result;
+}
+
 int map_string_to_keysym(const char *str, int *keysym)
 {
     int modifier = 0;
@@ -1223,15 +1257,10 @@ int map_string_to_keysym(const char *str, int *keysym)
 #endif
 	}
     } else {
-	Keysym_String_List *k;
+	Keysym_String_List *k = lookupKeysymByName(str);
 
-	k = Keysym_Strings;
-	while (k->string != NULL) {
-	    if (0 == strcmp(k->string, str)) {
-		*keysym = k->value;
-		break;
-	    }
-	    k++;
+	if (k != 0) {
+	    *keysym = k->value;
 	}
     }
 
@@ -1240,6 +1269,32 @@ int map_string_to_keysym(const char *str, int *keysym)
     return (*keysym);
 }
 
+LYExtraKeys LYnameToExtraKeys(const char *name)
+{
+    Keysym_String_List *k = lookupKeysymByName(name);
+    LYExtraKeys result = -1;
+
+    if (k != 0)
+	result = k->internal;
+    return result;
+}
+
+const char *LYextraKeysToName(LYExtraKeys code)
+{
+    Keysym_String_List *k;
+    const char *result = 0;
+
+    k = Keysym_Strings;
+    while (k->string != NULL) {
+	if (k->internal == code) {
+	    result = k->string;
+	    break;
+	}
+	k++;
+    }
+    return result;
+}
+
 /*
  * Starting at a nonblank character, skip over a token, counting quoted and
  * escaped characters.
@@ -1404,55 +1459,68 @@ static void setup_vtXXX_keymap(void)
 {
     /* *INDENT-OFF* */
     static Keysym_String_List table[] = {
-	INTERN_KEY( "\033[A",	UPARROW,	KEY_UP ),
-	INTERN_KEY( "\033OA",	UPARROW,	KEY_UP ),
-	INTERN_KEY( "\033[B",	DNARROW,	KEY_DOWN ),
-	INTERN_KEY( "\033OB",	DNARROW,	KEY_DOWN ),
-	INTERN_KEY( "\033[C",	RTARROW,	KEY_RIGHT ),
-	INTERN_KEY( "\033OC",	RTARROW,	KEY_RIGHT ),
-	INTERN_KEY( "\033[D",	LTARROW,	KEY_LEFT ),
-	INTERN_KEY( "\033OD",	LTARROW,	KEY_LEFT ),
+	INTERN_KEY( "\033[A",	UPARROW_KEY,	KEY_UP ),
+	INTERN_KEY( "\033OA",	UPARROW_KEY,	KEY_UP ),
+	INTERN_KEY( "\033[B",	DNARROW_KEY,	KEY_DOWN ),
+	INTERN_KEY( "\033OB",	DNARROW_KEY,	KEY_DOWN ),
+	INTERN_KEY( "\033[C",	RTARROW_KEY,	KEY_RIGHT ),
+	INTERN_KEY( "\033OC",	RTARROW_KEY,	KEY_RIGHT ),
+	INTERN_KEY( "\033[D",	LTARROW_KEY,	KEY_LEFT ),
+	INTERN_KEY( "\033OD",	LTARROW_KEY,	KEY_LEFT ),
 	INTERN_KEY( "\033[1~",	FIND_KEY,	KEY_FIND ),
 	INTERN_KEY( "\033[2~",	INSERT_KEY,	KEY_IC ),
 	INTERN_KEY( "\033[3~",	REMOVE_KEY,	KEY_DC ),
 	INTERN_KEY( "\033[4~",	SELECT_KEY,	KEY_SELECT ),
-	INTERN_KEY( "\033[5~",	PGUP,		KEY_PPAGE ),
-	INTERN_KEY( "\033[6~",	PGDOWN,		KEY_NPAGE ),
-	INTERN_KEY( "\033[7~",	HOME,		KEY_HOME),
+	INTERN_KEY( "\033[5~",	PGUP_KEY,	KEY_PPAGE ),
+	INTERN_KEY( "\033[6~",	PGDOWN_KEY,	KEY_NPAGE ),
+	INTERN_KEY( "\033[7~",	HOME_KEY,	KEY_HOME),
 	INTERN_KEY( "\033[8~",	END_KEY,	KEY_END ),
-	INTERN_KEY( "\033[11~",	F1,		KEY_F(1) ),
-	INTERN_KEY( "\033[28~",	F1,		KEY_F(1) ),
-	INTERN_KEY( "\033OP",	F1,		KEY_F(1) ),
-	INTERN_KEY( "\033[OP",	F1,		KEY_F(1) ),
+	INTERN_KEY( "\033[11~",	F1_KEY,		KEY_F(1) ),
+	INTERN_KEY( "\033[28~",	F1_KEY,		KEY_F(1) ),
+	INTERN_KEY( "\033OP",	F1_KEY,		KEY_F(1) ),
+	INTERN_KEY( "\033[OP",	F1_KEY,		KEY_F(1) ),
 	INTERN_KEY( "\033[29~",	DO_KEY,		KEY_F(16) ),
-#if defined(USE_SLANG) && (defined(__WIN32__) || defined(__MINGW32__))
-	INTERN_KEY( "\xE0H",	UPARROW,	KEY_UP ),
-	INTERN_KEY( "\xE0P",	DNARROW,	KEY_DOWN ),
-	INTERN_KEY( "\xE0M",	RTARROW,	KEY_RIGHT ),
-	INTERN_KEY( "\xE0K",	LTARROW,	KEY_LEFT ),
+#if defined(USE_SLANG)
+#if defined(__WIN32__) || defined(__MINGW32__)
+	INTERN_KEY( "\xE0H",	UPARROW_KEY,	KEY_UP ),
+	INTERN_KEY( "\xE0P",	DNARROW_KEY,	KEY_DOWN ),
+	INTERN_KEY( "\xE0M",	RTARROW_KEY,	KEY_RIGHT ),
+	INTERN_KEY( "\xE0K",	LTARROW_KEY,	KEY_LEFT ),
 	INTERN_KEY( "\xE0R",	INSERT_KEY,	KEY_IC ),
 	INTERN_KEY( "\xE0S",	REMOVE_KEY,	KEY_DC ),
-	INTERN_KEY( "\xE0I",	PGUP,		KEY_PPAGE ),
-	INTERN_KEY( "\xE0Q",	PGDOWN,		KEY_NPAGE ),
-	INTERN_KEY( "\xE0G",	HOME,		KEY_HOME),
+	INTERN_KEY( "\xE0I",	PGUP_KEY,	KEY_PPAGE ),
+	INTERN_KEY( "\xE0Q",	PGDOWN_KEY,	KEY_NPAGE ),
+	INTERN_KEY( "\xE0G",	HOME_KEY,	KEY_HOME),
 	INTERN_KEY( "\xE0O",	END_KEY,	KEY_END ),
 #endif
-#if defined(USE_SLANG) && !defined(VMS)
-	INTERN_KEY(	"^(ku)", UPARROW,	KEY_UP ),
-	INTERN_KEY(	"^(kd)", DNARROW,	KEY_DOWN ),
-	INTERN_KEY(	"^(kr)", RTARROW,	KEY_RIGHT ),
-	INTERN_KEY(	"^(kl)", LTARROW,	KEY_LEFT ),
+#if !defined(VMS)
+	INTERN_KEY(	"^(ku)", UPARROW_KEY,	KEY_UP ),
+	INTERN_KEY(	"^(kd)", DNARROW_KEY,	KEY_DOWN ),
+	INTERN_KEY(	"^(kr)", RTARROW_KEY,	KEY_RIGHT ),
+	INTERN_KEY(	"^(kl)", LTARROW_KEY,	KEY_LEFT ),
 	INTERN_KEY(	"^(@0)", FIND_KEY,	KEY_FIND ),
 	INTERN_KEY(	"^(kI)", INSERT_KEY,	KEY_IC ),
 	INTERN_KEY(	"^(kD)", REMOVE_KEY,	KEY_DC ),
 	INTERN_KEY(	"^(*6)", SELECT_KEY,	KEY_SELECT ),
-	INTERN_KEY(	"^(kP)", PGUP,		KEY_PPAGE ),
-	INTERN_KEY(	"^(kN)", PGDOWN,	KEY_NPAGE ),
+	INTERN_KEY(	"^(kP)", PGUP_KEY,	KEY_PPAGE ),
+	INTERN_KEY(	"^(kN)", PGDOWN_KEY,	KEY_NPAGE ),
 	INTERN_KEY(	"^(@7)", END_KEY,	KEY_END ),
-	INTERN_KEY(	"^(kh)", HOME,		KEY_HOME),
-	INTERN_KEY(	"^(k1)", F1,		KEY_F(1) ),
+	INTERN_KEY(	"^(kh)", HOME_KEY,	KEY_HOME),
+	INTERN_KEY(	"^(k1)", F1_KEY,	KEY_F(1) ),
+	INTERN_KEY(	"^(k2)", F2_KEY,	KEY_F(2) ),
+	INTERN_KEY(	"^(k3)", F3_KEY,	KEY_F(3) ),
+	INTERN_KEY(	"^(k4)", F4_KEY,	KEY_F(4) ),
+	INTERN_KEY(	"^(k5)", F5_KEY,	KEY_F(5) ),
+	INTERN_KEY(	"^(k6)", F6_KEY,	KEY_F(6) ),
+	INTERN_KEY(	"^(k7)", F7_KEY,	KEY_F(7) ),
+	INTERN_KEY(	"^(k8)", F8_KEY,	KEY_F(8) ),
+	INTERN_KEY(	"^(k9)", F9_KEY,	KEY_F(9) ),
+	INTERN_KEY(	"^(k;)", F10_KEY,	KEY_F(10) ),
+	INTERN_KEY(	"^(F1)", F11_KEY,	KEY_F(11) ),
+	INTERN_KEY(	"^(F2)", F12_KEY,	KEY_F(12) ),
 	INTERN_KEY(	"^(F6)", DO_KEY,	KEY_F(16) ),
-#endif /* SLANG && !VMS */
+#endif /* !VMS */
+#endif /* SLANG */
     };
     /* *INDENT-ON* */
 
@@ -1647,16 +1715,16 @@ static int LYgetch_for(int code)
 	    keysym = key->f.keysym;
 	    switch (keysym) {
 	    case 'H':
-		keysym = UPARROW;
+		keysym = UPARROW_KEY;
 		break;
 	    case 'P':
-		keysym = DNARROW;
+		keysym = DNARROW_KEY;
 		break;
 	    case 'M':
-		keysym = RTARROW;
+		keysym = RTARROW_KEY;
 		break;
 	    case 'K':
-		keysym = LTARROW;
+		keysym = LTARROW_KEY;
 		break;
 	    case 'R':
 		keysym = INSERT_KEY;
@@ -1665,51 +1733,52 @@ static int LYgetch_for(int code)
 		keysym = REMOVE_KEY;
 		break;
 	    case 'I':
-		keysym = PGUP;
+		keysym = PGUP_KEY;
 		break;
 	    case 'Q':
-		keysym = PGDOWN;
+		keysym = PGDOWN_KEY;
 		break;
 	    case 'G':
-		keysym = HOME;
+		keysym = HOME_KEY;
 		break;
 	    case 'O':
 		keysym = END_KEY;
 		break;
 	    case ';':
-		keysym = F1;
+		keysym = F1_KEY;
 		break;
 	    }
 	    return (keysym);
 	}
 #endif
-
 	return (current_sl_modifier ? 0 : DO_NOTHING);
-    }
-
-    keysym = (int) key->f.keysym;
+    } else {
+	keysym = (int) key->f.keysym;
 
 #if defined (USE_MOUSE)
-    if (keysym == MOUSE_KEYSYM)
-	return sl_read_mouse_event(code);
+	if (keysym == MOUSE_KEYSYM)
+	    return sl_read_mouse_event(code);
 #endif
 
-    if (keysym < 0)
-	return 0;
+	if (keysym < 0) {
+	    return 0;
 
-    if (keysym & (LKC_ISLECLAC | LKC_ISLAC))
-	return (keysym);
+	} else if (keysym & (LKC_ISLECLAC | LKC_ISLAC)) {
+	    return (keysym);
+	} else {
+	    current_sl_modifier = 0;
+	    if (LKC_HAS_ESC_MOD(keysym)) {
+		current_sl_modifier = LKC_MOD2;
+		keysym &= LKC_MASK;
+	    }
 
-    current_sl_modifier = 0;
-    if (LKC_HAS_ESC_MOD(keysym)) {
-	current_sl_modifier = LKC_MOD2;
-	keysym &= LKC_MASK;
+	    if (keysym + 1 >= KEYMAP_SIZE) {
+		return 0;
+	    } else {
+		return (keysym | current_sl_modifier);
+	    }
+	}
     }
-
-    if (keysym + 1 >= KEYMAP_SIZE)
-	return 0;
-
-    return (keysym | current_sl_modifier);
 }
 
 /************************************************************************/
@@ -1854,40 +1923,40 @@ static int LYgetch_for(int code)
 
 	switch (a) {
 	case 'A':
-	    c = UPARROW;
+	    c = UPARROW_KEY;
 	    break;
 	case 'B':
-	    c = DNARROW;
+	    c = DNARROW_KEY;
 	    break;
 	case 'C':
-	    c = RTARROW;
+	    c = RTARROW_KEY;
 	    break;
 	case 'D':
-	    c = LTARROW;
+	    c = LTARROW_KEY;
 	    break;
 	case 'q':		/* vt100 application keypad 1 */
 	    c = END_KEY;
 	    break;
 	case 'r':		/* vt100 application keypad 2 */
-	    c = DNARROW;
+	    c = DNARROW_KEY;
 	    break;
 	case 's':		/* vt100 application keypad 3 */
-	    c = PGDOWN;
+	    c = PGDOWN_KEY;
 	    break;
 	case 't':		/* vt100 application keypad 4 */
-	    c = LTARROW;
+	    c = LTARROW_KEY;
 	    break;
 	case 'v':		/* vt100 application keypad 6 */
-	    c = RTARROW;
+	    c = RTARROW_KEY;
 	    break;
 	case 'w':		/* vt100 application keypad 7 */
-	    c = HOME;
+	    c = HOME_KEY;
 	    break;
 	case 'x':		/* vt100 application keypad 8 */
-	    c = UPARROW;
+	    c = UPARROW_KEY;
 	    break;
 	case 'y':		/* vt100 application keypad 9 */
-	    c = PGUP;
+	    c = PGUP_KEY;
 	    break;
 	case 'M':
 #if defined(USE_SLANG) && defined(USE_MOUSE)
@@ -1920,13 +1989,13 @@ static int LYgetch_for(int code)
 #ifdef VMS
 	    if (b != 'O')
 #endif /* VMS */
-		c = F1;
+		c = F1_KEY;
 	    break;
 	case 'u':
 #ifdef VMS
 	    if (b != 'O')
 #endif /* VMS */
-		c = F1;		/* macintosh help button */
+		c = F1_KEY;	/* macintosh help button */
 	    break;
 	case 'p':
 #ifdef VMS
@@ -1948,7 +2017,7 @@ static int LYgetch_for(int code)
 			  d == '9') &&
 			 found_TLD(GetChar())) {
 		    if (d == '8')	/* VTxxx   Help */
-			c = F1;
+			c = F1_KEY;
 		    else if (d == '9')	/* VTxxx    Do  */
 			c = DO_KEY;
 		    d = -1;
@@ -1970,20 +2039,20 @@ static int LYgetch_for(int code)
 	    break;
 	case '5':			     /** VTxxx PrevScreen **/
 	    if (found_CSI(c, b) && found_TLD(d = GetChar()))
-		c = PGUP;
+		c = PGUP_KEY;
 	    else
 		done_esc = FALSE;	/* we have another look below - kw */
 	    break;
 	case '6':			     /** VTxxx NextScreen **/
 	    if (found_CSI(c, b) && found_TLD(d = GetChar()))
-		c = PGDOWN;
+		c = PGDOWN_KEY;
 	    else
 		done_esc = FALSE;	/* we have another look below - kw */
 	    break;
 	case '[':			     /** Linux F1-F5: ^[[[A etc. **/
 	    if (found_CSI(c, b)) {
 		if ((d = GetChar()) == 'A')
-		    c = F1;
+		    c = F1_KEY;
 		break;
 	    }
 	    /* FALLTHRU */
@@ -2037,29 +2106,29 @@ static int LYgetch_for(int code)
 	 */
 	switch (c) {
 	case KEY_DOWN:		/* The four arrow keys ... */
-	    c = DNARROW;
+	    c = DNARROW_KEY;
 	    break;
 	case KEY_UP:
-	    c = UPARROW;
+	    c = UPARROW_KEY;
 	    break;
 	case KEY_LEFT:
-	    c = LTARROW;
+	    c = LTARROW_KEY;
 	    break;
 	case KEY_RIGHT:	/* ... */
-	    c = RTARROW;
+	    c = RTARROW_KEY;
 	    break;
 #if defined(PDCURSES)		/* for NEC PC-9800 1998/08/30 (Sun) 21:50:35 */
 	case KEY_C2:
-	    c = DNARROW;
+	    c = DNARROW_KEY;
 	    break;
 	case KEY_A2:
-	    c = UPARROW;
+	    c = UPARROW_KEY;
 	    break;
 	case KEY_B1:
-	    c = LTARROW;
+	    c = LTARROW_KEY;
 	    break;
 	case KEY_B3:
-	    c = RTARROW;
+	    c = RTARROW_KEY;
 	    break;
 	case PAD0:		/* PC-9800 Ins */
 	    c = INSERT_KEY;
@@ -2069,16 +2138,16 @@ static int LYgetch_for(int code)
 	    break;
 #endif /* PDCURSES */
 	case KEY_HOME:		/* Home key (upward+left arrow) */
-	    c = HOME;
+	    c = HOME_KEY;
 	    break;
 	case KEY_CLEAR:	/* Clear screen */
 	    c = 18;		/* CTRL-R */
 	    break;
 	case KEY_NPAGE:	/* Next page */
-	    c = PGDOWN;
+	    c = PGDOWN_KEY;
 	    break;
 	case KEY_PPAGE:	/* Previous page */
-	    c = PGUP;
+	    c = PGUP_KEY;
 	    break;
 	case KEY_LL:		/* home down or bottom (lower left) */
 	    c = END_KEY;
@@ -2089,10 +2158,10 @@ static int LYgetch_for(int code)
 	    /*   left   b2  right  */
 	    /*    c1   down   c3   */
 	case KEY_A1:		/* upper left of keypad */
-	    c = HOME;
+	    c = HOME_KEY;
 	    break;
 	case KEY_A3:		/* upper right of keypad */
-	    c = PGUP;
+	    c = PGUP_KEY;
 	    break;
 	case KEY_B2:		/* center of keypad */
 	    c = DO_NOTHING;
@@ -2101,7 +2170,7 @@ static int LYgetch_for(int code)
 	    c = END_KEY;
 	    break;
 	case KEY_C3:		/* lower right of keypad */
-	    c = PGDOWN;
+	    c = PGDOWN_KEY;
 	    break;
 #endif /* defined(KEY_A1) && defined(KEY_C3) */
 #ifdef KEY_ENTER
@@ -2121,7 +2190,7 @@ static int LYgetch_for(int code)
 #endif /* KEY_END */
 #ifdef KEY_HELP
 	case KEY_HELP:		/* help key          001 */
-	    c = F1;
+	    c = F1_KEY;
 	    break;
 #endif /* KEY_HELP */
 #ifdef KEY_BACKSPACE
@@ -2130,7 +2199,7 @@ static int LYgetch_for(int code)
 	    break;
 #endif /* KEY_BACKSPACE */
 	case KEY_F(1):
-	    c = F1;		/* VTxxx Help */
+	    c = F1_KEY;		/* VTxxx Help */
 	    break;
 #if defined(KEY_F) && !defined(__DJGPP__) && !defined(_WINDOWS)
 	case KEY_F(16):
@@ -2183,15 +2252,6 @@ static int LYgetch_for(int code)
 		    recent_sizechange));
 #endif /* HAVE_SIZECHANGE || USE_SLANG */
 	    if (!recent_sizechange) {
-#if 0				/* assumption seems flawed? */
-		/* Not detected by us or already processed by us.  It can
-		 * happens that ncurses lags behind us in detecting the change,
-		 * since its own SIGTSTP handler is not installed so detecting
-		 * happened *at the end* of the last refresh.  Tell it to
-		 * refresh again...  - kw
-		 */
-		LYrefresh();
-#endif
 #if defined(NCURSES)
 		/*
 		 * Work-around for scenario (Linux libc5) where we got a
@@ -2312,10 +2372,6 @@ static int LYgetch_for(int code)
 			lac = LYK_REFRESH;
 		    }
 		    c = LAC_TO_LKC(lac);
-#if 0				/* Probably not necessary any more - kw */
-		    lynx_force_repaint();
-		    LYrefresh();
-#endif
 		}
 #if NCURSES_MOUSE_VERSION > 1
 		else if (event.bstate & BUTTON4_PRESSED) {
@@ -2367,31 +2423,31 @@ static int LYgetch_for(int code)
 		    if (MOUSE_Y_POS > (LYlines - V_CMD_AREA - 1)) {
 			/* Screen BOTTOM */
 			if (MOUSE_X_POS < left) {
-			    c = LTARROW;
+			    c = LTARROW_KEY;
 			    p = "<-";
 			} else if (MOUSE_X_POS < HIST_CMD_2) {
-			    c = RTARROW;
+			    c = RTARROW_KEY;
 			    p = "->";
 			} else if (MOUSE_X_POS > right) {
 			    c = 'z';
 			    p = "Cancel";
 			} else {
-			    c = PGDOWN;
+			    c = PGDOWN_KEY;
 			    p = "PGDOWN";
 			}
 		    } else if (MOUSE_Y_POS < V_CMD_AREA) {
 			/* Screen TOP */
 			if (MOUSE_X_POS < left) {
-			    c = LTARROW;
+			    c = LTARROW_KEY;
 			    p = "<-";
 			} else if (MOUSE_X_POS < HIST_CMD_2) {
-			    c = RTARROW;
+			    c = RTARROW_KEY;
 			    p = "->";
 			} else if (MOUSE_X_POS > right) {
 			    c = 'z';
 			    p = "Cancel";
 			} else {
-			    c = PGUP;
+			    c = PGUP_KEY;
 			    p = "PGUP";
 			}
 		    } else {
@@ -2420,38 +2476,38 @@ static int LYgetch_for(int code)
 	switch (c) {
 	case K_Down:		/* The four arrow keys ... */
 	case K_EDown:
-	    c = DNARROW;
+	    c = DNARROW_KEY;
 	    break;
 	case K_Up:
 	case K_EUp:
-	    c = UPARROW;
+	    c = UPARROW_KEY;
 	    break;
 	case K_Left:
 	case K_ELeft:
-	    c = LTARROW;
+	    c = LTARROW_KEY;
 	    break;
 	case K_Right:		/* ... */
 	case K_ERight:
-	    c = RTARROW;
+	    c = RTARROW_KEY;
 	    break;
 	case K_Home:		/* Home key (upward+left arrow) */
 	case K_EHome:
-	    c = HOME;
+	    c = HOME_KEY;
 	    break;
 	case K_PageDown:	/* Next page */
 	case K_EPageDown:
-	    c = PGDOWN;
+	    c = PGDOWN_KEY;
 	    break;
 	case K_PageUp:		/* Previous page */
 	case K_EPageUp:
-	    c = PGUP;
+	    c = PGUP_KEY;
 	    break;
 	case K_End:		/* home down or bottom (lower left) */
 	case K_EEnd:
 	    c = END_KEY;
 	    break;
 	case K_F1:		/* F1 key */
-	    c = F1;
+	    c = F1_KEY;
 	    break;
 	case K_Insert:		/* Insert key */
 	case K_EInsert:
@@ -2478,35 +2534,35 @@ static int LYgetch_for(int code)
 #if defined(USE_SLANG) && (defined(__DJGPP__) || defined(__CYGWIN__)) && !defined(DJGPP_KEYHANDLER)  && !defined(USE_KEYMAPS)
 	switch (c) {
 	case SL_KEY_DOWN:	/* The four arrow keys ... */
-	    c = DNARROW;
+	    c = DNARROW_KEY;
 	    break;
 	case SL_KEY_UP:
-	    c = UPARROW;
+	    c = UPARROW_KEY;
 	    break;
 	case SL_KEY_LEFT:
-	    c = LTARROW;
+	    c = LTARROW_KEY;
 	    break;
 	case SL_KEY_RIGHT:	/* ... */
-	    c = RTARROW;
+	    c = RTARROW_KEY;
 	    break;
 	case SL_KEY_HOME:	/* Home key (upward+left arrow) */
 	case SL_KEY_A1:	/* upper left of keypad */
-	    c = HOME;
+	    c = HOME_KEY;
 	    break;
 	case SL_KEY_NPAGE:	/* Next page */
 	case SL_KEY_C3:	/* lower right of keypad */
-	    c = PGDOWN;
+	    c = PGDOWN_KEY;
 	    break;
 	case SL_KEY_PPAGE:	/* Previous page */
 	case SL_KEY_A3:	/* upper right of keypad */
-	    c = PGUP;
+	    c = PGUP_KEY;
 	    break;
 	case SL_KEY_END:	/* home down or bottom (lower left) */
 	case SL_KEY_C1:	/* lower left of keypad */
 	    c = END_KEY;
 	    break;
 	case SL_KEY_F(1):	/* F1 key */
-	    c = F1;
+	    c = F1_KEY;
 	    break;
 	case SL_KEY_IC:	/* Insert key */
 	    c = INSERT_KEY;
@@ -2518,9 +2574,9 @@ static int LYgetch_for(int code)
 #endif /* USE_SLANG && __DJGPP__ && !DJGPP_KEYHANDLER && !USE_KEYMAPS */
     }
 
-    if (c & (LKC_ISLAC | LKC_ISLECLAC))
+    if (c & (LKC_ISLAC | LKC_ISLECLAC)) {
 	return (c);
-    if ((c + 1) >= KEYMAP_SIZE) {
+    } else if ((c + 1) >= KEYMAP_SIZE) {
 	/*
 	 * Don't return raw values for KEYPAD symbols which we may have missed
 	 * in the switch above if they are obviously invalid when used as an
@@ -2587,9 +2643,8 @@ void LYLowerCase(char *arg_buffer)
     register unsigned char *buffer = (unsigned char *) arg_buffer;
     size_t i;
 
-    for (i = 0; buffer[i]; i++)
+    for (i = 0; buffer[i]; i++) {
 #ifdef SUPPORT_MULTIBYTE_EDIT	/* 1998/11/23 (Mon) 17:04:55 */
-    {
 	if ((buffer[i] & 0x80) != 0
 	    && buffer[i + 1] != 0) {
 	    if ((kanji_code == SJIS) && IS_SJIS_X0201KANA(UCH((buffer[i])))) {
@@ -2599,10 +2654,10 @@ void LYLowerCase(char *arg_buffer)
 	} else {
 	    buffer[i] = UCH(TOLOWER(buffer[i]));
 	}
-    }
 #else
 	buffer[i] = TOLOWER(buffer[i]);
 #endif
+    }
 }
 
 /*
@@ -2613,9 +2668,8 @@ void LYUpperCase(char *arg_buffer)
     register unsigned char *buffer = (unsigned char *) arg_buffer;
     size_t i;
 
-    for (i = 0; buffer[i]; i++)
+    for (i = 0; buffer[i]; i++) {
 #ifdef SUPPORT_MULTIBYTE_EDIT	/* 1998/11/23 (Mon) 17:05:10 */
-    {
 	if ((buffer[i] & 0x80) != 0
 	    && buffer[i + 1] != 0) {
 	    if ((kanji_code == SJIS) && IS_SJIS_X0201KANA(UCH((buffer[i])))) {
@@ -2625,10 +2679,10 @@ void LYUpperCase(char *arg_buffer)
 	} else {
 	    buffer[i] = UCH(TOUPPER(buffer[i]));
 	}
-    }
 #else
 	buffer[i] = UCH(TOUPPER(buffer[i]));
 #endif
+    }
 }
 
 /*
@@ -2636,6 +2690,8 @@ void LYUpperCase(char *arg_buffer)
  */
 BOOLEAN LYRemoveNewlines(char *buffer)
 {
+    BOOLEAN result = FALSE;
+
     if (buffer != 0) {
 	register char *buf = buffer;
 
@@ -2649,10 +2705,10 @@ BOOLEAN LYRemoveNewlines(char *buffer)
 		    *buf++ = *old;
 	    }
 	    *buf = '\0';
-	    return TRUE;
+	    result = TRUE;
 	}
     }
-    return FALSE;
+    return result;
 }
 
 /*
@@ -2675,6 +2731,8 @@ char *LYReduceBlanks(char *buffer)
  */
 char *LYRemoveBlanks(char *buffer)
 {
+    char *result = NULL;
+
     if (buffer != 0) {
 	register char *buf = buffer;
 
@@ -2689,9 +2747,9 @@ char *LYRemoveBlanks(char *buffer)
 	    }
 	    *buf = '\0';
 	}
-	return buf;
+	result = buf;
     }
-    return NULL;
+    return result;
 }
 
 /*
@@ -2799,6 +2857,8 @@ char *LYElideString(char *str,
  */
 BOOLEAN LYTrimStartfile(char *buffer)
 {
+    BOOLEAN result = FALSE;
+
     LYTrimHead(buffer);
     if (isLYNXEXEC(buffer) ||
 	isLYNXPROG(buffer)) {
@@ -2810,9 +2870,9 @@ BOOLEAN LYTrimStartfile(char *buffer)
 	 */
 	HTUnEscapeSome(buffer, " \r\n\t");
 	convert_to_spaces(buffer, TRUE);
-	return TRUE;
+	result = TRUE;
     }
-    return FALSE;
+    return result;
 }
 
 /*
@@ -2839,53 +2899,58 @@ void LYTrimAllStartfile(char *buffer)
 }
 
 /*
- *  Display the current value of the string and allow the user
- *  to edit it.
+ * Display the current value of the string and allow the user to edit it.
  */
 
-#define EDREC	 EditFieldData
-
 /*
  * Shorthand to get rid of the "edit->suchandsos".
  */
-#define IsDirty  edit->dirty
-#define IsHidden edit->hidden
-#define StartX	 edit->sx
-#define StartY	 edit->sy
-#define Buf	 edit->buffer
-#define Pos	 edit->pos	/* current editing position (bytes) */
-#define StrLen	 edit->buffer_used	/* length (bytes) */
-#define MaxLen	 edit->buffer_size
-#define BufLimit edit->buffer_limit
-#define DspWdth  edit->dspwdth
-#define DspStart edit->xpan	/* display-start (columns) */
-#define Margin	 edit->margin
-#define PanOn	 edit->panon
-#define PadChar  edit->pad
+#define IsDirty   edit->efIsDirty
+#define IsHidden  edit->efIsMasked
+#define StartX    edit->efStartX
+#define StartY    edit->efStartY
+#define Buffer    edit->efBuffer
+#define EditAt    edit->efEditAt	/* current editing position (bytes) */
+#define BufInUse  edit->efBufInUse	/* length (bytes) */
+#define BufAlloc  edit->efBufAlloc
+#define BufLimit  edit->efBufLimit
+#define DpyWidth  edit->efWidth
+#define DpyStart  edit->efDpyStart	/* display-start (columns) */
+#define PanMargin edit->efPanMargin
+#define IsPanned  edit->efIsPanned
+#define PadChar   edit->efPadChar
 #ifdef ENHANCED_LINEEDIT
-#define Mark	 edit->mark
+#define EditMark  edit->efEditMark
 #endif
-#define CurModif edit->current_modifiers
-#define Offs2Col edit->offset2col
+#define InputMods edit->efInputMods
+#define Offs2Col  edit->efOffs2Col
+
+#define enableEditMark() \
+	if (EditMark < 0) \
+	    EditMark = -(1 + EditMark)
+
+#define disableEditMark() \
+	if (EditMark >= 0) \
+	    EditMark = -(1 + EditMark)
 
 #ifdef ENHANCED_LINEEDIT
 static bstring *killbuffer;
 #endif
 
-static void updateMargin(EDREC * edit)
+static void updateMargin(FieldEditor * edit)
 {
-    if ((int) MaxLen > DspWdth) {	/* Need panning? */
-	if (DspWdth > 4)	/* Else "{}" take up precious screen space */
-	    PanOn = TRUE;
+    if ((int) BufAlloc > DpyWidth) {	/* Need panning? */
+	if (DpyWidth > 4)
+	    IsPanned = TRUE;
 
 	/*
 	 * Figure out margins.  If too big, we do a lot of unnecessary
 	 * scrolling.  If too small, user doesn't have sufficient look-ahead. 
 	 * Let's say 25% for each margin, upper bound is 10 columns.
 	 */
-	Margin = DspWdth / 4;
-	if (Margin > 10)
-	    Margin = 10;
+	PanMargin = DpyWidth / 4;
+	if (PanMargin > 10)
+	    PanMargin = 10;
     }
 }
 
@@ -2893,34 +2958,34 @@ static void updateMargin(EDREC * edit)
  * Before using an array position, make sure that the array is long enough.
  * Reallocate if needed.
  */
-static void ExtendEditor(EDREC * edit, int position)
+static void ExtendEditor(FieldEditor * edit, int position)
 {
     size_t need = (size_t) (++position);
 
-    if (need >= MaxLen && (BufLimit == 0 || need < BufLimit)) {
-	CTRACE((tfp, "ExtendEditor from %u to %u\n",
-		(unsigned) MaxLen,
-		(unsigned) need));
-	Buf = typeRealloc(char, Buf, need);
+    if (need >= BufAlloc && (BufLimit == 0 || need < BufLimit)) {
+	CTRACE((tfp, "ExtendEditor from %lu to %lu\n",
+		(unsigned long) BufAlloc,
+		(unsigned long) need));
+	Buffer = typeRealloc(char, Buffer, need);
 	Offs2Col = typeRealloc(int, Offs2Col, need + 1);
 
-	MaxLen = need;
+	BufAlloc = need;
 	updateMargin(edit);
     }
 }
 
-void LYFinishEdit(EDREC * edit)
+void LYFinishEdit(FieldEditor * edit)
 {
-    CTRACE((tfp, "LYFinishEdit:%s\n", NonNull(Buf)));
+    CTRACE((tfp, "LYFinishEdit:%s\n", NonNull(Buffer)));
 
-    FREE(Buf);
+    FREE(Buffer);
     FREE(Offs2Col);
 }
 
-void LYSetupEdit(EDREC * edit, char *old_value, size_t buffer_limit, int display_limit)
+void LYSetupEdit(FieldEditor * edit, char *old_value, size_t buffer_limit, int display_limit)
 {
-    CTRACE((tfp, "LYSetupEdit buffer %u, display %d:%s\n",
-	    (unsigned) buffer_limit,
+    CTRACE((tfp, "LYSetupEdit buffer %lu, display %d:%s\n",
+	    (unsigned long) buffer_limit,
 	    display_limit,
 	    old_value));
 
@@ -2934,28 +2999,28 @@ void LYSetupEdit(EDREC * edit, char *old_value, size_t buffer_limit, int display
     LYGetYX(StartY, StartX);
     PadChar = ' ';
     IsDirty = TRUE;
-    PanOn = FALSE;
-    CurModif = 0;
+    IsPanned = FALSE;
+    InputMods = 0;
 
-    MaxLen = buffer_limit;
-    DspWdth = display_limit;
-    Margin = 0;
-    Pos = (int) strlen(old_value);
+    BufAlloc = buffer_limit;
+    DpyWidth = display_limit;
+    PanMargin = 0;
+    EditAt = (int) strlen(old_value);
 #ifdef ENHANCED_LINEEDIT
-    Mark = -1;			/* pos=0, but do not show it yet */
+    EditMark = -1;		/* pos=0, but do not show it yet */
 #endif
-    DspStart = 0;
+    DpyStart = 0;
 
     updateMargin(edit);
 
-    StrLen = strlen(old_value);
-    Buf = typecallocn(char, MaxLen + 1);
+    BufInUse = strlen(old_value);
+    Buffer = typecallocn(char, BufAlloc + 1);
 
-    if (Buf == 0)
+    if (Buffer == 0)
 	outofmem(__FILE__, "LYSetupEdit");
 
-    LYStrNCpy(Buf, old_value, buffer_limit);
-    Offs2Col = typecallocn(int, MaxLen + 1);
+    LYStrNCpy(Buffer, old_value, buffer_limit);
+    Offs2Col = typecallocn(int, BufAlloc + 1);
 
     if (Offs2Col == 0)
 	outofmem(__FILE__, "LYSetupEdit");
@@ -3065,13 +3130,13 @@ static int map_active = 0;
 #define map_active 0
 #endif
 
-int LYEditInsert(EDREC * edit, unsigned const char *s,
+int LYEditInsert(FieldEditor * edit, unsigned const char *s,
 		 int len,
 		 int map GCC_UNUSED,
 		 int maxMessage)
 {
-    int length = (int) strlen(Buf);
-    int remains = (int) MaxLen - (length + len);
+    int length = (int) strlen(Buffer);
+    int remains = (int) BufAlloc - (length + len);
     int edited = 0, overflow = 0;
 
     /*
@@ -3080,20 +3145,20 @@ int LYEditInsert(EDREC * edit, unsigned const char *s,
     if (remains < 0) {
 	overflow = 1;
 	len = 0;
-	if ((int) MaxLen > length)	/* Insert as much as we can */
-	    len = (int) MaxLen - length;
+	if ((int) BufAlloc > length)	/* Insert as much as we can */
+	    len = (int) BufAlloc - length;
 	else
 	    goto finish;
     }
     ExtendEditor(edit, length + len);
-    Buf[length + len] = '\0';
-    for (; length >= Pos; length--)	/* Make room */
-	Buf[length + len] = Buf[length];
+    Buffer[length + len] = '\0';
+    for (; length >= EditAt; length--)	/* Make room */
+	Buffer[length + len] = Buffer[length];
 #ifdef EXP_KEYBOARD_LAYOUT
     if (map < 0)
 	map = map_active;
     if (map && IS_UTF8_TTY) {
-	int off = Pos;
+	int off = EditAt;
 	unsigned const char *e = s + len;
 	char *tail = 0;
 
@@ -3111,31 +3176,31 @@ int LYEditInsert(EDREC * edit, unsigned const char *s,
 			remains -= l - 1;
 			if (remains < 0) {
 			    if (tail)
-				strcpy(Buf + off, tail);
+				strcpy(Buffer + off, tail);
 			    FREE(tail);
 			    len = off;
 			    overflow = 1;
 			    goto finish;
 			}
 			if (l > 1 && !tail)
-			    StrAllocCopy(tail, Buf + Pos + len);
+			    StrAllocCopy(tail, Buffer + EditAt + len);
 		    } else
 			utfbuf[0] = '?';
 		} else
 		    utfbuf[0] = (char) ucode;
 	    }
-	    StrNCpy(Buf + off, utfbuf, l);
+	    StrNCpy(Buffer + off, utfbuf, l);
 	    edited = 1;
 	    off += l;
 	    s++;
 	}
 	if (tail)
-	    strcpy(Buf + off, tail);
-	len = off - Pos;
+	    strcpy(Buffer + off, tail);
+	len = off - EditAt;
 	FREE(tail);
     } else if (map) {
 	unsigned const char *e = s + len;
-	unsigned char *t = (unsigned char *) Buf + Pos;
+	unsigned char *t = (unsigned char *) Buffer + EditAt;
 
 	while (s < e) {
 	    int ch;
@@ -3154,46 +3219,48 @@ int LYEditInsert(EDREC * edit, unsigned const char *s,
     } else
 #endif /* defined EXP_KEYBOARD_LAYOUT */
     {
-	StrNCpy(Buf + Pos, (const char *) s, len);
+	StrNCpy(Buffer + EditAt, (const char *) s, len);
 	edited = 1;
     }
 
   finish:
-    Pos += len;
-    StrLen += (size_t) len;
+    EditAt += len;
+    BufInUse += (size_t) len;
     if (edited)
 	IsDirty = TRUE;
     if (overflow && maxMessage)
 	_statusline(MAXLEN_REACHED_DEL_OR_MOV);
 #ifdef ENHANCED_LINEEDIT
-    if (Mark > Pos)
-	Mark += len;
-    else if (Mark < -(1 + Pos))
-	Mark -= len;
-    if (Mark >= 0)
-	Mark = -(1 + Mark);	/* Disable it */
+    if (EditMark > EditAt)
+	EditMark += len;
+    else if (EditMark < -(1 + EditAt))
+	EditMark -= len;
+    disableEditMark();
 #endif
     return edited;
 }
 
-/* returns 0    character processed
- *         -ch  if action should be performed outside of line-editing mode
- *         ch   otherwise
+/*
+ * Do one edit-operation, given the input 'ch' and working buffer 'edit'.
+ *
+ * If the input is processed, returns zero.
+ * If the action should be performed outside of line-editing mode, return -ch.
+ * Otherwise, e.g., returns 'ch'.
  */
-int LYEdit1(EDREC * edit, int ch,
-	    int action,
-	    int maxMessage)
+int LYDoEdit(FieldEditor * edit, int ch,
+	     int action,
+	     int maxMessage)
 {
     int i;
     int length;
     unsigned char uch;
     int offset;
 
-    if ((int) MaxLen <= 0)
+    if ((int) BufAlloc <= 0)
 	return (0);		/* Be defensive */
 
-    StrLen = strlen(&Buf[0]);
-    length = (int) StrLen;
+    BufInUse = strlen(&Buffer[0]);
+    length = (int) BufInUse;
 
     switch (action) {
 #ifdef EXP_KEYBOARD_LAYOUT
@@ -3207,10 +3274,8 @@ int LYEdit1(EDREC * edit, int ch,
 #ifndef CJK_EX
     case LYE_AIX:
 	/*
-	 * Hex 97.
-	 * Fall through as a character for CJK, or if this is a valid character
-	 * in the current display character set.  Otherwise, we treat this as
-	 * LYE_ENTER.
+	 * Handle CJK characters, or as a valid character in the current
+	 * display character set.  Otherwise, we treat this as LYE_ENTER.
 	 */
 	if (!IS_CJK_TTY && LYlowest_eightbit[current_char_set] > 0x97)
 	    return (ch);
@@ -3227,28 +3292,27 @@ int LYEdit1(EDREC * edit, int ch,
 	 * replacement for a character in the 8-bit C1 control range.
 	 *
 	 * This is meant to undo transformations like 0x81 -> 0x1b 0x41 (ESC A)
-	 * etc.  done by slang on Unix and possibly some comm programs.  It's
+	 * etc., done by slang on Unix and possibly some comm programs.  It's
 	 * an imperfect workaround that doesn't work for all such characters.
 	 */
 	ch &= 0xFF;
 	if (ch + 64 >= LYlowest_eightbit[current_char_set])
 	    ch += 64;
 
-	if (Pos <= ((int) MaxLen) && StrLen < MaxLen) {
+	if (EditAt <= ((int) BufAlloc) && BufInUse < BufAlloc) {
 #ifdef ENHANCED_LINEEDIT
-	    if (Mark > Pos)
-		Mark++;
-	    else if (Mark < -(1 + Pos))
-		Mark--;
-	    if (Mark >= 0)
-		Mark = -(1 + Mark);	/* Disable it */
+	    if (EditMark > EditAt)
+		EditMark++;
+	    else if (EditMark < -(1 + EditAt))
+		EditMark--;
+	    disableEditMark();
 #endif
 	    ExtendEditor(edit, length + 1);
-	    for (i = length; i >= Pos; i--)	/* Make room */
-		Buf[i + 1] = Buf[i];
-	    Buf[length + 1] = '\0';
-	    Buf[Pos] = (char) ch;
-	    Pos++;
+	    for (i = length; i >= EditAt; i--)	/* Make room */
+		Buffer[i + 1] = Buffer[i];
+	    Buffer[length + 1] = '\0';
+	    Buffer[EditAt] = (char) ch;
+	    EditAt++;
 	} else {
 	    if (maxMessage) {
 		_statusline(MAXLEN_REACHED_DEL_OR_MOV);
@@ -3257,203 +3321,143 @@ int LYEdit1(EDREC * edit, int ch,
 	}
 	break;
 
-    case LYE_BACKW:
-	/*
-	 * Backword.
-	 * Definition of word is very naive:  1 or more a/n characters.
-	 */
-#ifndef SUPPORT_MULTIBYTE_EDIT
-	while (Pos && !isalnum(UCH(Buf[Pos - 1])))
-	    Pos--;
-	while (Pos && isalnum(UCH(Buf[Pos - 1])))
-	    Pos--;
-#else
-	while (Pos && !(isalnum(UCH(Buf[Pos - 1])) || is8bits(Buf[Pos - 1])))
-	    Pos--;
-	while (Pos && (isalnum(UCH(Buf[Pos - 1])) || is8bits(Buf[Pos - 1])))
-	    Pos--;
-#endif
+    case LYE_BACKW:		/* go backward one word */
+	while (EditAt && !IsWordChar(Buffer[EditAt - 1]))
+	    EditAt--;
+	while (EditAt && IsWordChar(UCH(Buffer[EditAt - 1])))
+	    EditAt--;
 	break;
 
-    case LYE_FORWW:
-	/*
-	 * Word forward.
-	 */
-#ifndef SUPPORT_MULTIBYTE_EDIT
-	while (isalnum(UCH(Buf[Pos])))
-	    Pos++;		/* '\0' is not a/n */
-	while (!isalnum(UCH(Buf[Pos])) && Buf[Pos])
-	    Pos++;
-#else
-	while (isalnum(UCH(Buf[Pos])) || is8bits(Buf[Pos]))
-	    Pos++;		/* '\0' is not a/n */
-	while (!(isalnum(UCH(Buf[Pos])) || is8bits(Buf[Pos])) && Buf[Pos])
-	    Pos++;
-#endif
+    case LYE_FORWW:		/* go forward one word */
+	while (IsWordChar(UCH(Buffer[EditAt])))
+	    EditAt++;
+	while (!IsWordChar(Buffer[EditAt]) && Buffer[EditAt])
+	    EditAt++;
 	break;
 
-    case LYE_ERASE:
-	/*
-	 * Erase the line to start fresh.
-	 */
-	Buf[0] = '\0';
+    case LYE_ERASE:		/* erase the line */
+	Buffer[0] = '\0';
 #ifdef ENHANCED_LINEEDIT
-	Mark = -1;		/* Do not show the mark */
+	EditMark = -1;		/* Do not show the mark */
 #endif
-	/* fall through */
+	/* FALLTHRU */
 
-    case LYE_BOL:
-	/*
-	 * Go to first column.
-	 */
-	Pos = 0;
+    case LYE_BOL:		/* go to beginning of line  */
+	EditAt = 0;
 	break;
 
-    case LYE_EOL:
-	/*
-	 * Go to last column.
-	 */
-	Pos = length;
+    case LYE_EOL:		/* go to end of line  */
+	EditAt = length;
 	break;
 
-    case LYE_DELNW:
-	/*
-	 * Delete next word.
-	 */
-	offset = Pos;
-	LYEdit1(edit, 0, LYE_FORWW, FALSE);
-	offset = Pos - offset;
-	Pos -= offset;
+    case LYE_DELNW:		/* delete next word  */
+	offset = EditAt;
+	LYDoEdit(edit, 0, LYE_FORWW, FALSE);
+	offset = EditAt - offset;
+	EditAt -= offset;
 
 	goto shrink;		/* right below */
 
-    case LYE_DELPW:
-	/*
-	 * Delete previous word.
-	 */
-	offset = Pos;
-	LYEdit1(edit, 0, LYE_BACKW, FALSE);
-	offset -= Pos;
+    case LYE_DELPW:		/* delete previous word  */
+	offset = EditAt;
+	LYDoEdit(edit, 0, LYE_BACKW, FALSE);
+	offset -= EditAt;
 
       shrink:
-	for (i = Pos; i < length - offset + 1; i++)
-	    Buf[i] = Buf[i + offset];
+	for (i = EditAt; i < length - offset + 1; i++)
+	    Buffer[i] = Buffer[i + offset];
 #ifdef ENHANCED_LINEEDIT
-	if (Mark >= 0)
-	    Mark = -(1 + Mark);	/* Disable it */
-	if (Mark <= -(1 + Pos + offset))
-	    Mark += offset;	/* Shift it */
-	if (-(1 + Pos + offset) < Mark && Mark < -(1 + Pos))
-	    Mark = -(1 + Pos);	/* Set to the current position */
+	disableEditMark();
+	if (EditMark <= -(1 + EditAt + offset))
+	    EditMark += offset;	/* Shift it */
+	if (-(1 + EditAt + offset) < EditMark && EditMark < -(1 + EditAt))
+	    EditMark = -(1 + EditAt);	/* Set to the current position */
 #endif
 
 	break;
 
-    case LYE_DELBL:
-	/*
-	 * Delete from current cursor position back to BOL.
-	 */
-	for (i = Pos; i < length + 1; i++)
-	    Buf[i - Pos] = Buf[i];
+    case LYE_DELBL:		/* delete from cursor to beginning of line */
+	for (i = EditAt; i < length + 1; i++)
+	    Buffer[i - EditAt] = Buffer[i];
 
 #ifdef ENHANCED_LINEEDIT
-	if (Mark >= 0)
-	    Mark = -(1 + Mark);	/* Disable it */
-	if (Mark <= -(1 + Pos))
-	    Mark += Pos;	/* Shift it */
+	disableEditMark();
+	if (EditMark <= -(1 + EditAt))
+	    EditMark += EditAt;	/* Shift it */
 	else
-	    Mark = -1;		/* Reset it */
+	    EditMark = -1;	/* Reset it */
 #endif
-	Pos = 0;
+	EditAt = 0;
 	break;
 
-    case LYE_DELEL:		/* @@@ */
-	/*
-	 * Delete from current cursor position thru EOL.
-	 */
-	Buf[Pos] = '\0';
+    case LYE_DELEL:		/* delete from cursor to end of line */
+	Buffer[EditAt] = '\0';
 #ifdef ENHANCED_LINEEDIT
-	if (Mark >= 0)
-	    Mark = -(1 + Mark);	/* Disable it */
-	if (Mark <= -(1 + Pos))
-	    Mark = -1;		/* Reset it */
+	disableEditMark();
+	if (EditMark <= -(1 + EditAt))
+	    EditMark = -1;	/* Reset it */
 #endif
 	break;
 
-    case LYE_DELN:
-	/*
-	 * Delete next character (I-beam style cursor), or current character
-	 * (box/underline style cursor).
-	 */
-	if (Pos >= length)
+    case LYE_DELN:		/* delete next character */
+	if (EditAt >= length)
 	    break;
 #ifndef SUPPORT_MULTIBYTE_EDIT
-	Pos++;
+	EditAt++;
 #else
-	Pos += mbcs_skip(Buf + Pos, 1);
+	EditAt += mbcs_skip(Buffer + EditAt, 1);
 #endif
-	/* fall through - DO NOT RELOCATE the LYE_DELN case wrt LYE_DELP */
+	/* FALLTHRU */
 
-    case LYE_DELP:
-	/*
-	 * Delete preceding character.
-	 */
-	if (length == 0 || Pos == 0)
+    case LYE_DELP:		/* delete previous character */
+	if (length == 0 || EditAt == 0)
 	    break;
 
 #ifndef SUPPORT_MULTIBYTE_EDIT
 #ifdef ENHANCED_LINEEDIT
-	if (Mark >= 0)
-	    Mark = -(1 + Mark);	/* Disable it */
-	if (Mark <= -(1 + Pos))
-	    Mark++;
+	disableEditMark();
+	if (EditMark <= -(1 + EditAt))
+	    EditMark++;
 #endif
-	Pos--;
-	for (i = Pos; i < length; i++)
-	    Buf[i] = Buf[i + 1];
+	EditAt--;
+	for (i = EditAt; i < length; i++)
+	    Buffer[i] = Buffer[i + 1];
 #else /* SUPPORT_MULTIBYTE_EDIT */
-	offset = Pos - mbcs_skip(Buf, mbcs_glyphs(Buf, Pos) - 1);
-	Pos -= offset;
-	for (i = Pos; i < length - offset + 1; i++)
-	    Buf[i] = Buf[i + offset];
+	offset = EditAt - mbcs_skip(Buffer, mbcs_glyphs(Buffer, EditAt) - 1);
+	EditAt -= offset;
+	for (i = EditAt; i < length - offset + 1; i++)
+	    Buffer[i] = Buffer[i + offset];
 
 #ifdef ENHANCED_LINEEDIT
-	if (Mark >= 0)
-	    Mark = -(1 + Mark);	/* Disable it */
-	if (Mark <= -(1 + Pos))
-	    Mark += offset;	/* Shift it */
+	disableEditMark();
+	if (EditMark <= -(1 + EditAt))
+	    EditMark += offset;	/* Shift it */
 #endif
 
 #endif /* SUPPORT_MULTIBYTE_EDIT */
 	break;
 
     case LYE_FORW_RL:
-    case LYE_FORW:
-	/*
-	 * Move cursor to the right.
-	 */
+    case LYE_FORW:		/* move cursor forward */
 #ifndef SUPPORT_MULTIBYTE_EDIT
-	if (Pos < length)
-	    Pos++;
+	if (EditAt < length)
+	    EditAt++;
 #else
-	if (Pos < length)
-	    Pos += mbcs_skip(Buf + Pos, 1);
+	if (EditAt < length)
+	    EditAt += mbcs_skip(Buffer + EditAt, 1);
 #endif
 	else if (action == LYE_FORW_RL)
 	    return -ch;
 	break;
 
     case LYE_BACK_LL:
-    case LYE_BACK:
-	/*
-	 * Left-arrow move cursor to the left.
-	 */
+    case LYE_BACK:		/* move cursor backward */
 #ifndef SUPPORT_MULTIBYTE_EDIT
-	if (Pos > 0)
-	    Pos--;
+	if (EditAt > 0)
+	    EditAt--;
 #else
-	if (Pos > 0)
-	    Pos = mbcs_skip(Buf, mbcs_glyphs(Buf, Pos) - 1);
+	if (EditAt > 0)
+	    EditAt = mbcs_skip(Buffer, mbcs_glyphs(Buffer, EditAt) - 1);
 #endif
 	else if (action == LYE_BACK_LL)
 	    return -ch;
@@ -3470,91 +3474,74 @@ int LYEdit1(EDREC * edit, int ch,
 	    break;		/* Can't help it now */
 #endif
 
-	if (length <= 1 || Pos == 0)
+	if (length <= 1 || EditAt == 0)
 	    return (ch);
-	if (Pos == length)
-	    Pos--;
-	if (Mark < 0)
-	    Mark = -(1 + Mark);	/* Temporary enable it */
-	if (Mark == Pos || Mark == Pos + 1)
-	    Mark = Pos - 1;
-	if (Mark >= 0)
-	    Mark = -(1 + Mark);	/* Disable it */
-	if (Buf[Pos - 1] == Buf[Pos]) {
-	    Pos++;
+	if (EditAt == length)
+	    EditAt--;
+	enableEditMark();
+	if (EditMark == EditAt || EditMark == EditAt + 1)
+	    EditMark = EditAt - 1;
+	disableEditMark();
+	if (Buffer[EditAt - 1] == Buffer[EditAt]) {
+	    EditAt++;
 	    break;
 	}
-	i = Buf[Pos - 1];
-	Buf[Pos - 1] = Buf[Pos];
-	Buf[Pos++] = (char) i;
+	i = Buffer[EditAt - 1];
+	Buffer[EditAt - 1] = Buffer[EditAt];
+	Buffer[EditAt++] = (char) i;
 	break;
 
-    case LYE_SETMARK:
-	/*
-	 * primitive emacs-like set-mark-command
-	 */
-	Mark = Pos;
+    case LYE_SETMARK:		/* Emacs-like set-mark-command */
+	EditMark = EditAt;
 	return (0);
 
-    case LYE_XPMARK:
-	/*
-	 * emacs-like exchange-point-and-mark
-	 */
-	if (Mark < 0)
-	    Mark = -(1 + Mark);	/* Enable it */
-	if (Mark == Pos)
+    case LYE_XPMARK:		/* Emacs-like exchange-point-and-mark */
+	enableEditMark();
+	if (EditMark == EditAt)
 	    return (0);
-	i = Pos;
-	Pos = Mark;
-	Mark = i;
+	i = EditAt;
+	EditAt = EditMark;
+	EditMark = i;
 	break;
 
-    case LYE_KILLREG:
-	/*
-	 * primitive emacs-like kill-region
-	 */
-	if (Mark < 0)
-	    Mark = -(1 + Mark);	/* Enable it */
-	if (Mark == Pos) {
+    case LYE_KILLREG:		/* Emacs-like kill-region */
+	enableEditMark();
+	if (EditMark == EditAt) {
 	    BStrFree(killbuffer);
 	    return (0);
 	}
-	if (Mark > Pos)
-	    LYEdit1(edit, 0, LYE_XPMARK, FALSE);
+	if (EditMark > EditAt)
+	    LYDoEdit(edit, 0, LYE_XPMARK, FALSE);
 	{
-	    int reglen = Pos - Mark;
+	    int reglen = EditAt - EditMark;
 
-	    BStrCopy1(killbuffer, Buf + Mark, reglen);
-	    for (i = Mark; Buf[i + reglen]; i++)
-		Buf[i] = Buf[i + reglen];
-	    Buf[i] = Buf[i + reglen];	/* terminate */
-	    Pos = Mark;
+	    BStrCopy1(killbuffer, Buffer + EditMark, reglen);
+	    for (i = EditMark; Buffer[i + reglen]; i++)
+		Buffer[i] = Buffer[i + reglen];
+	    Buffer[i] = Buffer[i + reglen];	/* terminate */
+	    EditAt = EditMark;
 	}
-	if (Mark >= 0)
-	    Mark = -(1 + Mark);	/* Disable it */
+	disableEditMark();
 	break;
 
-    case LYE_YANK:
-	/*
-	 * primitive emacs-like yank
-	 */
+    case LYE_YANK:		/* Emacs-like yank */
 	if (!killbuffer) {
-	    Mark = -(1 + Pos);
+	    EditMark = -(1 + EditAt);
 	    return (0);
 	} else {
 	    int yanklen = killbuffer->len;
 
-	    if ((Pos + yanklen) <= (int) MaxLen &&
-		StrLen + (size_t) yanklen <= MaxLen) {
+	    if ((EditAt + yanklen) <= (int) BufAlloc &&
+		BufInUse + (size_t) yanklen <= BufAlloc) {
 
-		ExtendEditor(edit, Pos + yanklen);
+		ExtendEditor(edit, EditAt + yanklen);
 
-		Mark = -(1 + Pos);
+		EditMark = -(1 + EditAt);
 
-		for (i = length; i >= Pos; i--)		/* Make room */
-		    Buf[i + yanklen] = Buf[i];
+		for (i = length; i >= EditAt; i--)	/* Make room */
+		    Buffer[i + yanklen] = Buffer[i];
 		for (i = 0; i < yanklen; i++)
-		    Buf[Pos++] = killbuffer->str[i];
+		    Buffer[EditAt++] = killbuffer->str[i];
 
 	    } else if (maxMessage) {
 		_statusline(MAXLEN_REACHED_DEL_OR_MOV);
@@ -3565,18 +3552,18 @@ int LYEdit1(EDREC * edit, int ch,
 #endif /* ENHANCED_LINEEDIT */
 
     case LYE_UPPER:
-	LYUpperCase(Buf);
+	LYUpperCase(Buffer);
 	break;
 
     case LYE_LOWER:
-	LYLowerCase(Buf);
+	LYLowerCase(Buffer);
 	break;
 
     default:
 	return (ch);
     }
     IsDirty = TRUE;
-    StrLen = strlen(&Buf[0]);
+    BufInUse = strlen(&Buffer[0]);
     return (0);
 }
 
@@ -3603,7 +3590,7 @@ int get_popup_number(const char *msg,
     /*
      * Get the number, possibly with a suffix, from the user.
      */
-    if (LYgetBString(&temp, VISIBLE, 0, NORECALL) < 0 || isBEmpty(temp)) {
+    if (LYgetBString(&temp, FALSE, 0, NORECALL) < 0 || isBEmpty(temp)) {
 	HTInfoMsg(CANCELLED);
 	*c = '\0';
 	*rel = '\0';
@@ -3655,7 +3642,7 @@ int get_popup_number(const char *msg,
 #  define TmpStyleOff(s)
 #endif /* defined USE_COLOR_STYLE */
 
-static void remember_column(EDREC * edit, int offset)
+static void remember_column(FieldEditor * edit, int offset)
 {
     int y0, x0;
 
@@ -3688,24 +3675,24 @@ static void fill_edited_line(int prompting GCC_UNUSED, int length, int ch)
 
 /*
  * Multibyte string display subroutine.
- * EDREC fields retain their values as byte offsets.
+ * FieldEditor fields retain their values as byte offsets.
  * All external logic still works fine with byte values.
  */
-void LYRefreshEdit(EDREC * edit)
+void LYRefreshEdit(FieldEditor * edit)
 {
     /* bytes and characters are not the same thing */
 #if defined(DEBUG_EDIT)
     int all_bytes;
 #endif
-    int pos_bytes = Pos;
+    int pos_bytes = EditAt;
     int dpy_bytes;
     int lft_bytes;		/* base of string which is displayed */
 
     /* cells refer to display-columns on the screen */
-    int all_cells;		/* total of display-cells in Buf */
+    int all_cells;		/* total of display-cells in Buffer */
     int dpy_cells;		/* number of cells which are displayed */
     int lft_cells;		/* number of cells before display (on left) */
-    int pos_cells;		/* number of display-cells up to Pos */
+    int pos_cells;		/* number of display-cells up to EditAt */
 
 #if defined(SUPPORT_MULTIBYTE_EDIT)
     int dpy_chars;
@@ -3734,63 +3721,62 @@ void LYRefreshEdit(EDREC * edit)
     /*
      * If we've made no changes, or if there is nothing to display, just leave.
      */
-    if (!IsDirty || (DspWdth == 0))
+    if (!IsDirty || (DpyWidth == 0))
 	return;
 
-    CTRACE((tfp, "LYRefreshEdit:%s\n", Buf));
+    CTRACE((tfp, "LYRefreshEdit:%s\n", Buffer));
 
     IsDirty = FALSE;
 
-    StrLen = strlen(&Buf[0]);
+    BufInUse = strlen(&Buffer[0]);
 
-    all_cells = LYstrCells(Buf);
-    pos_cells = LYstrExtent2(Buf, Pos);
+    all_cells = LYstrCells(Buffer);
+    pos_cells = LYstrExtent2(Buffer, EditAt);
 
 #if defined(SUPPORT_MULTIBYTE_EDIT) && defined(DEBUG_EDIT)
-    all_bytes = (int) StrLen;
-    lft_chars = mbcs_glyphs(Buf, DspStart);
-    pos_chars = mbcs_glyphs(Buf, Pos);
-    all_chars = mbcs_glyphs(Buf, all_bytes);
+    all_bytes = (int) BufInUse;
+    lft_chars = mbcs_glyphs(Buffer, DpyStart);
+    pos_chars = mbcs_glyphs(Buffer, EditAt);
+    all_chars = mbcs_glyphs(Buffer, all_bytes);
 #endif
 
     /*
      * Now we have:
-     *                .--DspWdth---.
+     *                .--DpyWidth--.
      *      +---------+=============+-----------+
-     *      |         |M           M|           |   (M=margin)
+     *      |         |M           M|           |   (M=PanMargin)
      *      +---------+=============+-----------+
-     *      0         DspStart                   StrLen
+     *      0         DpyStart                   BufInUse
      *
-     * Insertion point can be anywhere between 0 and stringlength.  Figure out
-     * new display starting point.
+     * Insertion point can be anywhere between 0 and stringlength.  Calculate
+     * a new display starting point.
      *
-     * The first "if" below makes Lynx scroll several columns at a time when
-     * extending the string.  Looks awful, but that way we can keep up with
-     * data entry at low baudrates.
+     * First, make Lynx scroll several columns at a time as needed when
+     * extending the string.   Doing this helps with lowspeed connections.
      */
 
-    lft_bytes = DspStart;
-    lft_cells = LYstrExtent2(Buf, DspStart);
+    lft_bytes = DpyStart;
+    lft_cells = LYstrExtent2(Buffer, DpyStart);
 
-    if ((lft_cells + DspWdth) <= all_cells) {
-	if (pos_cells >= (lft_cells + DspWdth) - Margin) {
-	    lft_cells = (pos_cells - DspWdth) + Margin;
+    if ((lft_cells + DpyWidth) <= all_cells) {
+	if (pos_cells >= (lft_cells + DpyWidth) - PanMargin) {
+	    lft_cells = (pos_cells - DpyWidth) + PanMargin;
 #ifdef SUPPORT_MULTIBYTE_EDIT
-	    lft_chars = cell2char(Buf, lft_cells);
-	    lft_bytes = mbcs_skip(Buf, lft_chars);
+	    lft_chars = cell2char(Buffer, lft_cells);
+	    lft_bytes = mbcs_skip(Buffer, lft_chars);
 #else
 	    lft_bytes = lft_cells;
 #endif /* SUPPORT_MULTIBYTE_EDIT */
 	}
     }
 
-    if (pos_cells < lft_cells + Margin) {
-	lft_cells = pos_cells - Margin;
+    if (pos_cells < lft_cells + PanMargin) {
+	lft_cells = pos_cells - PanMargin;
 	if (lft_cells < 0)
 	    lft_cells = 0;
 #ifdef SUPPORT_MULTIBYTE_EDIT
-	lft_chars = cell2char(Buf, lft_cells);
-	lft_bytes = mbcs_skip(Buf, lft_chars);
+	lft_chars = cell2char(Buffer, lft_cells);
+	lft_bytes = mbcs_skip(Buffer, lft_chars);
 #else
 	lft_bytes = lft_cells;
 #endif /* SUPPORT_MULTIBYTE_EDIT */
@@ -3803,7 +3789,7 @@ void LYRefreshEdit(EDREC * edit)
      * overwriting part of a multicolumn character which may lie in the first
      * position.
      */
-    if (PanOn && lft_cells) {
+    if (IsPanned && lft_cells) {
 	CTRACE_EDIT((tfp, "Draw left scroll-indicator\n"));
 	TmpStyleOn(prompting ? s_prompt_edit_arr : s_aedit_arr);
 	LYmove(StartY, StartX);
@@ -3812,15 +3798,15 @@ void LYRefreshEdit(EDREC * edit)
 	lft_shift = 1;
     }
 
-    str = &Buf[lft_bytes];
-    DspStart = lft_bytes;
+    str = &Buffer[lft_bytes];
+    DpyStart = lft_bytes;
 
     dpy_cells = all_cells - lft_cells;
     CTRACE_EDIT((tfp, "Comparing dpy_cells %d > (%d - %d)\n",
-		 dpy_cells, DspWdth, lft_shift));
-    if (dpy_cells > (DspWdth - lft_shift)) {
+		 dpy_cells, DpyWidth, lft_shift));
+    if (dpy_cells > (DpyWidth - lft_shift)) {
 	rgt_shift = 1;
-	dpy_cells = (DspWdth - lft_shift - rgt_shift);
+	dpy_cells = (DpyWidth - lft_shift - rgt_shift);
     }
     for (;;) {
 #ifdef SUPPORT_MULTIBYTE_EDIT
@@ -3899,17 +3885,17 @@ void LYRefreshEdit(EDREC * edit)
 	Offs2Col[i] = cell + StartX;
     } else {
 #if defined(ENHANCED_LINEEDIT) && defined(USE_COLOR_STYLE)
-	if (Mark >= 0 && DspStart > Mark)
+	if (EditMark >= 0 && DpyStart > EditMark)
 	    TmpStyleOn(prompting ? s_prompt_sel : s_aedit_sel);
 #endif
 	remember_column(edit, 0);
 	for (i = 0; i < dpy_bytes; i++) {
 #if defined(ENHANCED_LINEEDIT) && defined(USE_COLOR_STYLE)
-	    if (Mark >= 0 && ((DspStart + i == Mark && Pos > Mark)
-			      || (DspStart + i == Pos && Pos < Mark)))
+	    if (EditMark >= 0 && ((DpyStart + i == EditMark && EditAt > EditMark)
+				  || (DpyStart + i == EditAt && EditAt < EditMark)))
 		TmpStyleOn(prompting ? s_prompt_sel : s_aedit_sel);
-	    if (Mark >= 0 && ((DspStart + i == Mark && Pos < Mark)
-			      || (DspStart + i == Pos && Pos > Mark)))
+	    if (EditMark >= 0 && ((DpyStart + i == EditMark && EditAt < EditMark)
+				  || (DpyStart + i == EditAt && EditAt > EditMark)))
 		TmpStyleOff(prompting ? s_prompt_sel : s_aedit_sel);
 #endif
 	    if (str[i] == 1 || str[i] == 2 ||
@@ -3935,10 +3921,10 @@ void LYRefreshEdit(EDREC * edit)
 	    remember_column(edit, i + 1);
 	}
 #if defined(ENHANCED_LINEEDIT) && defined(USE_COLOR_STYLE)
-	if (Mark >= 0 &&
-	    ((DspStart + dpy_bytes <= Mark && DspStart + dpy_bytes > Pos)
-	     || (DspStart + dpy_bytes > Mark
-		 && DspStart + dpy_bytes <= Pos))) {
+	if (EditMark >= 0 &&
+	    ((DpyStart + dpy_bytes <= EditMark && DpyStart + dpy_bytes > EditAt)
+	     || (DpyStart + dpy_bytes > EditMark
+		 && DpyStart + dpy_bytes <= EditAt))) {
 	    TmpStyleOff(prompting ? s_prompt_sel : s_aedit_sel);
 	}
 #endif
@@ -3947,13 +3933,13 @@ void LYRefreshEdit(EDREC * edit)
     /*
      * Erase rest of input area.
      */
-    padsize = DspWdth - (Offs2Col[dpy_bytes] - StartX);
+    padsize = DpyWidth - (Offs2Col[dpy_bytes] - StartX);
     fill_edited_line(prompting, padsize, PadChar);
 
     /*
      * Scrolling indicators.
      */
-    if (PanOn && dpy_bytes && rgt_shift) {
+    if (IsPanned && dpy_bytes && rgt_shift) {
 	CTRACE((tfp, "Draw right-scroller offset (%d + %d)\n",
 		dpy_cells, lft_shift));
 	TmpStyleOn(prompting ? s_prompt_edit_arr : s_aedit_arr);
@@ -3965,7 +3951,7 @@ void LYRefreshEdit(EDREC * edit)
     /*
      * Finally, move the cursor to the point where the next edit will occur.
      */
-    LYmove(StartY, Offs2Col[Pos - DspStart]);
+    LYmove(StartY, Offs2Col[EditAt - DpyStart]);
 
 #ifdef USE_COLOR_STYLE
     if (estyle != NOSTYLE)
@@ -3974,10 +3960,10 @@ void LYRefreshEdit(EDREC * edit)
     LYrefresh();
 }
 
-static void reinsertEdit(EditFieldData *edit, char *result)
+static void reinsertEdit(FieldEditor * edit, char *result)
 {
     if (result != 0) {
-	LYEdit1(edit, '\0', LYE_ERASE, FALSE);
+	LYDoEdit(edit, '\0', LYE_ERASE, FALSE);
 	while (*result != '\0') {
 	    LYLineEdit(edit, (int) (*result), FALSE);
 	    result++;
@@ -4059,7 +4045,7 @@ int LYarrayWidth(STRING2PTR list)
     return result;
 }
 
-static void FormatChoiceNum(char *dst,
+static void FormatChoiceNum(char *target,
 			    int num_choices,
 			    int choice,
 			    const char *value)
@@ -4067,11 +4053,11 @@ static void FormatChoiceNum(char *dst,
     if (num_choices >= 0) {
 	int digits = (num_choices > 9) ? 2 : 1;
 
-	sprintf(dst, "%*d: %.*s",
+	sprintf(target, "%*d: %.*s",
 		digits, (choice + 1),
 		MAX_LINE - 9 - digits, value);
     } else {
-	LYStrNCpy(dst, value, MAX_LINE - 1);
+	LYStrNCpy(target, value, MAX_LINE - 1);
     }
 }
 
@@ -4829,7 +4815,7 @@ int LYhandlePopupList(int cur_choice,
 	case LYK_WHEREIS:
 	    if (isBEmpty(prev_target)) {
 		_statusline(ENTER_WHEREIS_QUERY);
-		if ((ch = LYgetBString(&prev_target, VISIBLE, 0, recall)) < 0) {
+		if ((ch = LYgetBString(&prev_target, FALSE, 0, recall)) < 0) {
 		    /*
 		     * User cancelled the search via ^G.  - FM
 		     */
@@ -4840,7 +4826,7 @@ int LYhandlePopupList(int cur_choice,
 
 	  check_recall:
 	    if (isBEmpty(prev_target) &&
-		!(recall && (ch == UPARROW || ch == DNARROW))) {
+		!(recall && (ch == UPARROW_KEY || ch == DNARROW_KEY))) {
 		/*
 		 * No entry.  Simply break.  - FM
 		 */
@@ -4848,7 +4834,7 @@ int LYhandlePopupList(int cur_choice,
 		goto restore_popup_statusline;
 	    }
 
-	    if (recall && ch == UPARROW) {
+	    if (recall && ch == UPARROW_KEY) {
 		if (FirstRecall) {
 		    /*
 		     * Use the current string or last query in the list.  - FM
@@ -4892,7 +4878,7 @@ int LYhandlePopupList(int cur_choice,
 			_statusline(EDIT_A_PREV_QUERY);
 		    }
 		    if ((ch = LYgetBString(&prev_target,
-					   VISIBLE, 0, recall)) < 0) {
+					   FALSE, 0, recall)) < 0) {
 			/*
 			 * User cancelled the search via ^G.  - FM
 			 */
@@ -4901,7 +4887,7 @@ int LYhandlePopupList(int cur_choice,
 		    }
 		    goto check_recall;
 		}
-	    } else if (recall && ch == DNARROW) {
+	    } else if (recall && ch == DNARROW_KEY) {
 		if (FirstRecall) {
 		    /*
 		     * Use the current string or first query in the list.  - FM
@@ -4945,7 +4931,7 @@ int LYhandlePopupList(int cur_choice,
 			_statusline(EDIT_A_PREV_QUERY);
 		    }
 		    if ((ch = LYgetBString(&prev_target,
-					   VISIBLE, 0, recall)) < 0) {
+					   FALSE, 0, recall)) < 0) {
 			/*
 			 * User cancelled the search via ^G. - FM
 			 */
@@ -5079,11 +5065,13 @@ int LYgetBString(bstring **inputline,
     int xlec = -2;
     int last_xlec = -1;
     int last_xlkc = -1;
-    EditFieldData MyEdit, *edit = &MyEdit;
+    FieldEditor MyEdit, *edit = &MyEdit;
 
 #ifdef SUPPORT_MULTIBYTE_EDIT
     BOOL refresh_mb = TRUE;
 #endif /* SUPPORT_MULTIBYTE_EDIT */
+    BOOL done = FALSE;
+    int result = -1;
 
     CTRACE((tfp, "called LYgetBString hidden %d, recall %d\n", hidden, (int) recall));
 
@@ -5101,8 +5089,8 @@ int LYgetBString(bstring **inputline,
     fep_on();
 #endif
 
-    for (;;) {
-      again:
+    while (!done) {
+      beginning:
 #ifndef SUPPORT_MULTIBYTE_EDIT
 	LYRefreshEdit(edit);
 #else /* SUPPORT_MULTIBYTE_EDIT */
@@ -5114,12 +5102,12 @@ int LYgetBString(bstring **inputline,
 #ifdef CJK_EX			/* for SJIS code */
 	if (!refresh_mb
 	    && (EditBinding(ch) != LYE_CHAR))
-	    goto again;
+	    goto beginning;
 #else
 	if (!refresh_mb
 	    && (EditBinding(ch) != LYE_CHAR)
 	    && (EditBinding(ch) != LYE_AIX))
-	    goto again;
+	    goto beginning;
 #endif
 #endif /* SUPPORT_MULTIBYTE_EDIT */
 
@@ -5137,18 +5125,20 @@ int LYgetBString(bstring **inputline,
 	    ch = LYCharINTERRUPT2;
 	}
 
-	if (recall != NORECALL && (ch == UPARROW || ch == DNARROW)) {
-	    BStrCopy0(*inputline, Buf);
-	    LYAddToCloset(recall, Buf);
+	if (recall != NORECALL && (ch == UPARROW_KEY || ch == DNARROW_KEY)) {
+	    BStrCopy0(*inputline, Buffer);
+	    LYAddToCloset(recall, Buffer);
 	    CTRACE((tfp, "LYgetstr(%s) recall\n", (*inputline)->str));
 #ifdef FEPCTRL
 	    fep_off();
 #endif
 	    LYFinishEdit(edit);
-	    return (ch);
+	    result = ch;
+	    done = TRUE;
+	    break;
 	}
-	ch |= CurModif;
-	CurModif = 0;
+	ch |= InputMods;
+	InputMods = 0;
 	if (last_xlkc != -1) {
 	    if (ch == last_xlkc)
 		ch |= LKC_MOD3;
@@ -5156,7 +5146,7 @@ int LYgetBString(bstring **inputline,
 	}
 #ifndef WIN_EX
 	if (LKC_TO_LAC(keymap, ch) == LYK_REFRESH)
-	    goto again;
+	    goto beginning;
 #endif
 	last_xlec = xlec;
 	xlec = EditBinding(ch);
@@ -5168,16 +5158,10 @@ int LYgetBString(bstring **inputline,
 	}
 	switch (xlec) {
 	case LYE_SETM1:
-	    /*
-	     * Set flag for modifier 1.
-	     */
-	    CurModif |= LKC_MOD1;
+	    InputMods |= LKC_MOD1;
 	    break;
 	case LYE_SETM2:
-	    /*
-	     * Set flag for modifier 2.
-	     */
-	    CurModif |= LKC_MOD2;
+	    InputMods |= LKC_MOD2;
 	    break;
 	case LYE_TAB:
 	    if (xlec == last_xlec && recall != NORECALL) {
@@ -5190,7 +5174,7 @@ int LYgetBString(bstring **inputline,
 		    int num_options = LYarrayLength((STRING2PTR) data);
 
 		    while (cur_choice < num_options
-			   && strcasecomp(data[cur_choice], Buf) < 0)
+			   && strcasecomp(data[cur_choice], Buffer) < 0)
 			cur_choice++;
 
 		    LYGetYX(old_y, old_x);
@@ -5211,17 +5195,15 @@ int LYgetBString(bstring **inputline,
 		    FREE(data);
 		}
 	    } else {
-		reinsertEdit(edit, LYFindInCloset(recall, Buf));
+		reinsertEdit(edit, LYFindInCloset(recall, Buffer));
 	    }
 	    break;
 
-#ifndef CJK_EX			/* 1997/11/03 (Mon) 20:13:45 */
+#ifndef CJK_EX
 	case LYE_AIX:
 	    /*
-	     * Hex 97.
-	     * Treat as a character for CJK, or if this is a valid character in
-	     * the current display character set.  Otherwise, we treat this as
-	     * LYE_ENTER.
+	     * Handle CJK characters, or as a valid character in the current
+	     * display character set.  Otherwise, we treat this as LYE_ENTER.
 	     */
 	    if (ch != '\t' &&
 		(IS_CJK_TTY ||
@@ -5232,33 +5214,30 @@ int LYgetBString(bstring **inputline,
 	    /* FALLTHRU */
 #endif
 	case LYE_ENTER:
-	    /*
-	     * Terminate the string and return.
-	     */
-	    BStrCopy0(*inputline, Buf);
+	    BStrCopy0(*inputline, Buffer);
 	    if (!hidden)
-		LYAddToCloset(recall, Buf);
+		LYAddToCloset(recall, Buffer);
 	    CTRACE((tfp, "LYgetstr(%s) LYE_ENTER\n", (*inputline)->str));
 #ifdef FEPCTRL
 	    fep_off();
 #endif
 	    LYFinishEdit(edit);
-	    return (ch);
+	    result = ch;
+	    done = TRUE;
+	    break;
 
 #ifdef CAN_CUT_AND_PASTE
-	    /* 1998/10/01 (Thu) 15:05:49 */
-
 	case LYE_PASTE:
 	    {
 		unsigned char *s = (unsigned char *) get_clip_grab(), *e;
-		int len;
+		size_t len;
 
 		if (!s)
 		    break;
-		len = (int) strlen((const char *) s);
+		len = strlen((const char *) s);
 		e = s + len;
 
-		if (len > 0) {
+		if (len != 0) {
 		    unsigned char *e1 = s;
 
 		    while (e1 < e) {
@@ -5274,13 +5253,16 @@ int LYgetBString(bstring **inputline,
 					     map_active,
 					     TRUE);
 				s = ++e1;
-			    } else
+			    } else {
 				break;
-			} else
+			    }
+			} else {
 			    ++e1;
+			}
 		    }
-		    if (e1 > s)
+		    if (e1 > s) {
 			LYEditInsert(edit, s, (int) (e1 - s), map_active, TRUE);
+		    }
 		}
 		get_clip_release();
 		break;
@@ -5288,31 +5270,26 @@ int LYgetBString(bstring **inputline,
 #endif
 
 	case LYE_ABORT:
-	    /*
-	     * Control-C or Control-G aborts.
-	     */
 	    CTRACE((tfp, "LYgetstr LYE_ABORT\n"));
 #ifdef FEPCTRL
 	    fep_off();
 #endif
 	    LYFinishEdit(edit);
 	    BStrCopy0(*inputline, "");
-	    return (-1);
+	    done = TRUE;
+	    break;
 
 	case LYE_STOP:
-	    /*
-	     * Deactivate.
-	     */
 	    CTRACE((tfp, "LYgetstr LYE_STOP\n"));
 #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION
 	    textfields_need_activation = TRUE;
 	    LYFinishEdit(edit);
 	    BStrCopy0(*inputline, "");
-	    return (-1);
+	    done = TRUE;
+	    break;
 #else
 #ifdef ENHANCED_LINEEDIT
-	    if (Mark >= 0)
-		Mark = -(1 + Mark);	/* Disable it */
+	    disableEditMark();
 #endif
 	    break;
 #endif
@@ -5350,12 +5327,13 @@ int LYgetBString(bstring **inputline,
 		    refresh_mb = TRUE;
 	    } else {
 		if (!refresh_mb) {
-		    LYEdit1(edit, 0, LYE_DELP, FALSE);
+		    LYDoEdit(edit, 0, LYE_DELP, FALSE);
 		}
 	    }
 #endif /* SUPPORT_MULTIBYTE_EDIT */
 	}
     }
+    return result;
 }
 
 /*
@@ -5387,23 +5365,27 @@ const char *LYLineeditHelpURL(void)
     static int lasthelp_lineedit = -1;
     static char helpbuf[LY_MAXPATH] = "\0";
     static char *phelp = &helpbuf[0];
+    const char *result = NULL;
 
-    if (lasthelp_lineedit == current_lineedit)
-	return &helpbuf[0];
-    if (lasthelp_lineedit == -1) {
-	LYStrNCpy(helpbuf, helpfilepath, sizeof(helpbuf) - 1);
-	phelp += strlen(helpbuf);
-    }
-    if (LYLineeditHelpURLs[current_lineedit] &&
-	strlen(LYLineeditHelpURLs[current_lineedit]) &&
-	(strlen(LYLineeditHelpURLs[current_lineedit]) <=
-	 sizeof(helpbuf) - (unsigned) (phelp - helpbuf))) {
-	LYStrNCpy(phelp, LYLineeditHelpURLs[current_lineedit],
-		  (int) (sizeof(helpbuf) - (unsigned) (phelp - helpbuf) - 1));
-	lasthelp_lineedit = current_lineedit;
-	return (&helpbuf[0]);
+    if (lasthelp_lineedit == current_lineedit) {
+	result = helpbuf;
+    } else {
+	const char *source = LYLineeditHelpURLs[current_lineedit];
+	size_t available;
+
+	if (lasthelp_lineedit == -1) {
+	    LYStrNCpy(helpbuf, helpfilepath, sizeof(helpbuf) - 1);
+	    phelp += strlen(helpbuf);
+	}
+	available = (sizeof(helpbuf) - (size_t) (phelp - helpbuf));
+	if (non_empty(source) &&
+	    (strlen(source) <= available)) {
+	    LYStrNCpy(phelp, source, available);
+	    lasthelp_lineedit = current_lineedit;
+	    result = helpbuf;
+	}
     }
-    return NULL;
+    return result;
 }
 
 /*
@@ -5485,151 +5467,156 @@ int LYscanFloat(const char *source, float *result)
 char *LYstrsep(char **stringp,
 	       const char *delim)
 {
-    char *tmp, *out;
-
-    if (isEmpty(stringp))	/* nothing to do? */
-	return 0;		/* then don't fall on our faces */
+    char *marker;
+    char *result = 0;
 
-    out = *stringp;		/* save the start of the string */
-    tmp = strpbrk(*stringp, delim);
-    if (tmp) {
-	*tmp = '\0';		/* terminate the substring with \0 */
-	*stringp = ++tmp;	/* point at the next substring */
-    } else
-	*stringp = 0;		/* this was the last substring: */
-    /* let caller see he's done */
-    return out;
+    if (non_empty(stringp)) {
+	result = *stringp;	/* will return the old value */
+	marker = strpbrk(*stringp, delim);
+	if (marker) {
+	    *marker = '\0';	/* terminate the substring */
+	    *stringp = ++marker;	/* point to the next substring */
+	} else {
+	    *stringp = 0;	/* this was the last */
+	}
+    }
+    return result;
 }
 
 /*
- * LYstrstr will find the first occurrence of the string pointed to by tarptr
- * in the string pointed to by chptr.  It returns NULL if string not found.  It
- * is a case insensitive search.
+ * LYstrstr finds the first occurrence of the string pointed to by needle
+ * in the string pointed to by haystack.
+ *
+ * It returns NULL if the string is not found.
+ *
+ * It is a case insensitive search.
  */
-char *LYstrstr(char *chptr,
-	       const char *tarptr)
+char *LYstrstr(char *haystack,
+	       const char *needle)
 {
-    int len = (int) strlen(tarptr);
+    int len = (int) strlen(needle);
+    char *result = NULL;
 
-    for (; *chptr != '\0'; chptr++) {
-	if (0 == UPPER8(*chptr, *tarptr)) {
-	    if (0 == strncasecomp8(chptr + 1, tarptr + 1, len - 1))
-		return (chptr);
+    for (; *haystack != '\0'; haystack++) {
+	if (0 == UPPER8(*haystack, *needle)) {
+	    if (0 == strncasecomp8(haystack + 1, needle + 1, len - 1)) {
+		result = haystack;
+		break;
+	    }
 	}
-    }				/* end for */
+    }
 
-    return (NULL);		/* string not found or initial chptr was empty */
+    return (result);
 }
 
+#define SkipSpecialChars(p) \
+	while (IsSpecialAttrChar(*p) && *p != '\0') \
+	    p++
+
 /*
- * LYno_attr_char_case_strstr will find the first occurrence of the
- * string pointed to by tarptr in the string pointed to by chptr.
- * It ignores the characters:  LY_UNDERLINE_START_CHAR and
- *			       LY_UNDERLINE_END_CHAR
- *			       LY_BOLD_START_CHAR
- *			       LY_BOLD_END_CHAR
- *			       LY_SOFT_HYPHEN
- *			       if present in chptr.
+ * LYno_attr_char_case_strstr finds the first occurrence of the
+ * string pointed to by needle in the string pointed to by haystack.
+ *
+ * It ignores special characters, e.g., LY_UNDERLINE_START_CHAR in haystack.
+ *
  * It is a case insensitive search.
  */
-const char *LYno_attr_char_case_strstr(const char *chptr,
-				       const char *tarptr)
+const char *LYno_attr_char_case_strstr(const char *haystack,
+				       const char *needle)
 {
-    register const char *tmpchptr, *tmptarptr;
+    const char *refptr, *tstptr;
+    const char *result = NULL;
 
-    if (!chptr)
-	return (NULL);
+    if (haystack != NULL && needle != NULL) {
 
-    while (IsSpecialAttrChar(*chptr) && *chptr != '\0')
-	chptr++;
+	SkipSpecialChars(haystack);
 
-    for (; *chptr != '\0'; chptr++) {
-	if (0 == UPPER8(*chptr, *tarptr)) {
-	    /*
-	     * See if they line up.
-	     */
-	    tmpchptr = chptr + 1;
-	    tmptarptr = tarptr + 1;
+	for (; *haystack != '\0' && (result == NULL); haystack++) {
+	    if (0 == UPPER8(*haystack, *needle)) {
+		refptr = haystack + 1;
+		tstptr = needle + 1;
 
-	    if (*tmptarptr == '\0')	/* one char target */
-		return (chptr);
+		if (*tstptr == '\0') {
+		    result = haystack;
+		    break;
+		}
 
-	    while (1) {
-		if (!IsSpecialAttrChar(*tmpchptr)) {
-		    if (0 != UPPER8(*tmpchptr, *tmptarptr))
+		while (1) {
+		    if (!IsSpecialAttrChar(*refptr)) {
+			if (0 != UPPER8(*refptr, *tstptr))
+			    break;
+			refptr++;
+			tstptr++;
+		    } else {
+			refptr++;
+		    }
+		    if (*tstptr == '\0') {
+			result = haystack;
+			break;
+		    }
+		    if (*refptr == '\0')
 			break;
-		    tmpchptr++;
-		    tmptarptr++;
-		} else {
-		    tmpchptr++;
 		}
-		if (*tmptarptr == '\0')
-		    return (chptr);
-		if (*tmpchptr == '\0')
-		    break;
 	    }
 	}
-    }				/* end for */
+    }
 
-    return (NULL);
+    return (result);
 }
 
 /*
- * LYno_attr_char_strstr will find the first occurrence of the
- * string pointed to by tarptr in the string pointed to by chptr.
- * It ignores the characters:  LY_UNDERLINE_START_CHAR and
- *			       LY_UNDERLINE_END_CHAR
- *			       LY_BOLD_START_CHAR
- *			       LY_BOLD_END_CHAR
- *			       LY_SOFT_HYPHEN
- *			       if present in chptr.
+ * LYno_attr_char_strstr finds the first occurrence of the
+ * string pointed to by needle in the string pointed to by haystack.
+ * It ignores special characters, e.g., LY_UNDERLINE_START_CHAR in haystack.
+ *
  * It is a case sensitive search.
  */
-const char *LYno_attr_char_strstr(const char *chptr,
-				  const char *tarptr)
+const char *LYno_attr_char_strstr(const char *haystack,
+				  const char *needle)
 {
-    register const char *tmpchptr, *tmptarptr;
+    const char *refptr, *tstptr;
+    const char *result = NULL;
 
-    if (!chptr)
-	return (NULL);
+    if (haystack != NULL && needle != NULL) {
 
-    while (IsSpecialAttrChar(*chptr) && *chptr != '\0')
-	chptr++;
+	SkipSpecialChars(haystack);
 
-    for (; *chptr != '\0'; chptr++) {
-	if ((*chptr) == (*tarptr)) {
-	    /*
-	     * See if they line up.
-	     */
-	    tmpchptr = chptr + 1;
-	    tmptarptr = tarptr + 1;
+	for (; *haystack != '\0' && (result == NULL); haystack++) {
+	    if ((*haystack) == (*needle)) {
+		refptr = haystack + 1;
+		tstptr = needle + 1;
 
-	    if (*tmptarptr == '\0')	/* one char target */
-		return (chptr);
+		if (*tstptr == '\0') {
+		    result = haystack;
+		    break;
+		}
 
-	    while (1) {
-		if (!IsSpecialAttrChar(*tmpchptr)) {
-		    if ((*tmpchptr) != (*tmptarptr))
+		while (1) {
+		    if (!IsSpecialAttrChar(*refptr)) {
+			if ((*refptr) != (*tstptr))
+			    break;
+			refptr++;
+			tstptr++;
+		    } else {
+			refptr++;
+		    }
+		    if (*tstptr == '\0') {
+			result = haystack;
 			break;
-		    tmpchptr++;
-		    tmptarptr++;
-		} else {
-		    tmpchptr++;
+		    } else if (*refptr == '\0') {
+			break;
+		    }
 		}
-		if (*tmptarptr == '\0')
-		    return (chptr);
-		if (*tmpchptr == '\0')
-		    break;
 	    }
 	}
-    }				/* end for */
+    }
 
-    return (NULL);
+    return (result);
 }
 
 /*
- * LYno_attr_mbcs_case_strstr will find the first occurrence of the string
- * pointed to by tarptr in the string pointed to by chptr.  It takes account of
+ * LYno_attr_mbcs_case_strstr finds the first occurrence of the string pointed
+ * to by needle in the string pointed to by haystack.  It takes account of
  * MultiByte Character Sequences (UTF8).  The physical lengths of the displayed
  * string up to the start and end (= next position after) of the target string
  * are returned in *nstartp and *nendp if the search is successful.
@@ -5639,158 +5626,133 @@ const char *LYno_attr_char_strstr(const char *chptr,
  * count actual glyphs if count_gcells is unset.  (Full-width characters in CJK
  * mode count as one.)
  *
- * It ignores the characters: LY_UNDERLINE_START_CHAR and
- *			      LY_UNDERLINE_END_CHAR
- *			      LY_BOLD_START_CHAR
- *			      LY_BOLD_END_CHAR
- *			      LY_SOFT_HYPHEN
- *			      if present in chptr.
+ * It ignores special characters, e.g., LY_UNDERLINE_START_CHAR in haystack.
+ *
  * It assumes UTF8 if utf_flag is set.
- * It is a case insensitive search.  - KW & FM
+ *
+ * It is a case insensitive search.
  */
-const char *LYno_attr_mbcs_case_strstr(const char *chptr,
-				       const char *tarptr,
+const char *LYno_attr_mbcs_case_strstr(const char *haystack,
+				       const char *needle,
 				       int utf_flag,
 				       int count_gcells,
 				       int *nstartp,
 				       int *nendp)
 {
-    const char *tmpchptr;
-    const char *tmptarptr;
+    const char *refptr;
+    const char *tstptr;
     int len = 0;
     int offset;
+    const char *result = NULL;
 
-    if (!(chptr && tarptr))
-	return (NULL);
+    if (haystack != NULL && needle != NULL) {
 
-    /*
-     * Skip initial IsSpecial chars.  - FM
-     */
-    while (IsSpecialAttrChar(*chptr) && *chptr != '\0')
-	chptr++;
+	SkipSpecialChars(haystack);
 
-    /*
-     * Seek a first target match.  - FM
-     */
-    for (; *chptr != '\0'; chptr++) {
-	if ((!utf_flag && IS_CJK_TTY && is8bits(*chptr) &&
-	     *chptr == *tarptr &&
-	     IsNormalChar(*(chptr + 1))) ||
-	    (0 == UPPER8(*chptr, *tarptr))) {
-	    int tarlen = 0;
+	for (; *haystack != '\0' && (result == NULL); haystack++) {
+	    if ((!utf_flag && IS_CJK_TTY && is8bits(*haystack) &&
+		 *haystack == *needle &&
+		 IsNormalChar(*(haystack + 1))) ||
+		(0 == UPPER8(*haystack, *needle))) {
+		int tarlen = 0;
 
-	    offset = len;
-	    len++;
+		offset = len;
+		len++;
 
-	    /*
-	     * See if they line up.
-	     */
-	    tmpchptr = (chptr + 1);
-	    tmptarptr = (tarptr + 1);
+		refptr = (haystack + 1);
+		tstptr = (needle + 1);
 
-	    if (*tmptarptr == '\0') {
-		/*
-		 * One char target.
-		 */
-		if (nstartp)
-		    *nstartp = offset;
-		if (nendp)
-		    *nendp = len;
-		return (chptr);
-	    }
-	    if (!utf_flag && IS_CJK_TTY && is8bits(*chptr) &&
-		*chptr == *tarptr &&
-		IsNormalChar(*tmpchptr)) {
-		/*
-		 * Check the CJK multibyte.  - FM
-		 */
-		if (*tmpchptr == *tmptarptr) {
-		    /*
-		     * It's a match.  Advance to next char.  - FM
-		     */
-		    tmpchptr++;
-		    tmptarptr++;
-		    if (count_gcells)
-			tarlen++;
-		    if (*tmptarptr == '\0') {
-			/*
-			 * One character match.  - FM
-			 */
-			if (nstartp)
-			    *nstartp = offset;
-			if (nendp)
-			    *nendp = len + tarlen;
-			return (chptr);
-		    }
-		} else {
-		    /*
-		     * It's not a match, so go back to seeking a first target
-		     * match.  - FM
-		     */
-		    chptr++;
-		    if (count_gcells)
-			len++;
-		    continue;
+		if (*tstptr == '\0') {
+		    if (nstartp)
+			*nstartp = offset;
+		    if (nendp)
+			*nendp = len;
+		    result = haystack;
+		    break;
 		}
-	    }
-	    /*
-	     * See if the rest of the target matches.  - FM
-	     */
-	    while (1) {
-		if (!IsSpecialAttrChar(*tmpchptr)) {
-		    if (!utf_flag && IS_CJK_TTY && is8bits(*tmpchptr)) {
-			if (*tmpchptr == *tmptarptr &&
-			    *(tmpchptr + 1) == *(tmptarptr + 1) &&
-			    !IsSpecialAttrChar(*(tmpchptr + 1))) {
-			    tmpchptr++;
-			    tmptarptr++;
-			    if (count_gcells)
-				tarlen++;
-			} else {
+		if (!utf_flag && IS_CJK_TTY && is8bits(*haystack) &&
+		    *haystack == *needle &&
+		    IsNormalChar(*refptr)) {
+		    /* handle a CJK multibyte string */
+		    if (*refptr == *tstptr) {
+			refptr++;
+			tstptr++;
+			if (count_gcells)
+			    tarlen++;
+			if (*tstptr == '\0') {
+			    if (nstartp)
+				*nstartp = offset;
+			    if (nendp)
+				*nendp = len + tarlen;
+			    result = haystack;
 			    break;
 			}
-		    } else if (0 != UPPER8(*tmpchptr, *tmptarptr)) {
-			break;
+		    } else {
+			/* not a match */
+			haystack++;
+			if (count_gcells)
+			    len++;
+			continue;
 		    }
+		}
+		/* compare the remainder of the string */
+		while (1) {
+		    if (!IsSpecialAttrChar(*refptr)) {
+			if (!utf_flag && IS_CJK_TTY && is8bits(*refptr)) {
+			    if (*refptr == *tstptr &&
+				*(refptr + 1) == *(tstptr + 1) &&
+				!IsSpecialAttrChar(*(refptr + 1))) {
+				refptr++;
+				tstptr++;
+				if (count_gcells)
+				    tarlen++;
+			    } else {
+				break;
+			    }
+			} else if (0 != UPPER8(*refptr, *tstptr)) {
+			    break;
+			}
 
-		    if (!IS_UTF_EXTRA(*tmptarptr)) {
-			tarlen++;
+			if (!IS_UTF_EXTRA(*tstptr)) {
+			    tarlen++;
+			}
+			refptr++;
+			tstptr++;
+
+		    } else {
+			refptr++;
 		    }
-		    tmpchptr++;
-		    tmptarptr++;
 
-		} else {
-		    tmpchptr++;
+		    if (*tstptr == '\0') {
+			if (nstartp)
+			    *nstartp = offset;
+			if (nendp)
+			    *nendp = len + tarlen;
+			result = haystack;
+			break;
+		    }
+		    if (*refptr == '\0')
+			break;
 		}
-
-		if (*tmptarptr == '\0') {
-		    if (nstartp)
-			*nstartp = offset;
-		    if (nendp)
-			*nendp = len + tarlen;
-		    return (chptr);
+	    } else if (!(IS_UTF_EXTRA(*haystack) ||
+			 IsSpecialAttrChar(*haystack))) {
+		if (!utf_flag && IS_CJK_TTY && is8bits(*haystack) &&
+		    IsNormalChar(*(haystack + 1))) {
+		    haystack++;
+		    if (count_gcells)
+			len++;
 		}
-		if (*tmpchptr == '\0')
-		    break;
+		len++;
 	    }
-	} else if (!(IS_UTF_EXTRA(*chptr) ||
-		     IsSpecialAttrChar(*chptr))) {
-	    if (!utf_flag && IS_CJK_TTY && is8bits(*chptr) &&
-		IsNormalChar(*(chptr + 1))) {
-		chptr++;
-		if (count_gcells)
-		    len++;
-	    }
-	    len++;
 	}
-    }				/* end for */
+    }
 
-    return (NULL);
+    return (result);
 }
 
 /*
- * LYno_attr_mbcs_strstr will find the first occurrence of the string pointed
- * to by tarptr in the string pointed to by chptr.
+ * LYno_attr_mbcs_strstr finds the first occurrence of the string pointed
+ * to by needle in the string pointed to by haystack.
  *
  * It takes account of CJK and MultiByte Character Sequences (UTF8).  The
  * physical lengths of the displayed string up to the start and end (= next
@@ -5802,199 +5764,177 @@ const char *LYno_attr_mbcs_case_strstr(const char *chptr,
  * count actual glyphs if count_gcells is unset.  (Full-width characters in CJK
  * mode count as one.)
  *
- * It ignores the characters: LY_UNDERLINE_START_CHAR and
- *			      LY_UNDERLINE_END_CHAR
- *			      LY_BOLD_START_CHAR
- *			      LY_BOLD_END_CHAR
- *			      LY_SOFT_HYPHEN
- *			      if present in chptr.
+ * It ignores special characters, e.g., LY_UNDERLINE_START_CHAR in haystack.
+ *
  * It assumes UTF8 if utf_flag is set.
- * It is a case sensitive search.  - KW & FM
+ *
+ * It is a case sensitive search.
  */
-const char *LYno_attr_mbcs_strstr(const char *chptr,
-				  const char *tarptr,
+const char *LYno_attr_mbcs_strstr(const char *haystack,
+				  const char *needle,
 				  int utf_flag,
 				  int count_gcells,
 				  int *nstartp,
 				  int *nendp)
 {
-    const char *tmpchptr;
-    const char *tmptarptr;
+    const char *refptr;
+    const char *tstptr;
     int len = 0;
     int offset;
+    const char *result = NULL;
 
-    if (!(chptr && tarptr))
-	return (NULL);
+    if (haystack != NULL && needle != NULL) {
 
-    /*
-     * Skip initial IsSpecial chars.  - FM
-     */
-    while (IsSpecialAttrChar(*chptr) && *chptr != '\0')
-	chptr++;
+	SkipSpecialChars(haystack);
 
-    /*
-     * Seek a first target match.  - FM
-     */
-    for (; *chptr != '\0'; chptr++) {
-	if ((*chptr) == (*tarptr)) {
-	    int tarlen = 0;
+	for (; *haystack != '\0' && (result == NULL); haystack++) {
+	    if ((*haystack) == (*needle)) {
+		int tarlen = 0;
 
-	    offset = len;
-	    len++;
+		offset = len;
+		len++;
 
-	    /*
-	     * See if they line up.
-	     */
-	    tmpchptr = (chptr + 1);
-	    tmptarptr = (tarptr + 1);
+		refptr = (haystack + 1);
+		tstptr = (needle + 1);
 
-	    if (*tmptarptr == '\0') {
-		/*
-		 * One char target.
-		 */
-		if (nstartp)
-		    *nstartp = offset;
-		if (nendp)
-		    *nendp = len;
-		return (chptr);
-	    }
-	    if (!utf_flag && IS_CJK_TTY && is8bits(*chptr) &&
-		IsNormalChar(*tmpchptr)) {
-		/*
-		 * Check the CJK multibyte.  - FM
-		 */
-		if (*tmpchptr == *tmptarptr) {
-		    /*
-		     * It's a match.  Advance to next char.  - FM
-		     */
-		    tmpchptr++;
-		    tmptarptr++;
-		    if (count_gcells)
-			tarlen++;
-		    if (*tmptarptr == '\0') {
-			/*
-			 * One character match.  - FM
-			 */
-			if (nstartp)
-			    *nstartp = offset;
-			if (nendp)
-			    *nendp = len + tarlen;
-			return (chptr);
+		if (*tstptr == '\0') {
+		    if (nstartp)
+			*nstartp = offset;
+		    if (nendp)
+			*nendp = len;
+		    result = haystack;
+		    break;
+		} else if (!utf_flag &&
+			   IS_CJK_TTY &&
+			   is8bits(*haystack) &&
+			   IsNormalChar(*refptr)) {
+		    /* handle a CJK multibyte string */
+		    if (*refptr == *tstptr) {
+			/* found match */
+			refptr++;
+			tstptr++;
+			if (count_gcells)
+			    tarlen++;
+			if (*tstptr == '\0') {
+			    if (nstartp)
+				*nstartp = offset;
+			    if (nendp)
+				*nendp = len + tarlen;
+			    result = haystack;
+			    break;
+			}
+		    } else {
+			/* not a match - restart comparison */
+			haystack++;
+			if (count_gcells)
+			    len++;
+			continue;
 		    }
-		} else {
-		    /*
-		     * It's not a match, so go back to seeking a first target
-		     * match.  - FM
-		     */
-		    chptr++;
-		    if (count_gcells)
-			len++;
-		    continue;
 		}
-	    }
-	    /*
-	     * See if the rest of the target matches.  - FM
-	     */
-	    while (1) {
-		if (!IsSpecialAttrChar(*tmpchptr)) {
-		    if (!utf_flag && IS_CJK_TTY && is8bits(*tmpchptr)) {
-			if (*tmpchptr == *tmptarptr &&
-			    *(tmpchptr + 1) == *(tmptarptr + 1) &&
-			    !IsSpecialAttrChar(*(tmpchptr + 1))) {
-			    tmpchptr++;
-			    tmptarptr++;
-			    if (count_gcells)
-				tarlen++;
-			} else {
+		/* compare the remainder of the string */
+		while (1) {
+		    if (!IsSpecialAttrChar(*refptr)) {
+			if (!utf_flag && IS_CJK_TTY && is8bits(*refptr)) {
+			    if (*refptr == *tstptr &&
+				*(refptr + 1) == *(tstptr + 1) &&
+				!IsSpecialAttrChar(*(refptr + 1))) {
+				refptr++;
+				tstptr++;
+				if (count_gcells)
+				    tarlen++;
+			    } else {
+				break;
+			    }
+			} else if ((*refptr) != (*tstptr)) {
 			    break;
 			}
-		    } else if ((*tmpchptr) != (*tmptarptr)) {
-			break;
+
+			if (!IS_UTF_EXTRA(*tstptr)) {
+			    tarlen++;
+			}
+			refptr++;
+			tstptr++;
+		    } else {
+			refptr++;
 		    }
 
-		    if (!IS_UTF_EXTRA(*tmptarptr)) {
-			tarlen++;
+		    if (*tstptr == '\0') {
+			if (nstartp)
+			    *nstartp = offset;
+			if (nendp)
+			    *nendp = len + tarlen;
+			result = haystack;
+			break;
 		    }
-		    tmpchptr++;
-		    tmptarptr++;
-		} else {
-		    tmpchptr++;
+		    if (*refptr == '\0')
+			break;
 		}
-
-		if (*tmptarptr == '\0') {
-		    if (nstartp)
-			*nstartp = offset;
-		    if (nendp)
-			*nendp = len + tarlen;
-		    return (chptr);
+	    } else if (!(IS_UTF_EXTRA(*haystack) ||
+			 IsSpecialAttrChar(*haystack))) {
+		if (!utf_flag && IS_CJK_TTY && is8bits(*haystack) &&
+		    IsNormalChar(*(haystack + 1))) {
+		    haystack++;
+		    if (count_gcells)
+			len++;
 		}
-		if (*tmpchptr == '\0')
-		    break;
+		len++;
 	    }
-	} else if (!(IS_UTF_EXTRA(*chptr) ||
-		     IsSpecialAttrChar(*chptr))) {
-	    if (!utf_flag && IS_CJK_TTY && is8bits(*chptr) &&
-		IsNormalChar(*(chptr + 1))) {
-		chptr++;
-		if (count_gcells)
-		    len++;
-	    }
-	    len++;
 	}
-    }				/* end for */
-
-    return (NULL);
+    }
+    return (result);
 }
 
 /*
- * Allocate a new copy of a string, and returns it.
+ * Allocate and return a copy of a string.
+ * see StrAllocCopy
  */
-char *SNACopy(char **dest,
-	      const char *src,
-	      int n)
+char *SNACopy(char **target,
+	      const char *source,
+	      size_t n)
 {
-    FREE(*dest);
-    if (src) {
-	*dest = typeMallocn(char, (unsigned) n + 1);
+    FREE(*target);
+    if (source) {
+	*target = typeMallocn(char, n + 1);
 
-	if (*dest == NULL) {
-	    CTRACE((tfp, "Tried to malloc %d bytes\n", n));
+	if (*target == NULL) {
+	    CTRACE((tfp, "Tried to malloc %lu bytes\n", (unsigned long) n));
 	    outofmem(__FILE__, "SNACopy");
-	    assert(*dest != NULL);
+	    assert(*target != NULL);
 	}
-	LYStrNCpy(*dest, src, n);
+	LYStrNCpy(*target, source, n);
     }
-    return *dest;
+    return *target;
 }
 
 /*
- * String Allocate and Concatenate.
+ * Combinate string allocation and concatenation.
+ * see StrAllocCat
  */
-char *SNACat(char **dest,
-	     const char *src,
-	     int n)
+char *SNACat(char **target,
+	     const char *source,
+	     size_t n)
 {
-    if (non_empty(src)) {
-	if (*dest) {
-	    int length = (int) strlen(*dest);
+    if (non_empty(source)) {
+	if (*target) {
+	    size_t length = strlen(*target);
 
-	    *dest = typeRealloc(char, *dest, length + n + 1);
+	    *target = typeRealloc(char, *target, length + n + 1);
 
-	    if (*dest == NULL)
+	    if (*target == NULL)
 		outofmem(__FILE__, "SNACat");
-	    assert(*dest != NULL);
-	    LYStrNCpy(*dest + length, src, n);
+	    assert(*target != NULL);
+	    LYStrNCpy(*target + length, source, n);
 	} else {
-	    *dest = typeMallocn(char, (unsigned) n + 1);
+	    *target = typeMallocn(char, n + 1);
 
-	    if (*dest == NULL)
+	    if (*target == NULL)
 		outofmem(__FILE__, "SNACat");
-	    assert(*dest != NULL);
-	    MemCpy(*dest, src, n);
-	    (*dest)[n] = '\0';	/* terminate */
+	    assert(*target != NULL);
+	    MemCpy(*target, source, n);
+	    (*target)[n] = '\0';	/* terminate */
 	}
     }
-    return *dest;
+    return *target;
 }
 
 #include <caselower.h>
@@ -6007,33 +5947,32 @@ static long UniToLowerCase(long upper)
 {
     size_t i, high, low;
     long diff = 0;
+    long result = upper;
 
-    /*
-     * Make check for sure.
-     */
-    if (upper <= 0)
-	return (upper);
-
-    /*
-     * Try unicode_to_lower_case[].
-     */
-    low = 0;
-    high = TABLESIZE(unicode_to_lower_case);
-    while (low < high) {
+    if (upper > 0) {
 	/*
-	 * Binary search.
+	 * Try unicode_to_lower_case[].
 	 */
-	i = (low + (high - low) / 2);
-	diff = (unicode_to_lower_case[i].upper - upper);
-	if (diff < 0)
-	    low = i + 1;
-	if (diff > 0)
-	    high = i;
-	if (diff == 0)
-	    return (unicode_to_lower_case[i].lower);
+	low = 0;
+	high = TABLESIZE(unicode_to_lower_case);
+	while (low < high) {
+	    /*
+	     * Binary search.
+	     */
+	    i = (low + (high - low) / 2);
+	    diff = (unicode_to_lower_case[i].upper - upper);
+	    if (diff < 0) {
+		low = i + 1;
+	    } else if (diff > 0) {
+		high = i;
+	    } else if (diff == 0) {
+		result = unicode_to_lower_case[i].lower;
+		break;
+	    }
+	}
     }
 
-    return (upper);		/* if we came here */
+    return result;
 }
 
 /*
@@ -6051,35 +5990,38 @@ static long UniToLowerCase(long upper)
  */
 int UPPER8(int ch1, int ch2)
 {
-    /* if they are the same or one is a null characters return immediately. */
-    if (ch1 == ch2)
-	return 0;
-    if (!ch2)
-	return UCH(ch1);
-    else if (!ch1)
-	return -UCH(ch2);
-
-    /* case-insensitive match for us-ascii */
-    if (UCH(TOASCII(ch1)) < 128 && UCH(TOASCII(ch2)) < 128)
-	return (TOUPPER(ch1) - TOUPPER(ch2));
-
-    /* case-insensitive match for upper half */
-    if (UCH(TOASCII(ch1)) > 127 &&	/* S/390 -- gil -- 2066 */
-	UCH(TOASCII(ch2)) > 127) {
-	if (DisplayCharsetMatchLocale)
-	    return (TOUPPER(ch1) - TOUPPER(ch2));	/* old-style */
-	else {
+    int result = 0;
+
+    if (ch1 == ch2) {
+	result = 0;
+    } else if (!ch2) {
+	result = UCH(ch1);
+    } else if (!ch1) {
+	result = -UCH(ch2);
+    } else if (UCH(TOASCII(ch1)) < 128 && UCH(TOASCII(ch2)) < 128) {
+	/* case-insensitive match for us-ascii */
+	result = (TOUPPER(ch1) - TOUPPER(ch2));
+    } else if (UCH(TOASCII(ch1)) > 127 &&
+	       UCH(TOASCII(ch2)) > 127) {
+	/* case-insensitive match for upper half */
+	if (DisplayCharsetMatchLocale) {
+	    result = (TOUPPER(ch1) - TOUPPER(ch2));	/* old-style */
+	} else {
 	    long uni_ch2 = UCTransToUni((char) ch2, current_char_set);
 	    long uni_ch1;
 
-	    if (uni_ch2 < 0)
-		return UCH(ch1);
-	    uni_ch1 = UCTransToUni((char) ch1, current_char_set);
-	    return (int) (UniToLowerCase(uni_ch1) - UniToLowerCase(uni_ch2));
+	    if (uni_ch2 < 0) {
+		result = UCH(ch1);
+	    } else {
+		uni_ch1 = UCTransToUni((char) ch1, current_char_set);
+		result = (int) (UniToLowerCase(uni_ch1) - UniToLowerCase(uni_ch2));
+	    }
 	}
+    } else {
+	result = -10;		/* mismatch */
     }
 
-    return (-10);		/* mismatch, if we come to here */
+    return result;
 }
 
 /*
@@ -6087,14 +6029,14 @@ int UPPER8(int ch1, int ch2)
  * that is allocated.  When an EOF or error is found, the buffer is freed
  * automatically.
  */
-char *LYSafeGets(char **src,
+char *LYSafeGets(char **target,
 		 FILE *fp)
 {
     char buffer[BUFSIZ];
     char *result = 0;
 
-    if (src != 0)
-	result = *src;
+    if (target != 0)
+	result = *target;
     if (result != 0)
 	*result = 0;
 
@@ -6113,8 +6055,8 @@ char *LYSafeGets(char **src,
 	 */
 	FREE(result);
     }
-    if (src != 0)
-	*src = result;
+    if (target != 0)
+	*target = result;
     return result;
 }
 
diff --git a/src/LYStrings.h b/src/LYStrings.h
index a1cf0cd7..906c59a0 100644
--- a/src/LYStrings.h
+++ b/src/LYStrings.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYStrings.h,v 1.91 2013/10/12 00:06:34 tom Exp $
+ * $LynxId: LYStrings.h,v 1.110 2013/10/13 20:30:39 tom Exp $
  */
 #ifndef LYSTRINGS_H
 #define LYSTRINGS_H
@@ -53,13 +53,13 @@ extern "C" {
     extern int LYgetch_input(void);
     extern int LYgetch_single(void);
     extern int LYgetstr(char *inputline,
-			int hidden,
+			int masked,
 			size_t bufsize,
 			RecallType recall);
-#define LYGetStr(input,hidden,bufsize,recall) \
-	LYgetstr(input,hidden,(size_t)(bufsize),recall)
+#define LYGetStr(input,masked,bufsize,recall) \
+	LYgetstr(input,masked,(size_t)(bufsize),recall)
     extern int LYgetBString(bstring **inputline,
-			    int hidden,
+			    int masked,
 			    size_t max_cols,
 			    RecallType recall);
     extern int LYscanFloat(const char *source, float *result);
@@ -113,10 +113,10 @@ extern "C" {
 
     extern char *SNACopy(char **dest,
 			 const char *src,
-			 int n);
+			 size_t n);
     extern char *SNACat(char **dest,
 			const char *src,
-			int n);
+			size_t n);
 
 #define StrnAllocCopy(dest, src, n)  SNACopy (&(dest), src, n)
 #define StrnAllocCat(dest, src, n)   SNACat  (&(dest), src, n)
@@ -138,27 +138,44 @@ extern "C" {
 #endif
 
 /* values for LYgetch */
-/* The following are lynxkeycodes, not to be confused with
-   lynxactioncodes (LYK_*) to which they are often mapped.
-   The lynxkeycodes include all single-byte keys as a subset. - kw
-*/
-#define UPARROW		256	/* 0x100 */
-#define DNARROW		257	/* 0x101 */
-#define RTARROW		258	/* 0x102 */
-#define LTARROW		259	/* 0x103 */
-#define PGDOWN		260	/* 0x104 */
-#define PGUP		261	/* 0x105 */
-#define HOME		262	/* 0x106 */
-#define END_KEY		263	/* 0x107 */
-#define F1		264	/* 0x108 */
-#define DO_KEY		265	/* 0x109 */
-#define FIND_KEY	266	/* 0x10A */
-#define SELECT_KEY	267	/* 0x10B */
-#define INSERT_KEY	268	/* 0x10C */
-#define REMOVE_KEY	269	/* 0x10D */
-#define DO_NOTHING	270	/* 0x10E */
-#define BACKTAB_KEY	271	/* 0x10F */
-#define MOUSE_KEY	285	/* 0x11D */
+    /* The following are lynxkeycodes, not to be confused with
+     * lynxactioncodes (LYK_*) to which they are often mapped.
+     * The lynxkeycodes include all single-byte keys as a subset.
+     * These are "extra" keys which do not fit into a single byte.
+     */
+    typedef enum {
+	UPARROW_KEY = 256
+	,DNARROW_KEY
+	,RTARROW_KEY
+	,LTARROW_KEY
+	,PGDOWN_KEY
+	,PGUP_KEY
+	,HOME_KEY
+	,END_KEY
+	,F1_KEY
+	,DO_KEY
+	,FIND_KEY
+	,SELECT_KEY
+	,INSERT_KEY
+	,REMOVE_KEY
+	,DO_NOTHING
+	,BACKTAB_KEY
+	/* these should be referenced by name in keymap, e.g., "f2" */
+	,F2_KEY
+	,F3_KEY
+	,F4_KEY
+	,F5_KEY
+	,F6_KEY
+	,F7_KEY
+	,F8_KEY
+	,F9_KEY
+	,F10_KEY
+	,F11_KEY
+	,F12_KEY
+	/* this has known value */
+	,MOUSE_KEY = 285	/* 0x11D */
+    } LYExtraKeys;
+
 /*  ***** NOTES: *****
     If you add definitions for new lynxkeycodes to the above list that need to
     be mapped to LYK_* lynxactioncodes -
@@ -175,7 +192,7 @@ extern "C" {
       documented in lynx.cfg.
 
     - The DOS port uses its own native codes for some keys, unless they are
-      remapped by the code in LYgetch().  See *.key files in docs/ directory. 
+      remapped by the code in LYgetch().  See *.key files in docs/ directory.
       Adding new keys here may conflict with those codes (affecting DOS users),
       unless/until remapping is added or changed in LYgetch().  (N)curses
       keypad codes (KEY_* from curses.h) can also directly appear as
@@ -198,44 +215,42 @@ extern "C" {
 #  define FOR_PROMPT	3	/* string prompt editing */
 #  define FOR_SINGLEKEY	4	/* single key prompt, confirmation */
 
-#define VISIBLE  0
-#define HIDDEN   1
-
 #ifdef USE_ALT_BINDINGS
 /*  Enable code implementing additional, mostly emacs-like, line-editing
     functions. - kw */
 #define ENHANCED_LINEEDIT
 #endif
 
-/* EditFieldData preserves state between calls to LYEdit1
+/* FieldEditor preserves state between calls to LYDoEdit
  */
-    typedef struct _EditFieldData {
-
-	int sx;			/* Origin of editfield                       */
-	int sy;
-	int dspwdth;		/* Screen real estate for editing            */
-
-	size_t buffer_used;	/* current size of string.                   */
-	size_t buffer_size;	/* current buffer-size, excluding nul at end */
-	size_t buffer_limit;	/* buffer size limit, zero if indefinite     */
-	char pad;		/* Right padding  typically ' ' or '_'       */
-	BOOL hidden;		/* Masked password entry flag                */
-
-	BOOL dirty;		/* accumulate refresh requests               */
-	BOOL panon;		/* Need horizontal scroll indicator          */
-	int xpan;		/* Horizontal scroll offset                  */
-	int pos;		/* Insertion point in string                 */
-	int margin;		/* Number of columns look-ahead/look-back    */
-	int current_modifiers;	/* Modifiers for next input lynxkeycode */
+    typedef struct {
+
+	int efStartX;		/* Origin of edit-field                      */
+	int efStartY;
+	int efWidth;		/* Screen real estate for editing            */
+
+	char *efBuffer;		/* the buffer which is being edited */
+	size_t efBufInUse;	/* current size of string.                   */
+	size_t efBufAlloc;	/* current buffer-size, excluding nul at end */
+	size_t efBufLimit;	/* buffer size limit, zero if indefinite     */
+
+	char efPadChar;		/* Right padding  typically ' ' or '_'       */
+	BOOL efIsMasked;	/* Masked password entry flag                */
+
+	BOOL efIsDirty;		/* accumulate refresh requests               */
+	BOOL efIsPanned;	/* Need horizontal scroll indicator          */
+	int efDpyStart;		/* Horizontal scroll offset                  */
+	int efEditAt;		/* Insertion point in string                 */
+	int efPanMargin;	/* Number of columns look-ahead/look-back    */
+	int efInputMods;	/* Modifiers for next input lynxkeycode */
 #ifdef ENHANCED_LINEEDIT
-	int mark;		/* position of emacs-like mark, or -1-pos to denote
+	int efEditMark;		/* position of emacs-like mark, or -1-pos to denote
 				   unactive mark.  */
 #endif
 
-	char *buffer;		/* the buffer which is being edited */
-	int *offset2col;	/* fixups for multibyte characters */
+	int *efOffs2Col;	/* fixups for multibyte characters */
 
-    } EditFieldData;
+    } FieldEditor;
 
 /* line-edit action encoding */
 
@@ -311,48 +326,43 @@ extern "C" {
     extern int map_string_to_keysym(const char *src, int *lec);
 #endif
 
-    extern char *LYElideString(char *str,
-			       int cut_pos);
-    extern void LYEscapeStartfile(char **buffer);
-    extern void LYLowerCase(char *buffer);
-    extern void LYUpperCase(char *buffer);
+    extern BOOL LYRemapEditBinding(int xlkc, int lec, int select_edi);	/* in LYEditmap.c */
     extern BOOLEAN LYRemoveNewlines(char *buffer);
+    extern BOOLEAN LYTrimStartfile(char *buffer);
+    extern LYExtraKeys LYnameToExtraKeys(const char *name);
+    extern char *LYElideString(char *str, int cut_pos);
     extern char *LYReduceBlanks(char *buffer);
     extern char *LYRemoveBlanks(char *buffer);
     extern char *LYSkipBlanks(char *buffer);
     extern char *LYSkipNonBlanks(char *buffer);
+    extern char *LYTrimNewline(char *buffer);
     extern const char *LYSkipCBlanks(const char *buffer);
     extern const char *LYSkipCNonBlanks(const char *buffer);
-    extern void LYTrimLeading(char *buffer);
-    extern char *LYTrimNewline(char *buffer);
-    extern void LYTrimTrailing(char *buffer);
-    extern void LYTrimAllStartfile(char *buffer);
-    extern BOOLEAN LYTrimStartfile(char *buffer);
-    extern void LYFinishEdit(EditFieldData *edit);
-    extern void LYSetupEdit(EditFieldData *edit, char *old,
-			    size_t buffer_limit,
-			    int display_limit);
-    extern void LYRefreshEdit(EditFieldData *edit);
+    extern const char *LYextraKeysToName(LYExtraKeys code);
     extern int EditBinding(int ch);	/* in LYEditmap.c */
-    extern BOOL LYRemapEditBinding(int xlkc,
-				   int lec,
-				   int select_edi);	/* in LYEditmap.c */
-    extern int LYKeyForEditAction(int lec);	/* in LYEditmap.c */
+    extern int LYDoEdit(FieldEditor * edit, int ch, int action, int maxMessage);
     extern int LYEditKeyForAction(int lac, int *pmodkey);	/* LYEditmap.c */
-    extern int LYEdit1(EditFieldData *edit, int ch,
-		       int action,
-		       int maxMessage);
-    extern void LYCloseCloset(RecallType recall);
-    extern int LYhandlePopupList(int cur_choice,
-				 int ly,
-				 int lx,
+    extern int LYKeyForEditAction(int lec);	/* in LYEditmap.c */
+    extern int LYhandlePopupList(int cur_choice, int ly, int lx,
 				 STRING2PTR choices,
 				 int width,
 				 int i_length,
 				 int disabled,
 				 int for_mouse);
+    extern void LYCloseCloset(RecallType recall);
+    extern void LYEscapeStartfile(char **buffer);
+    extern void LYFinishEdit(FieldEditor * edit);
+    extern void LYLowerCase(char *buffer);
+    extern void LYRefreshEdit(FieldEditor * edit);
+    extern void LYSetupEdit(FieldEditor * edit, char *old,
+			    size_t buffer_limit,
+			    int display_limit);
+    extern void LYTrimAllStartfile(char *buffer);
+    extern void LYTrimLeading(char *buffer);
+    extern void LYTrimTrailing(char *buffer);
+    extern void LYUpperCase(char *buffer);
 
-    typedef unsigned short LYEditCode;
+    typedef short LYEditCode;
 
     typedef struct {
 	int code;
@@ -366,7 +376,7 @@ extern "C" {
     } LYEditConfig;
 
     extern int current_lineedit;
-    extern const char *LYLineeditNames[];
+    extern const char *LYEditorNames[];
     extern LYEditConfig LYLineEditors[];
     extern const char *LYLineeditHelpURLs[];
 
@@ -377,13 +387,12 @@ extern "C" {
 
     extern int escape_bound;
 
-#define LYLineEdit(e,c,m) LYEdit1(e, c, EditBinding(c) & ~LYE_DF, m)
+#define LYLineEdit(e,c,m) LYDoEdit(e, c, EditBinding(c) & ~LYE_DF, m)
 
 /* Dummy initializer for LYEditmap.c */
     extern int LYEditmapDeclared(void);
 
-    extern int LYEditInsert(EditFieldData *edit,
-			    unsigned const char *s,
+    extern int LYEditInsert(FieldEditor * edit, unsigned const char *s,
 			    int len, int map_active,
 			    int maxMessage);
 
diff --git a/src/LYUpload.c b/src/LYUpload.c
index 1321ece0..b65c0e12 100644
--- a/src/LYUpload.c
+++ b/src/LYUpload.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYUpload.c,v 1.38 2013/05/03 10:53:50 tom Exp $
+ * $LynxId: LYUpload.c,v 1.39 2013/10/12 14:52:04 tom Exp $
  *
  *  Routines to upload files to the local filesystem.
  *  Created by: Rick Mallett, Carleton University
@@ -88,7 +88,7 @@ int LYUpload(char *line)
 	_statusline(FILENAME_PROMPT);
       retry:
 	*tmpbuf = '\0';
-	if (LYGetStr(tmpbuf, VISIBLE, sizeof(tmpbuf), NORECALL) < 0)
+	if (LYGetStr(tmpbuf, FALSE, sizeof(tmpbuf), NORECALL) < 0)
 	    goto cancelled;
 
 	if (*tmpbuf == '\0')
diff --git a/src/LYUtils.c b/src/LYUtils.c
index ea645abe..856cd41f 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYUtils.c,v 1.244 2013/10/10 23:30:08 tom Exp $
+ * $LynxId: LYUtils.c,v 1.251 2013/10/13 20:23:07 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTCP.h>
@@ -3544,28 +3544,28 @@ int number2arrows(int number)
 	number = END_KEY;
 	break;
     case '2':
-	number = DNARROW;
+	number = DNARROW_KEY;
 	break;
     case '3':
-	number = PGDOWN;
+	number = PGDOWN_KEY;
 	break;
     case '4':
-	number = LTARROW;
+	number = LTARROW_KEY;
 	break;
     case '5':
 	number = DO_NOTHING;
 	break;
     case '6':
-	number = RTARROW;
+	number = RTARROW_KEY;
 	break;
     case '7':
-	number = HOME;
+	number = HOME_KEY;
 	break;
     case '8':
-	number = UPARROW;
+	number = UPARROW_KEY;
 	break;
     case '9':
-	number = PGUP;
+	number = PGUP_KEY;
 	break;
     }
 
diff --git a/src/LYrcFile.c b/src/LYrcFile.c
index 67126ed0..f34e4fa7 100644
--- a/src/LYrcFile.c
+++ b/src/LYrcFile.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYrcFile.c,v 1.90 2012/11/14 01:06:06 tom Exp $ */
+/* $LynxId: LYrcFile.c,v 1.91 2013/10/12 13:06:01 tom Exp $ */
 #include <HTUtils.h>
 #include <HTFTP.h>
 #include <LYUtils.h>
@@ -434,7 +434,7 @@ file lists such as FTP directories.  The options are:\n\
     PARSE_ARY(RC_KBLAYOUT,              current_layout,     LYKbLayoutNames, NULL),
 #endif
     PARSE_ENU(RC_KEYPAD_MODE,           keypad_mode,        tbl_keypad_mode, NULL),
-    PARSE_ARY(RC_LINEEDIT_MODE,         current_lineedit,   LYLineeditNames, N_("\
+    PARSE_ARY(RC_LINEEDIT_MODE,         current_lineedit,   LYEditorNames, N_("\
 lineedit_mode specifies the key binding used for inputting strings in\n\
 prompts and forms.  If lineedit_mode is set to \"Default Binding\" then\n\
 the following control characters are used for moving and deleting:\n\
diff --git a/src/makefile.in b/src/makefile.in
index a18b6537..3c797293 100644
--- a/src/makefile.in
+++ b/src/makefile.in
@@ -1,4 +1,4 @@
-# $LynxId: makefile.in,v 1.69 2012/08/12 23:54:35 tom Exp $
+# $LynxId: makefile.in,v 1.70 2013/10/13 22:58:41 tom Exp $
 # template-makefile for Lynx src directory
 
 SHELL		= @CONFIG_SHELL@
@@ -155,7 +155,7 @@ LYUtils$o :		$(top_srcdir)/userdefs.h
 LYmktime$o :		$(top_srcdir)/userdefs.h
 LYrcFile$o :		$(top_srcdir)/userdefs.h
 
-LYIcon$o:
+LYIcon$o: LYIcon.rc 
 	$(WINDRES) -i LYIcon.rc -o LYIcon$o -O coff
 
 CHRTR= chrtrans/
diff --git a/src/tidy_tls.c b/src/tidy_tls.c
index 7b94ae74..6e671c99 100644
--- a/src/tidy_tls.c
+++ b/src/tidy_tls.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: tidy_tls.c,v 1.15 2013/10/01 20:56:17 tom Exp $
+ * $LynxId: tidy_tls.c,v 1.16 2013/10/14 00:13:37 tom Exp $
  * Copyright 2008-2011,2013 Thomas E. Dickey
  * with fix Copyright 2008 by Thomas Viehmann
  *
@@ -219,8 +219,9 @@ SSL_CTX *SSL_CTX_new(SSL_METHOD * method)
 {
     SSL_CTX *ctx;
 
-    ctx = typeCalloc(SSL_CTX);
-    ctx->method = method;
+    if ((ctx = typeCalloc(SSL_CTX)) != 0) {
+	ctx->method = method;
+    }
 
     return ctx;
 }
@@ -430,6 +431,9 @@ int SSL_connect(SSL * ssl)
     }
 
     store = typeCalloc(X509_STORE_CTX);
+    if (store == 0)
+	outofmem(__FILE__, "SSL_connect");
+
     store->ssl = ssl;
     store->cert_list = SSL_get_peer_certificate(ssl);