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

Strange behavior for backspace with lines ending with more than 4 spaces in notebook #1464

Closed
cschin opened this issue Mar 2, 2012 · 5 comments
Milestone

Comments

@cschin
Copy link

cschin commented Mar 2, 2012

In a line with more than 4 spaces at the end, the backspace deletes 4 characters before the current cursor position regardless whether the cursor is at the end or not. Is this the intended behavior? The fix seems quite simple. In the meantime, should we simply delete all white space at the end of line if backspace is hit at the end of the line?

@takluyver
Copy link
Member

The exception being if the line is only whitespace (i.e. indentation with no code typed yet) - then we only want to take off 4 spaces at a time.

@cschin
Copy link
Author

cschin commented Mar 2, 2012

good point, so the logic should go with (1) take off 4 spaces (or move to the right indent location) for empty line and (2) remove all tailing space for non-empty line. If people think this is fine, I can submit a patch.

@ellisonbg
Copy link
Member

The current algorithm only looks at the 4 preceding the cursor and if they are all spaces, then 4 spaces are deleted. This logic is applied regardless of where the cursor is located. I am not convinced we want to change this as it would make the logic run on every backspace more complex. But if you want to try to implement it and see if that logic can be made very clean, it might be worth it.

@fperez
Copy link
Member

fperez commented Jun 26, 2012

I'm afraid that absent a reviewed PR, this isn't realistic to have a 0.13 target, being we're days away from releasing.

@cschin, please feel free to submit a PR with the fix you like best and we'll be happy to review/merge it!

@cschin
Copy link
Author

cschin commented Jun 30, 2012

sorry, too busy on my daytime job. I will file a PR post 0.13

cschin added a commit to cschin/ipython that referenced this issue Jul 2, 2012
cschin added a commit to cschin/ipython that referenced this issue Jul 2, 2012
@cschin cschin mentioned this issue Jul 2, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Update code mirror 2.22 to 2.32

Update codemirror to the latest stable.
And upadte our code here and there to smooth the changes. 
Just the fact that there is a new tab system that was inserting tabs instead of 4 space, we just have to pass a new line when creating e new CM instance.

Should also fix ipython#1464.

See Readme-IPython to see what patch to apply when updating next.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants