Ticket #74 (closed defect: wontfix)

Opened 19 months ago

Last modified 19 months ago

Wrong mouse position when col > 255

Reported by: Christian Owned by: ian
Priority: minor Milestone:
Component: input_handling Version:
Keywords: mouse, input Cc:

Description

When the gnome-terminal (xterm, rxvt,..) has more than 255 columns and I click in a column on the right side of the 255th column the value of col in mouse_event is wrong. 256th column -> col=-33 257th column -> col=-32 and so on. I have looked a bit in the code and found this piece: (raw_display.py:427ff)

def _getch(self, timeout):
    ready = self._wait_for_input_ready(timeout)
    if self.gpm_mev is not None:
        if self.gpm_mev.stdout.fileno() in ready:
            self.gpm_event_pending = True
    if self._term_input_file.fileno() in ready:
        return ord(os.read(self._term_input_file.fileno(), 1))
    return -1

Values greater then 255 can't be read correct from stdin. So if gpm isn't available there should be some code that prevents this error. I don't know if there is another way to get the mouse position except from stdin, or if you have to ensure that the terminal isn't bigger then 255x255.

Change History

Changed 19 months ago by ian

  • priority changed from major to minor

In my testing I see the X coordinate works until column 222, then wraps around to -33 and counts up again. Makes sense as chr(33) indicates column 0. You can try running input_test.py to see the values.

So, I could accept those last 33 positions properly (map -33:-1 to 223:255), but I don't know of a fix that would allow reading larger coordinates. Something might be possible using the X protocol, but it would be a real hack.

Changed 19 months ago by ian

  • status changed from new to closed
  • resolution set to wontfix

[7ecfec62eea6] is the best I can do with the information that is sent on stdin.

Note: See TracTickets for help on using tickets.