private static Caret getNextCaretToProcess(@NotNull Editor editor) {
   for (Caret caret : editor.getCaretModel().getAllCarets()) {
     if (caret.getUserData(CARET_PROCESSED) == null) {
       return caret;
     }
   }
   return null;
 }
 private static void markCaretAsProcessed(@NotNull Caret caret) {
   caret.putUserData(CARET_PROCESSED, Boolean.TRUE);
 }
 private static void clearCaretMarkers(@NotNull Editor editor) {
   for (Caret caret : editor.getCaretModel().getAllCarets()) {
     caret.putUserData(CARET_PROCESSED, null);
   }
 }