mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-10 12:34:06 +02:00
Added util class for sorting marks by key
This commit is contained in:
parent
6c27b40070
commit
5015ed8fab
@ -22,6 +22,7 @@ package com.maddyhome.idea.vim.common;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* This represents a file mark. Each mark has a line and a column, the file it applies to, and the mark key
|
||||
@ -172,6 +173,27 @@ public class Mark
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
public static class KeySorter implements Comparator
|
||||
{
|
||||
public int compare(Object o1, Object o2)
|
||||
{
|
||||
Mark a = (Mark)o1;
|
||||
Mark b = (Mark)o2;
|
||||
if (a.key < b.key)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (a.key > b.key)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private char key;
|
||||
private int line;
|
||||
private int col;
|
||||
|
Loading…
Reference in New Issue
Block a user