mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
IDEA-61700 Add soft wraps support to VCS window
Instructed soft wrap appliance place VCS_DIFF to use the same value as MAIN_EDITOR (results in soft wraps appliance at vcs diff window if necessary)
This commit is contained in:
+13
-1
@@ -151,6 +151,10 @@ public class EditorSettingsExternalizable implements NamedJDOMExternalizable, Ex
|
||||
for (String placeName : placeNames) {
|
||||
try {
|
||||
SoftWrapAppliancePlaces place = SoftWrapAppliancePlaces.valueOf(placeName);
|
||||
if (place == SoftWrapAppliancePlaces.VCS_DIFF) {
|
||||
// Don't keep separate setting for vcs diff window for now and let it share the value for main editor.
|
||||
continue;
|
||||
}
|
||||
myPlacesToUseSoftWraps.add(place);
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
@@ -258,7 +262,15 @@ public class EditorSettingsExternalizable implements NamedJDOMExternalizable, Ex
|
||||
}
|
||||
|
||||
public boolean isUseSoftWraps(@NotNull SoftWrapAppliancePlaces place) {
|
||||
return myPlacesToUseSoftWraps.contains(place);
|
||||
if (myPlacesToUseSoftWraps.contains(place)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// For now use soft wraps at vcs diff if they are enabled for the main editors.
|
||||
if (place == SoftWrapAppliancePlaces.VCS_DIFF) {
|
||||
return myPlacesToUseSoftWraps.contains(SoftWrapAppliancePlaces.MAIN_EDITOR);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setUseSoftWraps(boolean use) {
|
||||
|
||||
-17
@@ -65,7 +65,6 @@ public class SoftWrapApplianceManager implements FoldingListener, DocumentListen
|
||||
|
||||
private final List<SoftWrapAwareDocumentParsingListener> myListeners = new ArrayList<SoftWrapAwareDocumentParsingListener>();
|
||||
private final List<IncrementalCacheUpdateEvent> myCacheUpdateEvents = new ArrayList<IncrementalCacheUpdateEvent>();
|
||||
private final List<SoftWrapApplianceStrategy> myApplianceStrategies = new ArrayList<SoftWrapApplianceStrategy>();
|
||||
|
||||
private final ProcessingContext myContext = new ProcessingContext();
|
||||
private final FontTypesStorage myOffset2fontType = new FontTypesStorage();
|
||||
@@ -110,28 +109,12 @@ public class SoftWrapApplianceManager implements FoldingListener, DocumentListen
|
||||
myLineWrapPositionStrategy = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers given strategy to use within the current manager.
|
||||
*
|
||||
* @param strategy strategy to use during deciding if soft wraps should be recalculated for particular document region.
|
||||
*/
|
||||
public void addApplianceStrategy(@NotNull SoftWrapApplianceStrategy strategy) {
|
||||
myApplianceStrategies.add(strategy);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"ForLoopReplaceableByForEach"})
|
||||
private void recalculateSoftWraps() {
|
||||
if (myVisibleAreaWidth <= 0 || myCacheUpdateEvents.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Counter-based loop is preferred to for-each in order to avoid unnecessary performance degradation.
|
||||
for (int i = 0; i < myApplianceStrategies.size(); i++) {
|
||||
if (!myApplianceStrategies.get(i).processSoftWraps()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
myLastDocumentStamp = myEditor.getDocument().getModificationStamp();
|
||||
// There is a possible case that new dirty regions are encountered during processing, hence, we iterate on regions snapshot here.
|
||||
List<IncrementalCacheUpdateEvent> events = new ArrayList<IncrementalCacheUpdateEvent>(myCacheUpdateEvents);
|
||||
|
||||
Reference in New Issue
Block a user