texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Gavin D. Smith
Date: Sun, 11 Feb 2024 07:47:32 -0500 (EST)

branch: master
commit 23484417ebcb4b3701623004d284850383a15900
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Feb 11 12:47:20 2024 +0000

    Avoid "M-x set-variable RET highlight-searches" inconsistency
    
    * info/variables.c (set_variable_to_value, update_highlight_searches):
    Split out code updating match_rendition.  Do not do anything if
    it is already set to a non-zero value.  This avoids an inconsistency
    with M-x set-variable, where selecting the default value "On" by
    just pressing Return did nothing, while typing in "On" and
    pressing Return would switch to using the "standout" style.
---
 ChangeLog        | 11 +++++++++++
 info/variables.c | 32 ++++++++++++++++++++------------
 2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b56f64e74c..fe360b9a19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-02-11  Gavin Smith <gavinsmith0123@gmail.com>
+
+       Avoid "M-x set-variable RET highlight-searches" inconsistency
+
+       * info/variables.c (set_variable_to_value, update_highlight_searches):
+       Split out code updating match_rendition.  Do not do anything if
+       it is already set to a non-zero value.  This avoids an inconsistency
+       with M-x set-variable, where selecting the default value "On" by
+       just pressing Return did nothing, while typing in "On" and
+       pressing Return would switch to using the "standout" style.
+
 2024-02-11  Gavin Smith <gavinsmith0123@gmail.com>
 
        * info/variables.c (set_variable): Split out code getting the
diff --git a/info/variables.c b/info/variables.c
index 3b270d871b..85f4c74ae2 100644
--- a/info/variables.c
+++ b/info/variables.c
@@ -479,6 +479,25 @@ update_rendition_from_string (RENDITION *rendition, char 
*value)
   rendition->value = rendition_value;
 }
 
+static void
+update_highlight_searches (char *value)
+{
+  if (strcmp (on_off_choices[1], value) == 0)
+    {
+      /* Only use match-rendition=standout if not already defined. */
+      if (!match_rendition.mask)
+        {
+          match_rendition.mask = STANDOUT_MASK;
+          match_rendition.value = STANDOUT_MASK;
+        }
+    }
+  else
+    {
+      match_rendition.mask = 0;
+      match_rendition.value = 0;
+    }
+}
+
 /* VALUE is a string that is the value of the variable specified
    by the user.  Update our internal data structure VAR using this
    information. */
@@ -494,20 +513,9 @@ set_variable_to_value (VARIABLE_ALIST *var, char *value, 
int where)
     {
       register int j;
 
-      /* "highlight-searches=On" is equivalent to
-         "match-rendition=standout". */
       if (var->value == &highlight_searches)
         {
-          if (strcmp (on_off_choices[0], value) == 0)
-            {
-              match_rendition.mask = 0;
-              match_rendition.value = 0;
-            }
-          else
-            {
-              match_rendition.mask = STANDOUT_MASK;
-              match_rendition.value = STANDOUT_MASK;
-            }
+          update_highlight_searches (value);
         }
       else if (var->choices != (char **) &rendition_choices)
         {



reply via email to

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