Repository: zulip/zulip-terminal

Issue:
Footer gets updated as many times as the edit key is pressed on any uneditable message
Steps to reproduce:
* Move focus to any message that you can't edit
* Press e multiple times
* Press any other key to trigger the behaviour

Discussion:
kaustubh-nair: This is an alternative to #725
zulipbot: Heads up @kaustubh-nair, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's [recent commits](https://github.com/zulip/zulip-terminal/commits/main) to see where the conflicts occur. Please rebase your feature branch against the `upstream/main` branch and [resolve](https://zulip.readthedocs.io/en/latest/git/troubleshooting.html#recover-from-a-git-rebase-failure) your pull request's merge conflicts accordingly.

<!-- mergeConflictWarning -->

neiljp: @kaustubh-nair Rebased and merged this great simple fix with minor tweaks, thanks! :tada:

Patch:
diff --git a/zulipterminal/ui.py b/zulipterminal/ui.py
index d998569..544f9d7 100644
--- a/zulipterminal/ui.py
+++ b/zulipterminal/ui.py
@@ -103,6 +103,11 @@ class View(urwid.WidgetWrap):
         style: str = "footer",
         duration: Optional[float] = None,
     ) -> None:
+        # Avoid updating repeatedly (then pausing and showing default text)
+        # This is simple, though doesn't avoid starting one thread for each call
+        if text_list == self._w.footer.text:
+            return
+
         if text_list is None:
             text = self.get_random_help()
         else:


Test patch:
diff --git a/tests/ui/test_ui.py b/tests/ui/test_ui.py
index 8b2340e..7e50281 100644
--- a/tests/ui/test_ui.py
+++ b/tests/ui/test_ui.py
@@ -76,6 +76,15 @@ class TestView:
         assert view.users_view == right_view()
         assert return_value == (line_box(), right_tab())
 
+    def test_set_footer_text_same_test(
+        self, view: View, mocker: MockerFixture, text: List[str] = ["heya"]
+    ) -> None:
+        view._w.footer.text = text
+
+        view.set_footer_text(text)
+
+        view._w.footer.set_text.assert_not_called()
+
     def test_set_footer_text_default(self, view: View, mocker: MockerFixture) -> None:
         mocker.patch(VIEW + ".get_random_help", return_value=["some help text"])