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

How to block selection? #250

Open
x10000year opened this issue Nov 2, 2021 · 8 comments
Open

How to block selection? #250

x10000year opened this issue Nov 2, 2021 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@x10000year
Copy link

in most term softwares, ALT+mouse drag can select a block of text. but it doesn't work correctly in windterm.

@kingToolbox
Copy link
Owner

WindTerm already supports this feature. If you think the selection is incorrect, please uncheck the menu item Menubar - Mode - Word Wrap to turn off the wrap mode and try again. I believe you will get the result you want. 😄

@x10000year
Copy link
Author

Unforunately I want to enable Word Wrap by default otherwise the command line will not be wrapped when it is too long. I think the current behavior of block selection when Word Wrap is disabled is uncommon if not useless (the width of the text you copied is determined by the length of the last line of the block). Can it be changed?

@kingToolbox
Copy link
Owner

Sorry for the late reply.

Of course, there is definitely no problem technically. The current Column Selection feature is designed for WindEdit, which may not be suitable for WindTerm.

Internally, there are two types of text lines, the physical lines are separated by \r, \n or \r\n, and the displayed lines by auto-wrap. The reason why it is designed this way is because I think Column Selection should applied to physical lines instead of visible lines. Let's take an example, the gray text represents the column selection.

Unwrapped text lines with column selection:

0123456789
0123456789

Let's keep the selection and make an auto-wrap after the character 4, now the column selection of WindTerm is as follows: :

01234
56789
01234
56789

Instead of:

01234
56789
01234
56789

Because the Column Selection only selects the second and third characters of each physical line, and 7 and 8 should not be included. Although they are the second and third characters in the visible line, they are still the eighth and ninth characters in the physical line.

If the Column Selection is appled to visible lines, an important question is, if the window size changes, how will the column selection change?

keep the selection:

012345
6789
012345
6789

or recalculate the selecion?

012345
6789
012345
6789

I don't think either is reasonable. The first one no longer looks like a Column Selection, and the second one violates the user's initial selection. What do you think?

However, I saw an interesting design in PuTTY. When the window size changes, PuTTY will clear the current selection, thus avoiding the problem. 😄

@x10000year
Copy link
Author

I think applying to physical lines is ok. But, the columns that can be selected should not be limited to the length of the last line.

For text:

12345678
abc

I cannot select the following unless I disable word wrap:

12345
abc

@kingToolbox
Copy link
Owner

kingToolbox commented Nov 6, 2021

Yes, I knew this problem when I was developing Column Selection, but for WindEdit, this problem does not affect the use, and limited by my initial design, this modification is not that simple, so it has not been improved.

I will improve this in subsequent versions, but due to the many features to be developed, it may take a while. I will update the progress here.

For now, since WindTerm supports multiple selections, you can use mouse to select 12345 and abc respectively when pressing the Ctrl key, I know this is more cumbersome, but this can temporarily meet your needs. In addition, when you press Ctrl+Alt, you can also add column selection to the existed multiple selections.

@kingToolbox kingToolbox self-assigned this Nov 6, 2021
@kingToolbox kingToolbox added the enhancement New feature or request label Nov 6, 2021
@x10000year
Copy link
Author

x10000year commented Nov 6, 2021

probably applying to visible lines is better since most other tools do the same thing? least surprise to users?

@kingToolbox
Copy link
Owner

Thank you. I studied several text editors, and found that, as you said, they did not realize the real column selection, but multiple selections, that is, only visible lines was considered, not physical lines. I will think more about this. I still hope that real column selection can be achieved while solving this problem.

If there is any progress, I will update here.

@kingToolbox
Copy link
Owner

The new WindTerm_2.2.0_Prerelease_5 version has been released, and this issue has been solved, please download and check it, thank you.

BTW:
After consideration, column selection is more meaningful for visible lines. So the final implementation design should be similar to other tools. As you said, users will be more familiar with this design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants