zielu / GitToolBox

GitToolBox IntelliJ plugin
GNU General Public License v3.0
604 stars 73 forks source link

Caret not placed correctly when blame is "After line" #377

Open rcastagno opened 2 years ago

rcastagno commented 2 years ago

Can't say exactly when this started, but it happens continuously.

What happens is that the cursor is placed incorrectly when inline blame is active, and is configured "After line".

The consequence is that when I start typing, the cursor is not where I expect it to be.

For example, I place cursor at the end of a line and press enter; for an instant it appears like this:

image

but immediately becomes this:

image

and if I start typing, this is what happens:

image

(note: the character is one position left of where expected)

zielu commented 2 years ago

Hi, which plugin and IDE versions are you using ?

rcastagno commented 2 years ago

Hi, which plugin and IDE versions are you using ?

Right:

IntelliJ IDEA 2021.3.1 (Ultimate Edition) Build #IU-213.6461.79, built on December 28, 2021

Plugin version: 212.8.4

BTW, some additional pieces of information:

zielu commented 2 years ago

I cannot reproduce it. What other plugins do you have installed ? Maybe it's some interaction that is causing this.

rcastagno commented 2 years ago

Good catch! Yes and no.

I'll try to explain.

I see it live because I'm using File Watchers plugin.

The rule I'm using is configured with this flag set: "Auto-save edited files to trigger the watcher"

Which points to the real issue. [UPDATE] Which is, the problem happens when file is saved!

To reproduce: 1) open a file in a git project 2) do something that creates a new line with auto-indent (like, press "enter" at the end of an indented line) 3) alt+tab to change window; this should trigger Idea auto-save 4) alt+tab back to Idea 5) press any key

https://user-images.githubusercontent.com/198684/149148353-d28c2e46-c6b0-4cf0-8a5d-64bb7078248e.mp4

zielu commented 2 years ago

Does the action you have hooked to file watcher modify the file ?

There is an issue that I'm aware of that affects inline blame when file is changed externally - for example when you do Revert from IDE.

rcastagno commented 2 years ago

The test I've recorded in the mini-screencast I've done after disabling File Watchers.

I simply do:

What's modifying the file is "General \ On save \ Remove trailing spaces on: all lines"

zielu commented 2 years ago

What about OS and file type ? Maybe they somehow factor into this.

zielu commented 2 years ago

A small update. I have found a property in the IDE API that I'm using for inline blame that might cause this behaviour - namely caret being positioned after the blame. I'll create a dev build soon so that we can test it out.

Dev build is ready gittoolbox-212.8.5-SNAPSHOT.zip

rcastagno commented 2 years ago

Tried the dev build, but it seems it still does the same effect.

OS: Windows File type: cfc/cfm (coldfusion) and java

zielu commented 2 years ago

Small update - still no luck reproducing this issue.

ghost commented 4 months ago

I've had this issue for year.

To reproduce the issues resize the editor so the blame is shown off screen Press right arrow to move caret to the end of the line, then press again and the caret will move to the end of the blame text Press up or down arrow and the editor will scroll horizontally.

Does not occur when turning "Show Inline Blame" off as shown in the second half of the recording.

https://github.com/zielu/GitToolBox/assets/97417601/a7765f59-5335-4440-b60e-10733c808e4d

WebStorm 2024.1 Build #WS-241.14494.235, built on March 28, 2024 Runtime version: 17.0.10+8-b1207.12 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 14.0 GC: G1 Young Generation, G1 Old Generation Memory: 16384M Cores: 10 Metal Rendering is ON Registry: ide.tooltip.initialDelay=0 ide.balloon.shadow.size=0 editor.distraction.free.mode=true debugger.new.tool.window.layout=true ide.new.editor.tabs.vertical.borders=true ide.animate.toolwindows=true ide.experimental.ui=true ide.editor.tab.selection.animation=true terminal.new.ui=true ide.images.show.chessboard=true Non-Bundled Plugins: quokka.js (1.0.443) com.intellij.properties (241.14494.150) ru.adelf.idea.dotenv (2024.1) DBN (3.4.3211.0) PlantUML integration (7.10.1-IJ2023.2) com.github.copilot (1.5.2.5345) com.mallowigi (95.0.0) com.ramusthastudio.plugin.unixtimestamp (6.3.0) com.chrisrm.idea.MaterialThemeUI (9.2.1) com.intellij.lang.jsgraphql (241.14494.150) zielu.gittoolbox (500.2.6+233) org.jetbrains.plugins.stylus (241.14494.140)

zielu commented 4 months ago

Note to self: it's related to Editor > General > Virtual Space > Allow caret placement: After the end of line being enabled

zielu commented 4 months ago

@ramonfallon I played around and found two things: