Skip to content

Tell users of the feature/redrawhook branch to switch back to master #655

@danielshahaf

Description

@danielshahaf
Member

(Context: we've received multiple support questions which were resolved by having the user switch to the feature/redrawhook branch, e.g., #654.)

After merging feature/redrawhook, arrange for users of that branch to see a message "You may switch back to master".

Activity

added this to the 0.8.0 milestone on Jan 3, 2020
danielshahaf

danielshahaf commented on Jul 15, 2020

@danielshahaf
MemberAuthor

Proposed patch:

diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh
index 3608203..f01da13 100644
--- a/zsh-syntax-highlighting.zsh
+++ b/zsh-syntax-highlighting.zsh
@@ -589,6 +589,20 @@ if (( $+X_ZSH_HIGHLIGHT_DIRS_BLACKLIST )); then
   unset X_ZSH_HIGHLIGHT_DIRS_BLACKLIST
 fi
 
+# Tell users of this branch (feature/redrawhook) to switch back to master.
+#
+# We don't want to nag them on every new shell, because that would be annoying.
+# We can't nag them once and never again, because we can't keep state.
+# Therefore, compromise: warn infrequently.
+#
+# Magic number: 63 is one less than a power of two.
+if (( (RANDOM & 63) == 42 )); then
+  print -r -- $'zsh-syntax-highlighting: You are using the feature/redrawhook branch.'
+  print -r -- $'zsh-syntax-highlighting: That branch has been merged to master and will not receive any further commits.'
+  print -r --  "zsh-syntax-highlighting: Consider switching ${(qq)0:h} back to the 'master' branch."
+fi
+
+
 # Restore the aliases we unned
 eval "$zsh_highlight__aliases"
 builtin unset zsh_highlight__aliases

This will print the message in 1.6% of new shells.

If anyone is aware of any setopt APL_JUNKIE_BITOPS-style knobs that make the above unportable, please say so ☺

added a commit that references this issue on Aug 9, 2020
ffed6e1
danielshahaf

danielshahaf commented on Aug 9, 2020

@danielshahaf
MemberAuthor

Fixed in ffed6e1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @danielshahaf

        Issue actions

          Tell users of the feature/redrawhook branch to switch back to master · Issue #655 · zsh-users/zsh-syntax-highlighting