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

multicursor instances breaks hungry delete #26

Open
biblicabeebli opened this issue Jun 26, 2021 · 3 comments
Open

multicursor instances breaks hungry delete #26

biblicabeebli opened this issue Jun 26, 2021 · 3 comments

Comments

@biblicabeebli
Copy link

biblicabeebli commented Jun 26, 2021

v1.6.0
To reproduce:

  1. create a new file
  2. set up a bunch of whitespace-only lines in the file (IDE may fight you if you have trailing whitespace deletion configured)
  3. do a multicursor selection with overlapping whitespace regions.
  4. do hungry delete command.

example (dots indicate whitespace, vertical bars are cursors):

.......|
.......|
.......|

You will get this message:
Running the contributed command: 'extension.hungryDelete' failed.

Desired behavior:

  1. if all instances of the multiple cursors have whitespace preceding them then they should all be deleted according to user's settings.
  2. if any instances of the whitespace would overlap within the delete content of a cursor, those cursors should merge into a single cursor instance. Any overlapping whitespace should probably be wholly deleted ignoring the keep-a-space rule - perhaps detect the condition of All the whitespace instances having a match for that rule.

Oops, initially I thought this occurred for all instances, it is slightly more restrictive than that, editted.

@biblicabeebli
Copy link
Author

I don't know what reasonable behavior is for mixed selections of whitespace and text. With word-delete as the other behavior for ctrl-delete the behavior is currently to do word-delete where appropriate and hungry delete where appropriate. this seems acceptable, its what the user would expect the extension to do.

@Jasonlhy
Copy link
Owner

@biblicabeebli
I think it make sense to merge the delete range

May be:
Range.Start = 1st overlapped hungry-delete-range end
Range.End = last overlapped hungry-delete-range end

@biblicabeebli
Copy link
Author

Since posting quite a while ago there has been some improvement in the behavior such that it sometimes works desirably, but there are cases where it still crashes. I will try and remember to work out what the scenario is and post it, I think it is when there are separated sections or multiple ranges that end up getting merged.

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

No branches or pull requests

2 participants