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

Text jumping to the left when moving other text up #12

Closed
hq6 opened this issue May 23, 2019 · 4 comments
Closed

Text jumping to the left when moving other text up #12

hq6 opened this issue May 23, 2019 · 4 comments

Comments

@hq6
Copy link

hq6 commented May 23, 2019

Consider the following text.

+-------------+                                       +-----------+
|             |<------------------------------------->|           |
|             |                                       |           |
|             |                                       |           |
+------+------+                                       +-----------+
  |  ^ |
  |  | |
  |  | |                 ffffffffffffffff               +---+
  |  | +----------------------------------------------->|   |
  |  +--------------------------------------------------|   |
  |                                                     |   |
  |                                                     +-+-+
  |                                                       |
  +-------------------------------------------------------+

If I visual-block select the series of ffffff.. and move it up using schlep, the result is the following.

+-------------+                                       +-----------+
|             |<------------------------------------->|           |
|             |                                       |           |
|             |                                       |           |
+------+------+                                       +-----------+
  |  ^ |
  |  | |                 ffffffffffffffff
  |  | |                                +---+
  |  | +----------------------------------------------->|   |
  |  +--------------------------------------------------|   |
  |                                                     |   |
  |                                                     +-+-+
  |                                                       |
  +-------------------------------------------------------+

I'm not sure if this is the intended behavior, but the behavior I desire would be the following:

+-------------+                                       +-----------+
|             |<------------------------------------->|           |
|             |                                       |           |
|             |                                       |           |
+------+------+                                       +-----------+
  |  ^ |
  |  | |                 ffffffffffffffff
  |  | |                                                +---+
  |  | +----------------------------------------------->|   |
  |  +--------------------------------------------------|   |
  |                                                     |   |
  |                                                     +-+-+
  |                                                       |
  +-------------------------------------------------------+

That is, when a visually selected block upwards, it effectively exchanges the whitespace characters above with the text I am moving, rather than effectively deleting is.

Is there a way to do this with this plugin today? If not, how big of a change would it be to enable it?

@zirrostig
Copy link
Owner

That is the intended behavior, however I agree that in this example it seems weird. This is happening because schlepp does not replace moved contents with anything like spaces. Solving this also requires discussing what should happen when there is text to the right of what is being moved in. Also considering what does it do when traversing over existing non-whitespace text; clobber it? what if the text keeps moving past it, should the old text be restored?

Given this

+-------------+                                       +-----------+
|             |<------------------------------------->|           |
|             |                                       |           |
|             |                                       |           |
+------+------+                                       +-----------+
  |  ^ |                 ffffffffffffffff
  |  | |
  |  | |                                                +---+
  |  | +----------------------------------------------->|   |
  |  +--------------------------------------------------|   |
  |                                                     |   |
  |                                                     +-+-+
  |                                                       |
  +-------------------------------------------------------+

Moving the ffff.. up does this currently

+-------------+                                       +-----------+
|             |<------------------------------------->|           |
|             |                                       |           |
|             |                                       |           |
+------+------+          ffffffffffffffff                             +-----------+
  |  ^ |
  |  | |
  |  | |                                                +---+
  |  | +----------------------------------------------->|   |
  |  +--------------------------------------------------|   |
  |                                                     |   |
  |                                                     +-+-+
  |                                                       |
  +-------------------------------------------------------+

I think it should do the following if it is going to be consistent with the previously proposed movement.

+-------------+                                       +-----------+
|             |<------------------------------------->|           |
|             |                                       |           |
|             |                                       |           |
+------+------+          ffffffffffffffff             +-----------+
  |  ^ |
  |  | |
  |  | |                                                +---+
  |  | +----------------------------------------------->|   |
  |  +--------------------------------------------------|   |
  |                                                     |   |
  |                                                     +-+-+
  |                                                       |
  +-------------------------------------------------------+

The proposed feature here should be adding an option to preserve surrounding text position, letting schlepp effectively clobber any text it moves over top of and replace gaps left with spaces. I'm also not sure how useful this feature would be in most other cases too.

Adding the feature should not be too difficult if there is no need to worry about restoring text that was moved through but not replaced by the moved text, restoring the old text adds an extra piece of post-processing after every move that could end up being quite expensive and/or difficult to do.

@hq6
Copy link
Author

hq6 commented Jun 3, 2019

I actually wrote a new plug-in to solve this based on a displacement-based model.
I think it's sufficiently different behavior that it would confuse people to have it be a feature in this plug-in.

@hq6 hq6 closed this as completed Jun 3, 2019
@zirrostig
Copy link
Owner

Would you mind linking the plug-in? I think other users of schlepp might find good use from it too.

@hq6
Copy link
Author

hq6 commented Jun 9, 2019

Sure, I just put it up here. I hadn't written the README earlier.

I would greatly appreciate any feedback at root@hq6.me and any issues created as such.

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