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

Allow unindent without selection #50289

Closed
wants to merge 1 commit into from
Closed

Allow unindent without selection #50289

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 8, 2021

This allows a user to press shift+tab to unindent a line without needing to make a selection. Previously, this would remove spaces or tabs preceding the cursor, and an active selection was necessary to actually unindent the line. Now, it always unindents the line the cursor is on by removing spaces or tabs at the front.

Resolves: #50279

@ghost ghost self-requested a review as a code owner July 8, 2021 19:16
cursor_set_column(MAX(0, cc - spaces_to_remove));
return;
Copy link
Member

@akien-mga akien-mga Jul 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two returns can be removed as they're both the last statements of mutually exclusive branches.

@akien-mga akien-mga added this to the 4.0 milestone Jul 8, 2021
@akien-mga akien-mga requested a review from Paulb23 July 8, 2021 19:20
Copy link
Member

@Paulb23 Paulb23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed on purpose.

Might be worth allowing configuration of this behaviour? I notice that QT creator has a couple different behaviours for unindenting.

As for this specific PR, if the old behaviour is preferred by most, you can remove that entire method and call unindent_line directly.

@ghost
Copy link
Author

ghost commented Jul 8, 2021

Or alternatively, I could have it remove preceding spaces/tabs if there are any and otherwise unindent? That way it would cancel any tabs placed in the middle of a line while also providing the expected unindent functionality.

@ghost ghost requested a review from Paulb23 July 8, 2021 20:44
@Paulb23
Copy link
Member

Paulb23 commented Jul 8, 2021

That's an idea worth exploring. Though I worry that it might feel inconsistent.

@akien-mga
Copy link
Member

akien-mga commented Feb 8, 2022

This was changed on purpose.

What was the rationale for changing it? I also tend to think that the behavior proposed by this PR makes sense, at least that's what I'm used to in other editors.

The OP deleted their account so this needs to be redone by someone else in a new PR.

@Calinou
Copy link
Member

Calinou commented Feb 8, 2022

As of master 9d1626b, the behavior seems fine to me (similar to 3.x):

simplescreenrecorder-2022-02-08_21.31.58.mp4

@KoBeWi
Copy link
Member

KoBeWi commented Feb 8, 2022

@Calinou Try Shift+Tabbing with caret inside words.

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

Successfully merging this pull request may close these issues.

[Text Editor] Shift+Tab shortcut only works when multiple lines are selected
4 participants