texstudio
texstudio copied to clipboard
Weird behavior when using mouse to select text to the end of document
When I use the mouse to select text to the end of a document, once it reaches the end, the cursor somehow moves back to somewhere in the middle of the document. I'm not sure if this is related to Qt or texstudio itself. Using Shift+Down to select doesn't have this issue.
Environment
- TeXstudio: 4.2.1 (having the same issue before this version I believe)
- Qt: 5.15.2
- OS: Windows 10
- TeX distribution: miktex
Expected behavior
The mouse cursor should stay at the end of the document and selection of text just ends there.
Actual behavior
The mouse cursor moves to somewhere in the middle of the document once it reaches the end of the document. It seems that internally some modulo operation is used causing the issue.
How to reproduce
Use the mouse to select text to the end of a document.
Sorry, can't reproduce with current 4.3.1 Qt6 Win10. Check it with latest portable version of txs with Qt6.
I use a Qt5 version because the Qt6 version doesn't display things consistently on multiple of my computers. Qt6 doesn't seem to have this issue. When I tried to test on the latest portable Qt5 version, texstudio crashed whenever I dragged a .tex document into it. Again this is on Windows 10.
not reproducible txs/win qt5 is deprecated, 4.4.0 will not have a win/qt5 version.
The same issue exists in the version below:
TeXstudio 4.4.0 (git 4.4.0) Using Qt Version 6.4.1, compiled with Qt 6.4.1 R
Is this reproducable? Can you clarify what mouse cursor movement you exactly do until the cursor jumps away (s. below)? Does this happen in all documents?
can't reproduce with TeXstudio 4.4.1 (git 4.4.1) Using Qt Version 6.4.1, compiled with Qt 6.4.1 R for Win10 (4.5.1 is the only newer version available):

Nothings random happens when dragging the cursor to the last character of the last line.
Now I can see something that could be what you see: Set the text cursor in the last line (not necessary but simplifies action). No further text needed in that line. Move mouse cursor over the last line, press left mouse button, then drag it over the last line number and then one line below (this may be the editor status line). Then the text jumps upwards and probably repeats in a loop. Same in 4.51. This seems not depend on the Adv. Editor setting for Vertical Overscroll.
Tried this document with about 20 lines. Just used mouse to press and select text from somewhere in the middle to the end, then the selected area seemed to repeatedly restart from line 1.

I think this is basically what I described. Your mouse cursor moves down left to the editor and there over the status line. Maybe @sunderme has some idea.
looks like you need to place the mouse pointer at the "L" of "Line". So below the line numbers in the status line.
It seems what you have to do is moving the mouse cursor past the left edge of the editor below the last line (not necessarily line number panel activated), s. red area. With overscroll active the line after the last line may not be virtually the status line.

This happens even if you disable line numbers, folding and Line Change States (will also deactivate line marks), i.e. no editor side panels visible. So moving over the left edge and past last line seems to be the criterion.
@sunderme not fixed, assume from my tests that the following should be used:
if(ln>=lines()){
ln=lines()-1;
}
I don't see fails, demonstrate.
click into last line and drag into the red rectangle


Test ok