/** * Stores given change at collection of deferred changes (merging it with others if necessary) and * updates current object state ({@link #length() length} etc). * * @param change new change to store */ private void storeChange(@NotNull TextChangeImpl change) { if (!change.isWithinBounds(length())) { LOG.error( String.format( "Invalid change attempt detected - given change bounds are not within the current char array. Change: %d:%d-%d", change.getText().length(), change.getStart(), change.getEnd()), dumpState()); return; } TextChangesStorage storage = myDeferredChangesStorage.get(); storage.getLock().lock(); try { doStoreChange(change); } finally { storage.getLock().unlock(); } }
/** * @return end offset of the current change at the 'client text', i.e. {@link * #clientStartOffset} plus change text length */ public int getClientEndOffset() { return clientStartOffset + change.getText().length(); }