Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.54k stars 174 forks source link

Cuda shouldn't reset block selection when you click while holding Alt+Shift #5757

Closed pintassilgo closed 3 weeks ago

pintassilgo commented 4 weeks ago

If you hold Alt, click and drag, you make block selection. Correct.

If you place cursor at a position, release any click, then hold Alt+Shift and click somewhere, a block selection will be made covering the area between the previous cursor position and the position you just clicked. Correct.

But if, when there's already a block selection and you repeat Alt+Shift+click, block selection should be expanded/corrected reusing the same starting coordinates. Instead, block selection is reset, a new block that makes little sense is created.

https://github.com/user-attachments/assets/bc6eca9d-c4b6-4cd0-af3a-46913d0f0e49

If you have any doubt if what I'm suggesting is correct, think of Shift selection. You place caret at any position, then hold Shift and click a different position. A selection will be created between the last two cursor positions. If, while the selection is still visible, you Shift+click again on other position, the selection will be expanded keeping the FIRST coordinates (the oldest cursor position), not the last.

In cumulative selections made with Shift, the initial caret position is always preserved as one of the range boundaries of the selection, but Cuda is failing do honor that in Shift+Alt.

Alexey-T commented 3 weeks ago

beta. test it also with '||' indicator in statusbar, when selecting col block w/o ALT. cudatext.zip

pintassilgo commented 3 weeks ago

Not fixed, I don't see any difference with this beta.

Alexey-T commented 3 weeks ago

check that you test new beta, time is 16:57:04. i run this beta and see ok work in this issue regard.

Alexey-T commented 3 weeks ago

what I do

pintassilgo commented 3 weeks ago

check that you test new beta, time is 16:57:04. i run this beta and see ok work in this issue regard.

Yes, it's this one.

Alexey-T commented 3 weeks ago

Are my steps above giving ok work? You did other steps?

pintassilgo commented 3 weeks ago

Alt+click and drag to seelect a block from x0,y0 now Alt+Shift+click in different places. all give blocks from x0,y0

Yes, that way it works, thanks!

It just need to be improved to the case I describe in first comment. Instead of doing the first block by Alt click and drag, do a single Alt+Shift+click, without drag. Steps:

  1. Place cursor at random position, like x0y0.
  2. Hold Alt and Shift together, move mouse to different position then do a simple click (while holding Alt+Shift).
  3. Will make a block selection as expected. BUT if in the next click you're still holding Alt+Shift, previous block should be expanded using first cursor position as coordinates, but it doesn't work, a new nonsense block is made.
pintassilgo commented 3 weeks ago

One more thing:

Expected: it should make the selection as if you drew a rect between initial and final curstor position.

Current: the empty line breaks everything and selection is made completely off the rect.

Screenshot: image

Can you see mouse cursor at down right? That's where I clicked while holding Alt+Shit. What should be selected if Cuda didn't have this issue:

image

Alexey-T commented 3 weeks ago

last moment is not fixed yet. original one is fixed? cudatext.zip

pintassilgo commented 3 weeks ago

Fixed, thanks!

Now the only remaining issue I see is my previous comment, about lines with different length producing unexpected result (should be the same result as if you drew a rect).

Alexey-T commented 3 weeks ago

fix made. cudatext.zip

pintassilgo commented 3 weeks ago

Fixed, it's done, thank you!