New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: extend functional keys handling with key modifiers #705
Conversation
Pull Request Test Coverage Report for Build 7185062239
💛 - Coveralls |
8d7b3d8
to
5a9699d
Compare
@@ -476,14 +494,14 @@ def process_keyqueue(codes: Sequence[int], more_available: bool) -> tuple[list[s | |||
else: | |||
return [f"<{code:d}>"], codes[1:] | |||
|
|||
for i in range(need_more): | |||
if len(codes) - 1 <= i: | |||
for i in range(1, need_more + 1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify indexing
@@ -459,13 +468,22 @@ def process_keyqueue(codes: Sequence[int], more_available: bool) -> tuple[list[s | |||
|
|||
em = str_util.get_byte_encoding() | |||
|
|||
if em == "wide" and code < 256 and within_double_byte(code.to_bytes(1, "little"), 0, 0): | |||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
force fit in 12 symbols
urwid/escape.py
Outdated
for digit in "12345678" | ||
for num in (1, range(5, 12)) | ||
), | ||
*((f"[1;{digit}Q", escape_modifier(digit) + "f2") for digit in "12345678"), # F2 is special |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incorrect parse of this sequence always cause exit from "input_test"
* F1 is a special and use number `1` postfixed by P * F2 is a special and use number `1` postfixed by Q * F3 is a special and use number `1` postfixed by R * F4 is a special and use number `1` postfixed by S Related urwid#702
5a9699d
to
97ded00
Compare
Join generator expressions for F1-F4 keys Related urwid#702
715c03d
to
529c388
Compare
action = "drag" | ||
else: | ||
action = "press" | ||
else: | ||
elif action == "m": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -289,9 +312,10 @@ def read_sgrmouse_info(self, keys, more_available: bool): | |||
raise MoreInputRequired() | |||
return None | |||
|
|||
(b, x, y) = value[:-1].split(";") | |||
(b, x, y) = (int(val) for val in value[:-1].split(";")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's cast to int
in-place
(f"O{digit}{letter}", escape_modifier(digit) + key) | ||
# modified F1-F4 keys - O#X form and [1;#X form | ||
(prefix + digit + letter, escape_modifier(digit) + f"f{number}") | ||
for prefix in ("O", "[1;") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
figured out, that generator for another prefix was available
Co-authored-by: Ian Ward <ian@excess.org>
think it's worth adding tests of the parsing code here to make sure it doesn't break? |
Probably yes. will add in 1 hour and fix "ruff" checker |
* fix key `F20` in generator
1
postfixed byP
1
postfixed byQ
1
postfixed byR
1
postfixed byS
Related #702
Related #702
Checklist
master
orpython-dual-support
branchtox
successfully in local environment