-
-
Notifications
You must be signed in to change notification settings - Fork 35k
gh-145375: Fix bracketed paste in PyREPL isearch mode #145398
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
base: main
Are you sure you want to change the base?
Changes from all commits
5a93983
b2ffa42
fa96a8e
643f454
7172483
9134106
235c6e4
f00e983
3ad66c1
66c15fe
d78c451
0d31cd3
1b75074
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ | |
| (r"\C-c", "isearch-cancel"), | ||
| (r"\C-g", "isearch-cancel"), | ||
| (r"\<backspace>", "isearch-backspace"), | ||
| (r"\<bracketed paste>", "isearch-bracketed-paste"), | ||
| ] | ||
| ) | ||
|
|
||
|
|
@@ -211,6 +212,22 @@ def do(self) -> None: | |
| r.invalidate_prompt() | ||
|
|
||
|
|
||
| class isearch_bracketed_paste(commands.Command): | ||
| def do(self) -> None: | ||
| r = self.reader | ||
| b = r.buffer | ||
| done = "\x1b[201~" | ||
| data = "" | ||
| while done not in data: | ||
| ev = r.console.getpending() | ||
| data += ev.data | ||
| paste_content = data.replace(done, "") | ||
| r.isearch_term += paste_content | ||
| r.invalidate_prompt() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I've updated in adapt code for #146584 (structured rendered screens).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if "".join(b[r.pos:r.pos+len(r.isearch_term)]) != r.isearch_term: | ||
| r.isearch_next() | ||
|
|
||
|
|
||
| @dataclass | ||
| class HistoricalReader(Reader): | ||
| """Adds history support (with incremental history searching) to the | ||
|
|
@@ -245,6 +262,7 @@ def __post_init__(self) -> None: | |
| isearch_backspace, | ||
| isearch_forwards, | ||
| isearch_backwards, | ||
| isearch_bracketed_paste, | ||
| operate_and_get_next, | ||
| history_search_backward, | ||
| history_search_forward, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,7 @@ | |
| "space": " ", | ||
| "tab": "\t", | ||
| "up": "up", | ||
| "bracketed paste": "bracketed paste", | ||
| } | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Handle bracketed paste in :mod:`!_pyrepl` isearch mode. |
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.
Nit: two blank lines between top-level classes here.