Skip to content
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

Multi-line input is displayed incorrectly #31

Open
pfmoore opened this issue Oct 22, 2014 · 0 comments
Open

Multi-line input is displayed incorrectly #31

pfmoore opened this issue Oct 22, 2014 · 0 comments

Comments

@pfmoore
Copy link

pfmoore commented Oct 22, 2014

When a multi-line command is recalled from history, the display is incorrect and the arrow keys do not work as expected. It looks like the newline characters aren't being taken into account when calculating cursor position, line length, etc.

To reproduce, the easiest way is to use IPython.

>ipython --TerminalInteractiveShell.multiline_history=True                               
Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD64)]    
Type "copyright", "credits" or "license" for more information.                           

IPython 2.3.0 -- An enhanced Interactive Python.                                         
?         -> Introduction and overview of IPython's features.                            
%quickref -> Quick reference.                                                            
help      -> Python's own help system.                                                   
object?   -> Details about 'object', use 'object??' for extra details.                   

In [1]: for i in range(3):                                                               
   ...:     print(i)                                                                     
   ...:                                                                                  
0                                                                                        
1                                                                                        
2                                                                                        

In [2]:                                                                                  
Do you really want to exit ([y]/n)?                                                      
PS 21:09 [Git: master] [00:17] C:\Work\Projects\ipython-pfm                              
>ipython --TerminalInteractiveShell.multiline_history=True                               
Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD64)]    
Type "copyright", "credits" or "license" for more information.                           

IPython 2.3.0 -- An enhanced Interactive Python.                                         
?         -> Introduction and overview of IPython's features.                            
%quickref -> Quick reference.                                                            
help      -> Python's own help system.                                                   
object?   -> Details about 'object', use 'object??' for extra details.                   

In [1]: for i in range(3):                                                               
    print(i)                                                                             

Note that you need to quit and re-enter IPython, because the individual lines are recalled during the current session. It's only from a new session that the history is multi-line.

In the final line (In[1] of the new session) I hit up arrow. The line was displayed, but the cursor was on the first line, 14 characters to the right of the colon. It could be moved left or right, but not onto the second line. Typing appears in the expected place on the second line - it's the place the cursor is displayed that is wrong, not the editing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant