-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
gh-139246: zero-width word paste can be wrong in default repl #139254
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
Conversation
Signed-off-by: yihong0618 <[email protected]>
Signed-off-by: yihong0618 <[email protected]>
Co-authored-by: grayjk <[email protected]>
|
|
||
| @functools.cache | ||
| def str_width(c: str) -> int: | ||
| if ord(c) < 128: |
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.
unrelated to this issue but quite a few of the characters with ord < 128, do not have a display width of 1
for example, in my terminal, tab (ord 9) is 8 charaters wide
something to consider for a future PR
Lib/_pyrepl/utils.py
Outdated
| category = unicodedata.category(c) | ||
| if category == "Cf" and c != "\u00ad": | ||
| return 0 | ||
| if "\u2028" <= c <= "\u2029": |
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.
Hmm, what terminal are you using? Here (on VTE) these take up one cell.
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.
mac with kitty
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.
if \u2028 and \u2029 aren't consistent across terminals, could remove this condition since it is unrelated to the original issue
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.
of course will do it
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.
fixed
Signed-off-by: yihong0618 <[email protected]>
|
Thanks @yihong0618 for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @yihong0618 for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Sorry, @yihong0618 and @encukou, I could not cleanly backport this to |
…ythonGH-139254) (cherry picked from commit 4e6dba0) Co-authored-by: yihong <[email protected]> Signed-off-by: yihong0618 <[email protected]> Co-authored-by: grayjk <[email protected]>
|
GH-140796 is a backport of this pull request to the 3.14 branch. |
… repl (pythonGH-139254) (cherry picked from commit 4e6dba0) Co-authored-by: yihong <[email protected]> Signed-off-by: yihong0618 <[email protected]> Co-authored-by: grayjk <[email protected]>
|
GH-141166 is a backport of this pull request to the 3.13 branch. |
…H-139254) (GH-140796) gh-139246: zero-width word paste can be wrong in default repl (GH-139254) (cherry picked from commit 4e6dba0) Signed-off-by: yihong0618 <[email protected]> Co-authored-by: yihong <[email protected]> Co-authored-by: grayjk <[email protected]>
…H-139254) (GH-141166) (cherry picked from commit 4e6dba0) Signed-off-by: yihong0618 <[email protected]> Co-authored-by: yihong <[email protected]> Co-authored-by: grayjk <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.