Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-132267: fix desynchronized cursor position and buffer mismatch after resize#132360

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ImFeH2 wants to merge6 commits intopython:main
base:main
Choose a base branch
Loading
fromImFeH2:gh-132267

Conversation

ImFeH2
Copy link
Contributor

@ImFeH2ImFeH2 commentedApr 10, 2025
edited
Loading

changes:

  1. addConsole.sync_screen to recalculate the cursor position and the screen buffer based on changes in console width.
  2. fix wrapcount calculation inReader.calc_screen.
  3. limit cursor position within screen width.

@ImFeH2
Copy link
ContributorAuthor

before

before

after

after

ImFeH2 reacted with thumbs up emoji

@feoh
Copy link
Contributor

Hi! I tested this PR on my Mac, MacOS latest and it works great.

It also helped me find another Pyrepl bug.

Copy link
Contributor

@StanFromIrelandStanFromIreland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This has conflicts now.

@feoh
Copy link
Contributor

feoh commentedMay 19, 2025
edited
Loading

Hi. I think I found a bug with this PR. Tested on MacOS latest. I reproduced this in WezTerm and also Apple's Terminal.app.

2025-05-19 13 30 23

In particular, if you type or paste a very long line into the terminal with this patch, leaving your cursor at the end, and then hit Ctrl/Cmd+/- a number of times to resize the text, you'll find the cursor in the middle of the line.

@ImFeH2
Copy link
ContributorAuthor

Thanks@feoh for catching that bug!
I made a mistake there. The previous method wasn't working well because reflow is terminal application behavior, making it difficult to guess rearranged content at this level. Now I just clear the screen and redraw everything to prevent any leftover characters.
I've tested this in Windows Terminal with WSL and it handles content exceeding window height well.
Does this fix it? Open to suggestions.

@ImFeH2
Copy link
ContributorAuthor

Some testcase might need to update if the behavior of resizing changes.

@feoh
Copy link
Contributor

@ImFeH2 Hi! I'm delighted I could help!

Went to re-test and for some reason I can't check out this PR:

╭─cpatti at rocinante in ~/src/personal/cpython on main✔ 25-05-20 - 16:40:49╰─⠠⠵ gh pr checkout 132360                                              <region:us-east-1>remote: Enumerating objects: 53, done.remote: Counting objects: 100% (29/29), done.remote: Compressing objects: 100% (10/10), done.remote: Total 53 (delta 20), reused 19 (delta 19), pack-reused 24 (from 1)Unpacking objects: 100% (53/53), 64.06 KiB | 1.56 MiB/s, done.From github.com:python/cpython ! [rejected]                refs/pull/132360/head -> gh-132267  (non-fast-forward)failed to run git: exit status 1

I'll try a fresh CPython checkout later from the hotel and see if that helps :)

@feoh
Copy link
Contributor

feoh commentedMay 21, 2025
edited
Loading

Hi I'm very sorry to be the bearer of bad tidings but I'm seeing more issues with the fixed fix :\

2025-05-21 09 46 01

@ImFeH2
Copy link
ContributorAuthor

ImFeH2 commentedMay 23, 2025
edited
Loading

Does this bug only appear in Wezterm so far? I tested it in Terminal.app on my MacOS VM and Windows Terminal - both display the text normally without this layout issue.

392644679-221442837.mp4

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@StanFromIrelandStanFromIrelandStanFromIreland left review comments

@pablogsalpablogsalAwaiting requested review from pablogsalpablogsal is a code owner

@lysnikolaoulysnikolaouAwaiting requested review from lysnikolaoulysnikolaou is a code owner

@ambvambvAwaiting requested review from ambvambv is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@ImFeH2@feoh@StanFromIreland

[8]ページ先頭

©2009-2025 Movatter.jp