IDEA-57341 Soft wrap: remove ability to fold wrapped lines in editor

Only console editor gutter shows fold regions that operate on a single logical line now
This commit is contained in:
Denis Zhdanov
2010-08-10 10:30:53 +04:00
parent 949f0d69e5
commit 5a617f3f87
4 changed files with 43 additions and 27 deletions
@@ -670,6 +670,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
}
});
final EditorEx editor = (EditorEx)document.createViewer(editorDocument, myProject);
editor.getSettings().setAllowSingleLogicalLineFolding(true); // We want to fold long soft-wrapped command lines
final EditorHighlighter highlighter = new MyHighlighter();
editor.setHighlighter(highlighter);
@@ -103,4 +103,7 @@ public interface EditorSettings {
boolean isAllSoftWrapsShown();
void setShowAllSoftWraps(boolean show);
boolean isAllowSingleLogicalLineFolding();
void setAllowSingleLogicalLineFolding(boolean allow);
}
@@ -981,7 +981,8 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
if (document.getLineNumber(startOffset) != document.getLineNumber(endOffset)) {
return true;
}
return !myEditor.getSoftWrapModel().getSoftWrapsForRange(startOffset, endOffset).isEmpty();
return myEditor.getSettings().isAllowSingleLogicalLineFolding()
&& !myEditor.getSoftWrapModel().getSoftWrapsForRange(startOffset, endOffset).isEmpty();
}
private Rectangle rectangleByFoldOffset(VisualPosition foldStart, int anchorWidth, int anchorX) {
@@ -42,38 +42,39 @@ public class SettingsImpl implements EditorSettings {
}
// This group of settings does not have UI
private int myAdditionalLinesCount = 5;
private int myAdditionalColumnsCount = 3;
private int myLineCursorWidth = 2;
private boolean myLineMarkerAreaShown = true;
private int myAdditionalLinesCount = 5;
private int myAdditionalColumnsCount = 3;
private int myLineCursorWidth = 2;
private boolean myLineMarkerAreaShown = true;
private boolean myAllowSingleLogicalLineFolding = false;
// These comes from CodeStyleSettings
private Integer myTabSize = null;
private Integer myCachedTabSize;
private Integer myTabSize = null;
private Integer myCachedTabSize = null;
private Boolean myUseTabCharacter = null;
// These comes from EditorSettingsExternalizable defaults.
private Boolean myIsVirtualSpace = null;
private Boolean myIsCaretInsideTabs = null;
private Boolean myIsCaretBlinking = null;
private Integer myCaretBlinkingPeriod = null;
private Boolean myIsRightMarginShown = null;
private Integer myRightMargin = null;
private Boolean myAreLineNumbersShown = null;
private Boolean myIsFoldingOutlineShown = null;
private Boolean myIsSmartHome = null;
private Boolean myIsBlockCursor = null;
private Boolean myIsWhitespacesShown = null;
private Boolean myIndentGuidesShown = null;
private Boolean myIsAnimatedScrolling = null;
private Boolean myIsAdditionalPageAtBottom = null;
private Boolean myIsDndEnabled = null;
private Boolean myIsWheelFontChangeEnabled = null;
private Boolean myIsVirtualSpace = null;
private Boolean myIsCaretInsideTabs = null;
private Boolean myIsCaretBlinking = null;
private Integer myCaretBlinkingPeriod = null;
private Boolean myIsRightMarginShown = null;
private Integer myRightMargin = null;
private Boolean myAreLineNumbersShown = null;
private Boolean myIsFoldingOutlineShown = null;
private Boolean myIsSmartHome = null;
private Boolean myIsBlockCursor = null;
private Boolean myIsWhitespacesShown = null;
private Boolean myIndentGuidesShown = null;
private Boolean myIsAnimatedScrolling = null;
private Boolean myIsAdditionalPageAtBottom = null;
private Boolean myIsDndEnabled = null;
private Boolean myIsWheelFontChangeEnabled = null;
private Boolean myIsMouseClickSelectionHonorsCamelWords = null;
private Boolean myIsRenameVariablesInplace = null;
private Boolean myIsRefrainFromScrolling = null;
private Boolean myUseSoftWraps = null;
private Boolean myIsAllSoftWrapsShown = null;
private Boolean myIsRenameVariablesInplace = null;
private Boolean myIsRefrainFromScrolling = null;
private Boolean myUseSoftWraps = null;
private Boolean myIsAllSoftWrapsShown = null;
public boolean isRightMarginShown() {
return myIsRightMarginShown != null
@@ -408,6 +409,16 @@ public class SettingsImpl implements EditorSettings {
myIsAllSoftWrapsShown = Boolean.valueOf(show);
}
@Override
public boolean isAllowSingleLogicalLineFolding() {
return myAllowSingleLogicalLineFolding;
}
@Override
public void setAllowSingleLogicalLineFolding(boolean allow) {
myAllowSingleLogicalLineFolding = allow;
}
private void fireEditorRefresh() {
if (myEditor != null) {
myEditor.reinitSettings();