Sublime Forum

hover_zone=sublime.HOVER_GUTTER fired even when mouse hover outside the gutter

#1

Hello, I think I’ve found a bug.

This is a very simple plugin to test it:

import sublime
import sublime_plugin

class PrintLineWhenOverTheGutter(sublime_plugin.ViewEventListener):
    def on_hover(self, point, hover_zone=sublime.HOVER_GUTTER):
        line_n = self.view.rowcol(point)[0] + 1
        print(line_n)

The plugin prints the right line number on the console, but it does it even when hovering over the text, not only when hovering on the gutter.

I’m using the Build 4125 on Windows 10

0 Likes

#2

your code is just setting the default value of hover_zone if unprovided to the method. What you really want to do is check it

import sublime
import sublime_plugin

class PrintLineWhenOverTheGutter(sublime_plugin.ViewEventListener):
    def on_hover(self, point, hover_zone):
        if hover_zone == sublime.HOVER_GUTTER:
            line_n = self.view.rowcol(point)[0] + 1
            print(line_n)
1 Like

#3

Ah yes! of course, silly me!

Thank you

0 Likes