Fix line normalization in Terminal.sendText() for IPython shell on Windows #238190 #238235
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix line normalization in Terminal.sendText() for IPython shell on Windows #238190
Issue:
The issue addresses line normalization in Terminal.sendText() function in IPython shells when run on Windows. The problem arises due to the line ending normalization in the code, this causes unexpected behavior in the terminal. Especially, when the sendText() method is used to send a Python function like hello_world(), IPython enters multi-line mode on Windows.
Solution:
Updated the line ending normalization logic in the sendText() method. This ensures:
Windows uses \r\n
Other platforms use \n
The modified code now checks for the platform and applies the appropriate line ending normalization, preventing the issue in the IPython shell.
How to Test:
Make sure to adjust the "How to Test" section based on any specific details for your environment.
Before:
After:
I'm a new contributor and open to feedback, do give this a commend if I'm wrong somewhere!