Alexey-T / CudaText

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

Dragging a word is freezing Cuda #5450

Closed pintassilgo closed 3 months ago

pintassilgo commented 3 months ago

As title says. Even in super small documents, with less than 200 chars in total.

Select a word, then try to drag it to other position. Cuda freezes for like >3 seconds for me.

pintassilgo commented 3 months ago

Also I'm not sure if Cuda doesn't have visual feedback on where content will be dropped or if it's consequence of this freezing. I see nothing.

Compare to VSCode: image

Alexey-T commented 3 months ago

When we drag-drop block inside the same document, drop position is shown. with red vertical line. it works on gtk2/qt5 on all OSes. no? do you drag from other file?

pintassilgo commented 3 months ago

I can barely see it, but it's not consistent. I move across the document while dragging, but only sometimes I can see the red mark. Probably a side effect of this freezing issue.

pintassilgo commented 3 months ago

Look at where mouse cursor is and where the red mark is... Red mark should be in line 10. image

But this is probably caused by the freezing.

Alexey-T commented 3 months ago

maybe freezing is what you see - 1-2 secs delay of red mark moving? yes it is made so on purpose. it is delay of repaining the red mark. try it in .txt file w/o any LSP - the same freeze?

pintassilgo commented 3 months ago

No, it really freezes. After I drop, Cuda remains unusable for like 3 seconds.

And there shouldn't be any delay in repainting the red mark. VSCode for instance is instant, I can move mouse very fast while dragging and the visual feedback is instantly displayed on any line below the mouse pointer.

Alexey-T commented 3 months ago

will see ho to improve red mark speed.

freeze: is it happening with LSP only? on .txt files too?

pintassilgo commented 3 months ago

On a new document without lexer: same issue.

Creating plugin_disabled file in cuda_lsp folder and restarting CUda: same issue.

So it's not LSP fault.

Alexey-T commented 3 months ago

ok, not LSP. any other plugin affects it? the same on clean Cud?

pintassilgo commented 3 months ago

If I hold left click to make a selection and drag mouse very fast over the text, Cuda is good to instantly display the selection while I'm moving the mouse. I see no reason for word dragging and the red mark to not behave the same.

pintassilgo commented 3 months ago

the same on clean Cud?

I have the Flatpak version here and it doesn't even recognizes Python engine, so it's super clean, but even then it suffers the same issue. So the issue is in Cuda core.

pintassilgo commented 3 months ago

I just tested GTK release and it doesn't have this issue. So it's related to Qt build. Both Qt5 and Qt6, because as you know the Flatpak I tested uses Qt6 and it's also affected.

But even the GTK doesn't have the ideal response of the red mark, probably because of the uneeded delay you added and should be removed.

Alexey-T commented 3 months ago

Yes, right. I should speed up reaction of red mark to mouse drag.

pintassilgo commented 3 months ago

Did you manage to reproduce the freezing in the Qt5 build? As I said it's the only one affected, GTK is fine,

Alexey-T commented 3 months ago

not yet. I test with my little changes. from today. red mark is now 'faster' updating. http://uvviewsoft.com/c/

pintassilgo commented 3 months ago

It's fixed! I was ready to say I could only properly test with a GTK build, because for Qt5 build I was expecting I couldn't see much improvement in red mark because of the freezing, because they were probably two different issues (Qt5 freezing and red mark delay). But it's perfect now even in this Qt5 build, thank you.

Obviously I only tested with Qt5 build because I don't have an updated GTK, but there's no reason for it not to be perfect too.

Alexey-T commented 3 months ago

But for gtk2, it is not fixed yet. I marked this issue for me here..

pintassilgo commented 3 months ago

Confirmed. I just tried the gtk beta you posted in #5454 (and deleted the issue after) and there's a minor delay for the red mark to be displayed while you drag text across the document. It's not important, I believe it's good enough not to be something to worry about, but it's not perfect as it is in Qt build. Glad I use the Qt version.