mirror of
https://github.com/hexedtech/codemp-intellij.git
synced 2024-11-21 22:54:48 +01:00
fix: remove cursor from users who move away from synced buffers
This commit is contained in:
parent
1e8306f6e4
commit
044b1f4470
3 changed files with 7 additions and 3 deletions
|
@ -23,7 +23,7 @@ public class BufferSyncAction extends AnAction {
|
||||||
|
|
||||||
String[] active_buffers = CodeMP.getActiveWorkspace().activeBuffers();
|
String[] active_buffers = CodeMP.getActiveWorkspace().activeBuffers();
|
||||||
int choice = Messages.showChooseDialog(
|
int choice = Messages.showChooseDialog(
|
||||||
"Detach from which buffer?",
|
"Sync which buffer?",
|
||||||
"CodeMP Buffer Detach",
|
"CodeMP Buffer Detach",
|
||||||
active_buffers,
|
active_buffers,
|
||||||
"",
|
"",
|
||||||
|
|
|
@ -49,7 +49,11 @@ public class CursorCallback implements Consumer<CursorController> {
|
||||||
try {
|
try {
|
||||||
ApplicationManager.getApplication().runReadAction(() -> {
|
ApplicationManager.getApplication().runReadAction(() -> {
|
||||||
Editor editor = FileUtil.getActiveEditorByPath(this.project, event.buffer);
|
Editor editor = FileUtil.getActiveEditorByPath(this.project, event.buffer);
|
||||||
if(editor == null) return;
|
if(editor == null) {
|
||||||
|
RangeHighlighter previous = CodeMP.HIGHLIGHTER_MAP.remove(event.user);
|
||||||
|
if(previous != null) previous.dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int startOffset = editor.getDocument().getLineStartOffset(event.startRow) + event.startCol;
|
int startOffset = editor.getDocument().getLineStartOffset(event.startRow) + event.startCol;
|
||||||
int endOffset = editor.getDocument().getLineStartOffset(event.endRow) + event.endCol;
|
int endOffset = editor.getDocument().getLineStartOffset(event.endRow) + event.endCol;
|
||||||
|
|
Loading…
Reference in a new issue