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

Inserting a line-break in code/comment with parenthesis deletes part of the code/comment #4475

Closed
msoultan opened this issue May 15, 2017 · 6 comments
Assignees
Milestone

Comments

@msoultan
Copy link

msoultan commented May 15, 2017

Description of your problem

I have a comment that is too long so I want to break it into two lines - this comment also contains parenthesis which seems to be causing the bug. I go to where I want to break it and when I hit enter, it chops off some of the text from the line that is moved down a row. Removing the parenthesis stops the strange behavior. The example should explain it.

What steps will reproduce the problem?

  1. enter this comment with all the preceding tabs (it's wrapped when I entered it):
								#verify that file has station name in it (just to be sure we're not accidentally pulling the wrong station)
  1. place your cursor just in front of "pulling" and hit enter

  2. you will end up with this:

								#verify that file has station name in it (just to be sure we're not accidentally 
												  lling the wrong station)
  1. As you can see "pulling" has been chopped and it also has the incorrect indentation. Now put your cursor in front of "lling" and hit backspace a lot of times to try and get "lling" to merge back up with the previous line - it will get "stuck" at the left margin. It will look like this:
								#verify that file has station name in it (just to be sure we're not accidentally 
  lling the wrong station)

What is the expected output? What do you see instead?

It should insert a clean line break, properly tabbed. Backspace should be able to merge it with the previous line.

Please provide any additional information below

Versions and main components

  • Spyder Version: v3.1.4
  • Python Version: 3.6.0 64bit
  • Qt Version: 5.6.2
  • PyQt Version: 5.6
  • Operating system: Windows 10

Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:

jedi >=0.9.0 : 0.9.0 (OK)
matplotlib >=1.0 : 2.0.0 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.11.3 (OK)
pandas >=0.13.1 : 0.19.2 (OK)
pep8 >=0.6 : 1.7.0 (OK)
pyflakes >=0.6.0 : 1.5.0 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.6.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4-1 (OK)
sphinx >=0.6.6 : 1.5.1 (OK)
sympy >=0.7.3 : 1.0 (OK)

@ccordoba12
Copy link
Member

Thanks for reporting. We'll see what we can do about this in a future release.

@msoultan
Copy link
Author

msoultan commented May 16, 2017

It turns out this isn't just limited to comments. I had the following:

	print(strStationProjectPath)
	with open(strProjectFile, "r") as fShowTemplate, \

I put my cursor just before the closing parenthesis after "strStationProjectPath" and hit enter and I end up with this (notice the closing parenthesis disappeared):

	print(strStationProjectPath
	   with open(strProjectFile, "r") as fShowTemplate, \

If I put my cursor in front of "with" and hit backspace forever, I end up with this:

	print(strStationProjectPath
   with open(strProjectFile, "r") as fShowTemplate, \

It should join the second line with the first line, but there's something stopping it from backspacing any further.

So there's some kinda weirdness going on that has to do with parenthesis and indentation. Subject has been updated to indicate that isn't just limited to comments. Let me know if you need any more info.

Thanks!

@msoultan msoultan changed the title Inserting a line-break in a comment with parenthesis deletes part of the comment Inserting a line-break in code/comment with parenthesis deletes part of the code/comment May 16, 2017
@msoultan
Copy link
Author

msoultan commented May 16, 2017

So.. more weirdness. I'm not sure if this issue is only limited to parenthesis. Take this line of code:

						print("\"" + conPathToReaper + """ -renderproject """ & strMasterProjectPath & "TEMP-" & UCase(arrStationTracks(intStation)) & "-" & ReaperFile & """", ShowWindow, WaitUntilFinished

Which I know isn't legitimate code (I'm porting a script over from VBScript). Put your cursor to the right of the three quotes that are just to the left of "-renderproject", hit backspace, and you end up with this:

						print("\"" + conPathToReaper + " -renderproject """ & strMasterProjectPath & "TEMP-" & UCase(arrStationTracks(intStation)) & "-" & ReaperFile & """", ShowWindow, WaitUntilFinished

Notice how there is only one quote to the left of "-renderproject" - and no, I did not hit backspace twice.

@ccordoba12 ccordoba12 modified the milestones: v3.2, v3.2.1 May 17, 2017
@ccordoba12
Copy link
Member

@rlaverde, please take a look at this one too.

@msoultan
Copy link
Author

Here's another one for you. Type the following:

print(

spyder will autocomplete and you will end up with the following (with the cursor between the parenthesis):

print()

hit enter

You'd expect something like this:

print(
)

But you get this:

print(
	  

If you try and press backspace, it will move back once (about two spaces worth), but if you backspace again, it won't do anything. Btw, I am using tabs, not spaces, for my indentation. Let me know if you need any more testing.

@msoultan
Copy link
Author

msoultan commented May 18, 2017

Here's another weird one. If I have the following (notice the missing colon after fOutFile):

	with open(os.path.join(RenderOutputPath,"test.txt", "w") as fOutFile
#1
#2

and I place my cursor in front of #1 and hit tab, I end up with the following:

	with open(os.path.join(RenderOutputPath,"test.txt", "w") as fOutFile
		   #2

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

3 participants