Bug 483846 - [typing] Spaces only mode: backspace key to remove many spaces
Summary: [typing] Spaces only mode: backspace key to remove many spaces
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.5.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.14 M1   Edit
Assignee: Mateusz Matela CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks: 551170
  Show dependency tree
 
Reported: 2015-12-07 16:11 EST by Mateusz Matela CLA
Modified: 2022-03-08 17:43 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mateusz Matela CLA 2015-12-07 16:11:44 EST
When indentation is done with spaces, it's annoying that I have to press backspace 4 times to decrease indentation by one level. There should be an optional behavior that when cursor is after several spaces and backspace is pressed, it removes as many spaces as if there was a tab.

I think it would fit into the Indentation group on the Typing preferences page.

I've found a stackoverflow question that shows there was interest in this feature and some editors provide it: http://stackoverflow.com/questions/2551489/in-eclipse-how-can-spaces-behave-as-tabs
Comment 1 Eclipse Genie CLA 2019-07-06 07:16:39 EDT
New Gerrit change created: https://git.eclipse.org/r/145561
Comment 2 Mateusz Matela CLA 2019-07-06 08:12:33 EDT
Build successful :)
Anyone willing to do a review?

Do you require tests for this? I couldn't find any tests for preexisting related functionality that I could use as an example. And I think the feature is quite simple and easy to test manually.
Comment 3 Mateusz Matela CLA 2019-07-27 18:36:30 EDT
Andrey, maybe you can have a look?
Comment 4 Mickael Istria CLA 2019-08-26 07:32:06 EDT
Let's make it a tentative for 4.14.
Comment 5 Mateusz Matela CLA 2019-08-26 09:30:32 EDT
(In reply to Mickael Istria from comment #4)
> Let's make it a tentative for 4.14.

Thanks for the feedback, I'll check it soon.
Are you sure you mean 4.14 RC1? Why not sooner, like M1/M3?
Unless you mean 4.13 RC1, which is still in the future?
Comment 6 Mickael Istria CLA 2019-08-26 09:31:44 EDT
(In reply to Mateusz Matela from comment #5)
> (In reply to Mickael Istria from comment #4)
> > Let's make it a tentative for 4.14.
> 
> Thanks for the feedback, I'll check it soon.
> Are you sure you mean 4.14 RC1? Why not sooner, like M1/M3?
> Unless you mean 4.13 RC1, which is still in the future?

Sorry, I meant 4.14.M1 (opening in a couple of weeks)
Comment 8 Mickael Istria CLA 2019-09-17 05:57:50 EDT
Patch merged, thanks Mateusz.
Please also add a note about it in the N&N document: https://git.eclipse.org/c/www.eclipse.org/eclipse/news.git
Comment 9 Mateusz Matela CLA 2019-09-17 16:27:08 EDT
N&N added with https://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/?id=a03cad6f3526f31739302537a93d1b9a2d87b727

Also added bug 551170 for JDT UI as the java editor overrides the installTabsToSpacesConverter() method and needs to be modified to respect the new setting.
Are you aware of other projects that we might need to alert about this change?
Comment 10 Mickael Istria CLA 2019-09-17 16:32:01 EDT
(In reply to Mateusz Matela from comment #9)
> Are you aware of other projects that we might need to alert about this
> change?

I think CDT should also be verified.
Comment 11 Eclipse Genie CLA 2019-10-11 02:22:07 EDT
New Gerrit change created: https://git.eclipse.org/r/150930
Comment 13 Sarika Sinha CLA 2020-09-29 13:43:03 EDT
I was trying out this feature and observed that "Using Space for Tabs" and the new pref works on txt file but not on Java file. Is this expected or I should create a bug?
Comment 14 Mateusz Matela CLA 2020-09-29 13:59:44 EDT
(In reply to Sarika Sinha from comment #13)

Just checked with I20200919-1800, this works when your java formatter profile has the "spaces only" tab policy. This was handled in bug 551170.
Comment 15 Sarika Sinha CLA 2020-09-29 14:09:25 EDT
(In reply to Mateusz Matela from comment #14)
> (In reply to Sarika Sinha from comment #13)
> 
> Just checked with I20200919-1800, this works when your java formatter
> profile has the "spaces only" tab policy. This was handled in bug 551170.

Thanks! Yes it works with the "spaces only" tab policy.
One more question for java editor -> While using tab it used 4 spaces but for delete It went back 2 spaces so I had to press delete 2 times for one forward tab. Am I missing something again?
Comment 16 Mateusz Matela CLA 2020-09-29 14:20:38 EDT
(In reply to Sarika Sinha from comment #15)

This feature tries to emulate the behavior of tabs where they must always end at positions divisible by 4, that probably causes the effect you see. When you press backpace/delete at position divisible by 2 but not by 4, it will remove 2 spaces.
Comment 17 Sarika Sinha CLA 2020-09-29 14:29:16 EDT
(In reply to Mateusz Matela from comment #16)
> (In reply to Sarika Sinha from comment #15)
> 
> This feature tries to emulate the behavior of tabs where they must always
> end at positions divisible by 4, that probably causes the effect you see.
> When you press backpace/delete at position divisible by 2 but not by 4, it
> will remove 2 spaces.

Ok, Makes sense. Thanks again for the clarification.
Comment 18 Dan K. CLA 2022-03-08 04:05:39 EST
(In reply to Mateusz Matela from comment #14)
> (In reply to Sarika Sinha from comment #13)
> 
> Just checked with I20200919-1800, this works when your java formatter
> profile has the "spaces only" tab policy. This was handled in bug 551170.

It does not work for me for C/C++ (Eclipse 4.20, CDT 10.3.0).

I have "Remove multiple spaces on backspace/delete" activated (General > Editors) and also have "Tab policy: Spaces only" selected (C/C++ > Formatter).

Anything else I'd have to configure for this to work?
Comment 19 Mateusz Matela CLA 2022-03-08 17:43:08 EST
(In reply to Dan K. from comment #18)

It seems we haven't notified the CTD team in the end so they probably still need to adapt to this change in a similar way that bug 551170 adapted the Java editor in JDT.
Feel free to submit a bug for CDT, but maybe make sure you first check with the latest version.