From 0f7d31b43e260bb3c7fe3fbc9d8f0024c1b39cf4 Mon Sep 17 00:00:00 2001 From: Phidica Veia Date: Sun, 27 Oct 2019 20:55:16 +1030 Subject: [PATCH] Fix bad alignment of compatibility highlighter popups in some cases --- highlighter_compat.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/highlighter_compat.py b/highlighter_compat.py index 0935250..0f1955f 100644 --- a/highlighter_compat.py +++ b/highlighter_compat.py @@ -158,6 +158,13 @@ def on_hover(self, point, hover_zone): self.logger.error("Unknown change {} from issue {}".format(state['change'], issueID)) continue + # In most cases, align popup to the first character of the region. + # However if the region is on a newline, popup must be one character back or it will draw on the wrong line + location = region.begin() + 1 + regChar = self.view.substr( region.begin() ) + if regChar == '\n': + location -= 1 + self.view.show_popup( """ @@ -188,7 +195,7 @@ def on_hover(self, point, hover_zone): """.format(problem, self._fish_version(), issue['hint']), flags = sublime.HIDE_ON_MOUSE_MOVE_AWAY, - location = region.begin() + 1, + location = location, ) break