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

Pressing Backspace incorrectly removes all spaces/tabs at the beginning of a line #234

Open
GenesisFR opened this issue May 14, 2021 · 9 comments · May be fixed by #235
Open

Pressing Backspace incorrectly removes all spaces/tabs at the beginning of a line #234

GenesisFR opened this issue May 14, 2021 · 9 comments · May be fixed by #235

Comments

@GenesisFR
Copy link

GenesisFR commented May 14, 2021

I understand it is a QOL, however if you have tabbed lines like in this example:

	ReleaseAllKeys()
				KeyWait, Alt

Pressing Backspace while the caret is at the beginning of the second line will result in

	ReleaseAllKeys()				KeyWait, Alt

While pressing Backspace while the caret is before KeyWait will result in

	ReleaseAllKeys()KeyWait, Alt

I do this all the time and it's really annoying. I had to locally revert the changes from 8a7d1ae at line 421. I think the problem comes from sc.2128(Start) which isn't the beginning of the line but the end of the indentation at the beginning of the line. It should be replaced by something like GETLINEBEGINPOSITION (which I can't seem find or create).

The expected behavior should be the reverse, it should only remove tabs when you're at the beginning of the line (like stated in the commit description).

@GenesisFR
Copy link
Author

GenesisFR commented May 14, 2021

Ok so I modified the code like this and it does fix the problem, however it creates a similar problem when pressing Delete at the beginning of the line:

	if(sc.2167(Start)=sc.2008&&Start>0&&sc.2008=sc.2009){
		return sc.2645((SPos:=sc.2136(Start-1)),sc.2128(Start)-SPos)
	}

@GenesisFR
Copy link
Author

Alright, this should fix both problems:

	if(sc.2167(Start)=sc.2008&&Start>0&&sc.2008=sc.2009&&sub!=0){
		return sc.2645((SPos:=sc.2136(Start-1)),sc.2128(Start)-SPos)
	}

@maestrith
Copy link
Owner

I suppose I could make an option for it, but you can also press Shift+{Backspace} which bypasses the normal Backspace routine.

I'll look at what you coded to see if it still keeps the functionality of removing all of the spaces before the beginning of the line.

@GenesisFR
Copy link
Author

It does keep that functionality as long as the caret is at the beginning of the line, before any space/tab.

@GenesisFR
Copy link
Author

Now that I'm reading it again, did you mean it should also remove all spaces/tabs at the end of the previous line once the current line is merged with it? Because it doesn't in both of our versions.

@maestrith
Copy link
Owner

I never intended it to do that. I do not leave any whitespace at the end of my lines so it never really occurred to me.

@GenesisFR
Copy link
Author

Ok, I'll update my pull request tonight to also fix that.

@GenesisFR
Copy link
Author

GenesisFR commented May 15, 2021

Unfortunately, I haven't found anything that could help detecting whitespace at the end of a line in the Scintilla documentation. I don't leave whitespace at the end of lines so that's not a problem for me either.

Maybe if there's a way of reversing the order of all the characters of the previous line, removing the indentation at the beginning of the reversed line (if there's any), then reversing the line again? Just throwing an idea out there.

maestrith added a commit that referenced this issue May 21, 2021
Changed: Fixed by David #234
-Backspace at the beginning of a line was causing issues.
maestrith added a commit that referenced this issue May 21, 2021
Changed: Fixed by David #234
-Backspace at the beginning of a line was causing issues.
maestrith added a commit that referenced this issue May 21, 2021
Changed: Fixed by David #234
-Backspace at the beginning of a line was causing issues.
@GenesisFR
Copy link
Author

GenesisFR commented May 22, 2021

@maestrith I don't know what you did in your commits for 1.005.37 (all commits between 1.005.00 and 1.005.37 are gone?) but #235 wasn't merged. The code is slightly different than what it was before though.

I updated AHK Studio to confirm and the issue still persists.

maestrith added a commit that referenced this issue May 22, 2021
Changed: Fixed by David #234
-Backspace at the beginning of a line was causing issues.
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

Successfully merging a pull request may close this issue.

2 participants