Repository navigation
gh-131430: Fix crashes on an empty DELETE_WORD_BACKWARDS (^W) followed by CLEAR_TO_START (^K) - #131452
gh-131430: Fix crashes on an empty DELETE_WORD_BACKWARDS (^W) followed by CLEAR_TO_START (^K)#131452deepwzh wants to merge 4 commits into
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
| class KillCommand(Command): | ||
| def kill_range(self, start: int, end: int) -> None: | ||
| if start == end: | ||
| if end - start <= 1: |
There was a problem hiding this comment.
I don't think this is correct, consider for example this input:
>>> 12where the cursor is over 2. If you press ^w, this no longer removes the 1 .
Perhaps checking that kill_ring is not an empty list would be a good alternative?
- if is_kill(r.last_command):
+ if is_kill(r.last_command) and r.kill_ring:
Thank you for your guidance. I will try to submit a revised version again~~ I have something to ask first. I noticed that after submitting my PR for a considerable period of time, the automatically assigned reviewers do not seem to have enough time to review. In this situation, do I usually need to be patient and wait, or can I look for other reviewers? |
|
We are nearing the beta freeze for Python 3.14 so everybody is even busier than usual and there can be larger delays in getting reviews.. That said, I'm happy to help you review the PR, feel free to ping me once you have addressed my comment 🙂 |
413c3f9 to
ac7bbfc
Compare
Got it! Thanks for your contributions to Python! @tomasr8 Today I completed the revisions as per your instructions and added some additional tests. Could you please review them when you have time? |
|
This PR is stale because it has been open for 30 days with no activity. |
…owed by CLEAR_TO_START (^K)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
f95e9c3 to
488d180
Compare
| text = b[start:end] | ||
| del b[start:end] | ||
| if is_kill(r.last_command): | ||
| if is_kill(r.last_command) and r.kill_ring: |
There was a problem hiding this comment.
This prevents the crash, but Ctrl-W followed by Ctrl-K on an empty prompt now adds an empty entry to the kill ring. Can we return early when the buffer slice is empty?
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Add the handling of kill_range null detection, which is a left closed and right open interval. When end start<=1, it means that no operation has been done and should be skipped; The original writing only handled the case of end==start.