mirror of
https://github.com/lowobservable/oec.git
synced 2026-03-04 10:44:32 +00:00
Implement fast cursor left and right
This commit is contained in:
@@ -50,8 +50,10 @@ class Key(Enum):
|
||||
DELETE = 265
|
||||
|
||||
LEFT = 266
|
||||
LEFT_2 = 410
|
||||
UP = 267
|
||||
RIGHT = 268
|
||||
RIGHT_2 = 411
|
||||
DOWN = 269
|
||||
ROLL_UP = 270
|
||||
ROLL_DOWN = 271
|
||||
|
||||
@@ -187,8 +187,8 @@ KEYMAP_ALT = {
|
||||
# Right
|
||||
95: Key.PA1,
|
||||
94: Key.PA2,
|
||||
# 22 - Unsure what this key is
|
||||
# 26 - Unsure what this key is
|
||||
22: Key.LEFT_2,
|
||||
26: Key.RIGHT_2
|
||||
}
|
||||
|
||||
MODIFIER_RELEASE_MAP = {
|
||||
|
||||
@@ -121,8 +121,12 @@ class TN3270Session(Session):
|
||||
self.emulator.cursor_down()
|
||||
elif key == Key.LEFT:
|
||||
self.emulator.cursor_left()
|
||||
elif key == Key.LEFT_2:
|
||||
self.emulator.cursor_left(rate=2)
|
||||
elif key == Key.RIGHT:
|
||||
self.emulator.cursor_right()
|
||||
elif key == Key.RIGHT_2:
|
||||
self.emulator.cursor_right(rate=2)
|
||||
elif key == Key.INSERT:
|
||||
self._handle_insert_key()
|
||||
elif key == Key.DELETE:
|
||||
|
||||
@@ -169,6 +169,13 @@ class SessionHandleKeyTestCase(unittest.TestCase):
|
||||
# Assert
|
||||
self.session.emulator.cursor_left.assert_called()
|
||||
|
||||
def test_left_2(self):
|
||||
# Act
|
||||
self.session.handle_key(Key.LEFT_2, KeyboardModifiers.NONE, None)
|
||||
|
||||
# Assert
|
||||
self.session.emulator.cursor_left.assert_called_with(rate=2)
|
||||
|
||||
def test_right(self):
|
||||
# Act
|
||||
self.session.handle_key(Key.RIGHT, KeyboardModifiers.NONE, None)
|
||||
@@ -176,6 +183,13 @@ class SessionHandleKeyTestCase(unittest.TestCase):
|
||||
# Assert
|
||||
self.session.emulator.cursor_right.assert_called()
|
||||
|
||||
def test_right_2(self):
|
||||
# Act
|
||||
self.session.handle_key(Key.RIGHT_2, KeyboardModifiers.NONE, None)
|
||||
|
||||
# Assert
|
||||
self.session.emulator.cursor_right.assert_called_with(rate=2)
|
||||
|
||||
def test_delete(self):
|
||||
# Act
|
||||
self.session.handle_key(Key.DELETE, KeyboardModifiers.NONE, None)
|
||||
|
||||
Reference in New Issue
Block a user