about summary refs log tree commit diff stats
path: root/html/071read-line.subx.html
Commit message (Collapse)AuthorAgeFilesLines
* 6015Kartik Agaram2020-02-171-2/+2
|
* 5925Kartik Agaram2020-01-271-2/+2
|
* 5897 - rename comparison instructionsKartik Agaram2020-01-161-7/+7
| | | | | | | Signed and unsigned don't quite capture the essence of what the different combinations of x86 flags are doing for SubX. The crucial distinction is that one set of comparison operators is for integers and the second is for addresses.
* 5884Kartik Agaram2020-01-121-2/+2
|
* 5876 - address -> addrKartik Agaram2020-01-031-2/+2
|
* 5835Kartik Agaram2019-12-281-2/+2
|
* 5806Kartik Agaram2019-12-091-25/+25
|
* 5716Kartik Agaram2019-10-261-270/+266
|
* 5701Kartik Agaram2019-10-171-6/+6
|
* 5683Kartik Agaram2019-09-201-2/+2
|
* 5592 - switch register names to lowercaseKartik Agaram2019-08-261-114/+114
|
* 5582Kartik Agaram2019-08-251-5/+5
|
* 5490Kartik Agaram2019-07-271-2/+2
|
* 5485 - promote SubX to top-levelKartik Agaram2019-07-271-0/+455
ER = 5 def __init__(self, getmouse): """Creates a MouseEvent object from the result of win.getmouse()""" _, self.x, self.y, _, self.bstate = getmouse # x-values above ~220 suddenly became negative, apparently # it's sufficient to add 0xFF to fix that error. if self.x < 0: self.x += 0xFF if self.y < 0: self.y += 0xFF def pressed(self, n): """Returns whether the mouse key n is pressed""" try: return (self.bstate & MouseEvent.PRESSED[n]) != 0 except: return False def mouse_wheel_direction(self): """Returns the direction of the scroll action, 0 if there was none""" # If the bstate > ALL_MOUSE_EVENTS, it's an invalid mouse button. # I interpret invalid buttons as "scroll down" because all tested # systems have a broken curses implementation and this is a workaround. if self.bstate & curses.BUTTON4_PRESSED: return self.ctrl() and -self.CTRL_SCROLLWHEEL_MULTIPLIER or -1 elif self.bstate & curses.BUTTON2_PRESSED \ or self.bstate > curses.ALL_MOUSE_EVENTS: return self.ctrl() and self.CTRL_SCROLLWHEEL_MULTIPLIER or 1 else: return 0 def ctrl(self): return self.bstate & curses.BUTTON_CTRL def alt(self): return self.bstate & curses.BUTTON_ALT def shift(self): return self.bstate & curses.BUTTON_SHIFT def key_invalid(self): return self.bstate > curses.ALL_MOUSE_EVENTS