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

Fix indent selection #3102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix indent selection #3102

wants to merge 1 commit into from

Conversation

vicencb
Copy link

@vicencb vicencb commented Dec 26, 2023

When indenting a selection and the selection starts at the first column,
it is expected that the updated selection start stays at the first column.
This patch fixes this.

N.B.: this patch is displayed better ignoring white space.

@dustdfg
Copy link
Contributor

dustdfg commented Dec 27, 2023

Honestly, I don't understand what it change and what desired behavior even with a help of your comment (Is it even related?).

What should I do to see the change?

I tried to select with mouse/keyboard from two different directions and didn't notice change, maybe I overlooked it...

@vicencb
Copy link
Author

vicencb commented Dec 27, 2023

These are the steps to reproduce the issue:

  1. Select some lines of text, the selection must start at the first column.
  2. Execute IndentSelection (bound to Tab by default).

The selection after doing the indent doesn't start at the first column.
The expected behavior is that the selection still starts at the first column.

The selection direction has no effect on this issue.


That same issue from another point of view:

  1. Select whole lines of text.
  2. Execute IndentSelection.

The selection after doing the indent doesn't include whole lines. The first selected line has a gap at the beginning.

@vicencb
Copy link
Author

vicencb commented Dec 27, 2023

This fix is unrelated to issue #3055.

@dustdfg
Copy link
Contributor

dustdfg commented Dec 27, 2023

OK. I see now. I tried to find the intersection with the issue you commented because I just expected it after the comment, sorry...


It is seems to me that this behavior is a matter of taste. Just want to understand where and why do you need this behavior? The only place when it seems profitable is when you decided to indent some part of text and then after indenting you suddenly change your mind and decide to delete the part you just indented but after pressing delete you end up with one "annoying" invisible tab...

@vicencb
Copy link
Author

vicencb commented Dec 27, 2023

The use case that is mostly affected by this is a few lines of code need to be moved somewhere else, but the destination has a different indent level.
I would like to select the code, indent, cut and paste it. With the current behavior this is not possible.

Regarding the matter of taste: the current code already has a special case for when the selection starts at the first column, it looks like it pretends to do the behavior i expect, but it fails to.

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 this pull request may close these issues.

None yet

2 participants