This repository has been archived by the owner on Apr 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'LangEclipseIDE/master'
- Loading branch information
Showing
4 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
plugin_ide.core/src-lang/melnorme/lang/ide/core/text/StrictDamagerRepairer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2015 Bruno Medeiros and other Contributors. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Bruno Medeiros - initial API and implementation | ||
*******************************************************************************/ | ||
package melnorme.lang.ide.core.text; | ||
|
||
import org.eclipse.jface.text.DocumentEvent; | ||
import org.eclipse.jface.text.IRegion; | ||
import org.eclipse.jface.text.ITypedRegion; | ||
import org.eclipse.jface.text.Region; | ||
import org.eclipse.jface.text.rules.DefaultDamagerRepairer; | ||
import org.eclipse.jface.text.rules.ITokenScanner; | ||
|
||
/** | ||
* A strict damager-repairer ensures that a damage region for a document event always starts | ||
* at partition start (or before that) | ||
*/ | ||
public class StrictDamagerRepairer extends DefaultDamagerRepairer { | ||
|
||
public StrictDamagerRepairer(ITokenScanner scanner) { | ||
super(scanner); | ||
} | ||
|
||
@Override | ||
public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, | ||
boolean documentPartitioningChanged) { | ||
IRegion region = super.getDamageRegion(partition, e, documentPartitioningChanged); | ||
|
||
int start = region.getOffset(); | ||
int end = region.getOffset() + region.getLength(); | ||
start = Math.min(start, partition.getOffset()); | ||
|
||
return new Region(start, end - start); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters