lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev patch that allows text inputs to be non-sticky


From: Vlad Harchev
Subject: lynx-dev patch that allows text inputs to be non-sticky
Date: Mon, 26 Jul 1999 21:03:23 +0500 (SAMST)

* Added ability to make text inputs non-sticky (ie user will need to activate
  them explicitly via and LYK_ACTIVATE action) - seems useful for people
  navigating with alphanumeric keys. Default is 'sticky' - ie old behaviour.
  Behaviour controlled via commandline option '--sticky-inputs' and
  STICKY_INPUTS in lynx.cfg.

* Added conditionals to 'userdefs.h' that disable support for
  force-empty-hrefless-a mode if lynx is configured without lss (it's unuseful
  for such setup)

Notes:
1) A hunk may fail in userdefs.h since I added '#define EXP_JUSTIFY_ELTS' to
 it in my setup. Fix it (ie add this define  :-) before applying.
2) lynx.hlp must be regenerated.


 Best regards,
  -Vlad

diff -ru lynx2-8-3dev4-fixed-old/lynx.cfg lynx2-8-3dev4-fixed/lynx.cfg
--- lynx2-8-3dev4-fixed-old/lynx.cfg    Thu Jul 15 09:50:46 1999
+++ lynx2-8-3dev4-fixed/lynx.cfg        Mon Jul 26 20:41:32 1999
@@ -2226,3 +2226,13 @@
 # has no influence on CJK text rendering.
 #
 #JUSTIFY:TRUE
+
+# STICKY_INPUTS - Input
+# This option controls whether all text inputs are sticky. If input is not 
+# sticky, then it won't intercept any keyboard input until user activated it
+# (as usual link). Making inputs non-sticky can be desired for users that 
+# actively use alphanumeric keys for navigation (as ' ','b', INS, DEL, etc).
+# Default is TRUE - ie all inputs are sticky, this is old lynx behaviour.
+#
+#STICKY_INPUTS:TRUE
+ 
\ No newline at end of file
diff -ru lynx2-8-3dev4-fixed-old/lynx.man lynx2-8-3dev4-fixed/lynx.man
--- lynx2-8-3dev4-fixed-old/lynx.man    Thu Jul 15 09:50:46 1999
+++ lynx2-8-3dev4-fixed/lynx.man        Mon Jul 26 20:45:22 1999
@@ -540,6 +540,9 @@
 .B -startfile_ok
 allow non-http startfile and homepage with -validate.
 .TP
+.B -sticky_inputs
+don't require activating inputs in order to edit them.
+.TP
 .B -tagsoup
 initialize parser, using Tag Soup DTD rather than SortaSGML.
 .TP
diff -ru lynx2-8-3dev4-fixed-old/src/HTForms.h lynx2-8-3dev4-fixed/src/HTForms.h
--- lynx2-8-3dev4-fixed-old/src/HTForms.h       Fri Jun 11 14:34:08 1999
+++ lynx2-8-3dev4-fixed/src/HTForms.h   Mon Jul 26 19:11:52 1999
@@ -6,11 +6,21 @@
 #endif /* LYSTRUCTS_H */
 
 /* in LYForms.c */
+
+/* change_form_link calls change_form_link_ex with all its args and FALSE as 
+  last arg */
 extern int change_form_link PARAMS((struct link *form_link,
                                     document *newdoc, BOOLEAN *refresh_screen,
                                    char *link_name, char *link_value,
                                    BOOLEAN use_last_tfpos,
                                    BOOLEAN immediate_submit));
+
+extern int change_form_link_ex PARAMS((struct link *form_link,
+                                    document *newdoc, BOOLEAN *refresh_screen,
+                                   char *link_name, char *link_value,
+                                   BOOLEAN use_last_tfpos,
+                                   BOOLEAN immediate_submit,
+                                   BOOLEAN draw_only));
 
 /* InputFieldData is used to pass the info between
  * HTML.c and Gridtext.c in HText_beginInput()
diff -ru lynx2-8-3dev4-fixed-old/src/LYForms.c lynx2-8-3dev4-fixed/src/LYForms.c
--- lynx2-8-3dev4-fixed-old/src/LYForms.c       Thu Jul 15 09:50:48 1999
+++ lynx2-8-3dev4-fixed/src/LYForms.c   Mon Jul 26 19:22:34 1999
@@ -24,7 +24,8 @@
 
 PRIVATE int form_getstr PARAMS((
        struct link *   form_link,
-       BOOLEAN         use_last_tfpos));
+       BOOLEAN         use_last_tfpos,
+       BOOLEAN         redraw_only));
 PRIVATE int popup_options PARAMS((
        int             cur_selection,
        OptionType *    list,
@@ -34,14 +35,16 @@
        int             i_length,
        int             disabled));
 
-PUBLIC int change_form_link ARGS7(
+
+PUBLIC int change_form_link_ex ARGS8(
        struct link *,  form_link,
        document *,     newdoc,
        BOOLEAN *,      refresh_screen,
        char *,         link_name,
        char *,         link_value,
        BOOLEAN,        use_last_tfpos,
-       BOOLEAN,        immediate_submit)
+       BOOLEAN,        immediate_submit,
+       BOOLEAN,        redraw_only)
 {
     FormInfo *form = form_link->form;
     int newdoc_changed = 0;
@@ -179,7 +182,7 @@
        case F_TEXT_TYPE:
        case F_TEXTAREA_TYPE:
        case F_PASSWORD_TYPE:
-           c = form_getstr(form_link, use_last_tfpos);
+           c = form_getstr(form_link, use_last_tfpos,redraw_only);
            if (form->type == F_PASSWORD_TYPE)
                form_link->hightext = STARS(strlen(form->value));
            else
@@ -194,8 +197,12 @@
            break;
 
        case F_TEXT_SUBMIT_TYPE:
+           if (redraw_only) {
+               c = form_getstr(form_link, use_last_tfpos,TRUE);            
+               break;
+           };
            if (!immediate_submit)
-               c = form_getstr(form_link, use_last_tfpos);
+               c = form_getstr(form_link, use_last_tfpos,FALSE);
            if (form->disabled == YES &&
                (c == '\r' || c == '\n' || immediate_submit)) {
                if (peek_mouse_link() >= 0)
@@ -300,6 +307,20 @@
     return(c);
 }
 
+PUBLIC int change_form_link ARGS7(
+       struct link *,  form_link,
+       document *,     newdoc,
+       BOOLEAN *,      refresh_screen,
+       char *,         link_name,
+       char *,         link_value,
+       BOOLEAN,        use_last_tfpos,
+       BOOLEAN,        immediate_submit)
+{
+    /*pass all our args and FALSE as last arg*/
+    return change_form_link_ex(form_link,newdoc,refresh_screen,link_name,
+       link_value,use_last_tfpos,immediate_submit, FALSE /*redraw_only*/ );
+};
+
 PRIVATE int LastTFPos = -1;    /* remember last text field position */
 
 PRIVATE void LYSetLastTFPos ARGS1(
@@ -314,9 +335,10 @@
 }
 #endif /* 0 */
 
-PRIVATE int form_getstr ARGS2(
+PRIVATE int form_getstr ARGS3(
        struct link *,  form_link,
-       BOOLEAN,        use_last_tfpos)
+       BOOLEAN,        use_last_tfpos,
+       BOOLEAN,        redraw_only)
 {
     FormInfo *form = form_link->form;
     char *value = form->value;
@@ -413,7 +435,9 @@
            MyEdit.pos = 0;
     }
     LYRefreshEdit(&MyEdit);
-
+    if (redraw_only) 
+       return 0;/*return value won't be analysed*/     
+    
     /*
      *  And go for it!
      */
diff -ru lynx2-8-3dev4-fixed-old/src/LYGlobalDefs.h 
lynx2-8-3dev4-fixed/src/LYGlobalDefs.h
--- lynx2-8-3dev4-fixed-old/src/LYGlobalDefs.h  Thu Jul 15 09:50:48 1999
+++ lynx2-8-3dev4-fixed/src/LYGlobalDefs.h      Mon Jul 26 20:25:50 1999
@@ -398,6 +398,12 @@
 extern BOOL force_empty_hrefless_a;
 #endif
 
+#ifndef NO_NONSTICKY_INPUTS
+extern BOOL sticky_inputs;
+extern BOOL textarea_drawn; 
+#endif
+
+
 #ifndef VMS
 extern BOOLEAN LYNoCore;
 extern BOOLEAN restore_sigpipe_for_children;
diff -ru lynx2-8-3dev4-fixed-old/src/LYMain.c lynx2-8-3dev4-fixed/src/LYMain.c
--- lynx2-8-3dev4-fixed-old/src/LYMain.c        Thu Jul 15 09:50:48 1999
+++ lynx2-8-3dev4-fixed/src/LYMain.c    Mon Jul 26 20:48:00 1999
@@ -443,6 +443,10 @@
 PUBLIC BOOL force_empty_hrefless_a = FALSE;
 #endif
 
+#ifndef NO_NONSTICKY_INPUTS
+PUBLIC BOOL sticky_inputs = TRUE;
+#endif
+
 #ifdef DISP_PARTIAL
 PUBLIC BOOLEAN display_partial_flag = TRUE; /* Display document during 
download */
 PUBLIC BOOLEAN debug_display_partial = FALSE; /* Show with MessageSecs delay */
@@ -3266,6 +3270,12 @@
       "startfile_ok",  SET_ARG,                &startfile_ok,
       "allow non-http startfile and homepage with -validate"
    ),
+#ifndef NO_NONSTICKY_INPUTS
+   PARSE_SET(
+      "sticky_inputs", SET_ARG,                &sticky_inputs,
+      "don't require activating inputs in order to edit them"
+   ),
+#endif
 #ifndef VMS
 #ifdef SYSLOG_REQUESTED_URLS
    PARSE_STR(
diff -ru lynx2-8-3dev4-fixed-old/src/LYMainLoop.c 
lynx2-8-3dev4-fixed/src/LYMainLoop.c
--- lynx2-8-3dev4-fixed-old/src/LYMainLoop.c    Thu Jul 15 09:50:48 1999
+++ lynx2-8-3dev4-fixed/src/LYMainLoop.c        Mon Jul 26 20:29:02 1999
@@ -199,6 +199,12 @@
 PRIVATE char *traversal_host = NULL;
 PRIVATE char *traversal_link_to_add = NULL;
 
+#ifndef NO_NONSTICKY_INPUTS
+PRIVATE BOOL textarea_activated = FALSE;
+PUBLIC BOOL textarea_drawn = FALSE; 
+    /*must be public since used in highlight(..)*/
+#endif
+
 #ifdef LY_FIND_LEAKS
 /*
  *  Function for freeing allocated mainloop() variables. - FM
@@ -1453,7 +1459,9 @@
         *  All display_partial calls ends here for final redraw.
         */
        if (curdoc.line != Newline) {
-
+#ifndef NO_NONSTICKY_INPUTS
+           textarea_drawn = FALSE;
+#endif
            refresh_screen = FALSE;
 
            HText_pageDisplay(Newline, prev_target);
@@ -1644,11 +1652,12 @@
        if (!(nlinks > 0 &&
              links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
              (links[curdoc.link].form->type == F_TEXT_TYPE ||
-              links[curdoc.link].form->type == F_TEXTAREA_TYPE)))
+              links[curdoc.link].form->type == F_TEXTAREA_TYPE))) {
             /*
              *  Highlight current link.
              */
            highlight(ON, curdoc.link, prev_target);
+       };
 
        if (traversal) {
            /*
@@ -1688,6 +1697,9 @@
             *  Normal, non-traversal handling.
             */
            if (nlinks > 0 &&
+#ifndef NO_NONSTICKY_INPUTS
+               (textarea_activated || !textarea_drawn) &&
+#endif
                links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
                (links[curdoc.link].form->type == F_TEXT_TYPE ||
                 links[curdoc.link].form->type == F_TEXT_SUBMIT_TYPE ||
@@ -1695,7 +1707,24 @@
                 links[curdoc.link].form->type == F_TEXTAREA_TYPE)) {
 
                BOOLEAN use_last_tfpos;
-               /*
+               use_last_tfpos = (real_cmd==LYK_LPOS_PREV_LINK ||
+                                 real_cmd==LYK_LPOS_NEXT_LINK);                
+               
+#ifndef NO_NONSTICKY_INPUTS
+               if (!sticky_inputs && !textarea_activated) {
+                   /*draw the text entry, but don't activate it*/
+                   change_form_link_ex(&links[curdoc.link],
+                                    &newdoc, &refresh_screen,
+                                    links[curdoc.link].form->name,
+                                     links[curdoc.link].form->value,
+                                     use_last_tfpos, FALSE, TRUE);
+                   c = DO_NOTHING;
+                   textarea_drawn = TRUE;                  
+               } else 
+#endif         
+               {
+               
+               /*              
                 *  Replace novice lines if in NOVICE_MODE.
                 */
                if (user_mode==NOVICE_MODE) {
@@ -1704,13 +1733,15 @@
                    move(LYlines-1,0); clrtoeol();
                    addstr(FORM_NOVICELINE_TWO);
                }
-               use_last_tfpos = (real_cmd==LYK_LPOS_PREV_LINK ||
-                                 real_cmd==LYK_LPOS_NEXT_LINK);
                real_c = change_form_link(&links[curdoc.link],
                                     &newdoc, &refresh_screen,
                                     links[curdoc.link].form->name,
                                          links[curdoc.link].form->value,
                                          use_last_tfpos, FALSE);
+#ifndef NO_NONSTICKY_INPUTS                
+               textarea_activated = FALSE; 
+               textarea_drawn = FALSE;
+#endif             
 
                c = (real_c==LKC_DONE) ? DO_NOTHING : LKC_TO_C(real_c);
                if (c != DO_NOTHING &&
@@ -1781,6 +1812,11 @@
                                        --newdoc.link;
                                    newdoc.link++;
                            }
+#ifndef NO_NONSTICKY_INPUTS
+                           textarea_activated = TRUE;
+                           textarea_drawn = FALSE;
+#endif
+                           
                        }
                   }
 #endif /* AUTOGROW */
@@ -1794,9 +1830,11 @@
                    c = LAC_TO_LKC0(LYK_NEXT_LINK);
                    break;
                default:
+
                    if (old_c != c && old_c != real_c && c != real_c)
                        real_c = c;
                }
+               } /*  !(!sticky_inputs && !textarea_activated)*/
            } else {
                /*
                 *  Get a keystroke from the user.
@@ -3279,6 +3317,17 @@
 
        case LYK_ACTIVATE:      /* follow a link */
        case LYK_SUBMIT:        /* follow a link, submit TEXT_SUBMIT input */
+#ifndef NO_NONSTICKY_INPUTS    
+           if (nlinks > 0 &&
+               links[curdoc.link].type == WWW_FORM_LINK_TYPE &&
+               (links[curdoc.link].form->type == F_TEXT_TYPE ||
+                links[curdoc.link].form->type == F_TEXT_SUBMIT_TYPE ||
+                links[curdoc.link].form->type == F_PASSWORD_TYPE ||
+                links[curdoc.link].form->type == F_TEXTAREA_TYPE)) {
+                textarea_activated = TRUE;
+                break;
+           };
+#endif                 
            if (do_change_link(prev_target) == -1) {
                LYforce_no_cache = FALSE;
                reloading = FALSE;
diff -ru lynx2-8-3dev4-fixed-old/src/LYReadCFG.c 
lynx2-8-3dev4-fixed/src/LYReadCFG.c
--- lynx2-8-3dev4-fixed-old/src/LYReadCFG.c     Thu Jul 15 09:50:49 1999
+++ lynx2-8-3dev4-fixed/src/LYReadCFG.c Mon Jul 26 20:35:56 1999
@@ -1224,6 +1224,9 @@
      PARSE_SET("source_cache", CONF_FUN, source_cache_fun),
 #endif
      PARSE_STR("startfile", CONF_STR, &startfile),
+#ifndef NO_NONSTICKY_INPUTS     
+     PARSE_SET("sticky_inputs", CONF_BOOL, &sticky_inputs),     
+#endif     
      PARSE_SET("strip_dotdot_urls", CONF_BOOL, &LYStripDotDotURLs),
      PARSE_SET("substitute_underscores", CONF_BOOL, &use_underscore),
      PARSE_FUN("suffix", CONF_FUN, suffix_fun),
diff -ru lynx2-8-3dev4-fixed-old/src/LYUtils.c lynx2-8-3dev4-fixed/src/LYUtils.c
--- lynx2-8-3dev4-fixed-old/src/LYUtils.c       Thu Jul 15 09:50:49 1999
+++ lynx2-8-3dev4-fixed/src/LYUtils.c   Mon Jul 26 20:27:24 1999
@@ -145,6 +145,10 @@
      */
     if (cur < 0)
        cur = 0;
+#ifndef NO_NONSTICKY_INPUTS    
+    if (flag == OFF)
+       textarea_drawn = FALSE;
+#endif
 
     if (nlinks > 0) {
 #if  defined(USE_COLOR_STYLE) && !defined(NO_HILIT_FIX)
diff -ru lynx2-8-3dev4-fixed-old/userdefs.h lynx2-8-3dev4-fixed/userdefs.h
--- lynx2-8-3dev4-fixed-old/userdefs.h  Thu Jul 15 10:07:27 1999
+++ lynx2-8-3dev4-fixed/userdefs.h      Mon Jul 26 20:52:01 1999
@@ -1528,6 +1528,11 @@
  * This ends the section specific to anonymous accounts.
  */
 
+#ifndef USE_COLOR_STYLE
+    /*it's useless for such setup*/
+#  define NO_EMPTY_HREFLESS_A
+#endif
+
 #define EXP_JUSTIFY_ELTS
 
 #endif /* USERDEFS_H */


reply via email to

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