Alexey-T / CudaText

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

When doing column selection, cursor shouldn't be displayed at invalid positions at right #5551

Closed pintassilgo closed 2 weeks ago

pintassilgo commented 2 weeks ago

When doing col selection, if you release click way at the right of the content, cursor will be displayed there, but it shouldn't, it should be limited to after the last existing char in each line.

Cuda: image

Sublime: image

VSCode: image

Alexey-T commented 2 weeks ago

With "caret_after_end":false . Right, will fix.

Alexey-T commented 2 weeks ago

Fixed, will be in the next update/beta.

Alexey-T commented 2 weeks ago

As I see in code, it was made so on purpose: e.g. to allow WIDE column blocks when mouse is pressed after the line-end of short line. yes, it places incorrect carets, but they are fixed after first caret move. after my new fix, mouse pressing after line-end makes caret pos at line-end, and makes block from THAT pos, so it is not very handy now to select blocks if we start it at short line.

if you are ok with that, ok.

pintassilgo commented 2 weeks ago

So are you saying the new version limits block reach to max column of the line you clicked to start the selection, not allowing to catch wider lines? This is bad.

Why not simply adjust cursor up to each line-end as other editors such as Sublime and VSCode do?

Sublime: image

VSCode: image

Alexey-T commented 2 weeks ago

So are you saying the new version limits block reach to max column of the line you clicked to start the selection, not allowing to catch wider lines?

yes.

Screenshot_2024-06-13_19-18-19

Why not simply adjust cursor up to each line-end as other editors such as Sublime and VSCode do?

From my POV, this picture of ST / VS shows not column selection, ie column is not right. not sure I want to change code to make it like ST....

pintassilgo commented 2 weeks ago

The result of selection in ST and VS is exactly the same as Cuda release i.e. selects everything within the 'rect area' you draw while holding the mouse. The difference is aesthetics, because it makes no sense to display cursor in a invalid position, so ST and VS correct the cursor in each line to line-end. Imo this is clearly correct and that's what I'm requesting Cuda to be the same.

Current result after you fix is bad.

By the way, I still stand with the suggestion I made previously to display the rect frame when you're performing column selection. I'm talking about that useless frame you removed from show_mouse_sel_frame, it would be better used here.

Alexey-T commented 2 weeks ago

to display the rect frame when you're performing column selection. I'm talking about that useless frame you removed from show_mouse_sel_frame, it would be better used here.

Ok, added. Other suggestion: agreed too.

Alexey-T commented 2 weeks ago

New beta, better?

cudatext.xz.zip

pintassilgo commented 2 weeks ago

Looks perfect to me, thanks!

Alexey-T commented 2 weeks ago

make sure it works ok for Alt+[mouse drag] too (I cannot test it w/o changing Linux settings).

pintassilgo commented 2 weeks ago

That's how I tested. I don't even have that button in statusbar to change selection behavior, I use Alt when I want col selection.