From 1eb87f0c261b2f65c1fdf085fa6edc9abf863ced Mon Sep 17 00:00:00 2001 From: herr kaste Date: Wed, 12 Jun 2024 20:09:31 +0200 Subject: [PATCH 1/2] More aggressively check if a view needs a re-rendering Since the state has grown and contains formatted, relative dates, the state effectively often changes every minute. Make a second check against the actual view content as we don't want the cursor to flicker or jump around. --- common/ui.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/ui.py b/common/ui.py index e02eb921b..a7b23394b 100644 --- a/common/ui.py +++ b/common/ui.py @@ -343,10 +343,15 @@ def render(self): self.refresh_view_state() self.just_render() - @distinct_until_state_changed + # We check twice if a re-render is actually necessary because the state has grown + # and invalidates when formatted relative dates change, t.i., too often. + @distinct_until_state_changed # <== 1st check data/state def just_render(self): # type: () -> None content, regions = self._render_template() + if content == self.view.substr(sublime.Region(0, self.view.size())): # <== 2nd check actual view content + return + with self.keep_cursor_on_something(): self.draw(self.title(), content, regions) From 6b877658b4b8d7ff863b304ef7de225559896c26 Mon Sep 17 00:00:00 2001 From: herr kaste Date: Wed, 12 Jun 2024 20:09:58 +0200 Subject: [PATCH 2/2] Add `__future__` import --- common/ui.py | 1 + 1 file changed, 1 insertion(+) diff --git a/common/ui.py b/common/ui.py index a7b23394b..e8a680a4d 100644 --- a/common/ui.py +++ b/common/ui.py @@ -1,3 +1,4 @@ +from __future__ import annotations from contextlib import contextmanager from copy import deepcopy from functools import wraps