Skip to content

Commit

Permalink
Fix bad alignment of compatibility highlighter popups in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Phidica committed Oct 27, 2019
1 parent 217d825 commit 0f7d31b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion highlighter_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"""
<body id = "compatibility_highlight">
Expand Down Expand Up @@ -188,7 +195,7 @@ def on_hover(self, point, hover_zone):
</body>
""".format(problem, self._fish_version(), issue['hint']),
flags = sublime.HIDE_ON_MOUSE_MOVE_AWAY,
location = region.begin() + 1,
location = location,
)
break

Expand Down

0 comments on commit 0f7d31b

Please sign in to comment.