mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
soft wrap at right margin in distraction free mode, to keep text centered (related to IDEA-150440)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -568,6 +568,10 @@ public final class EditorUtil {
|
||||
return width > 0 ? width : 1;
|
||||
}
|
||||
|
||||
public static int getPlainSpaceWidth(@NotNull Editor editor) {
|
||||
return getSpaceWidth(Font.PLAIN, editor);
|
||||
}
|
||||
|
||||
public static int getTabSize(@NotNull Editor editor) {
|
||||
return editor.getSettings().getTabSize(editor.getProject());
|
||||
}
|
||||
|
||||
@@ -7045,7 +7045,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
return column;
|
||||
}
|
||||
|
||||
boolean isInDistractionFreeMode() {
|
||||
public boolean isInDistractionFreeMode() {
|
||||
return EditorUtil.isRealFileEditor(this)
|
||||
&& (Registry.is("editor.distraction.free.mode") || isInPresentationMode());
|
||||
}
|
||||
|
||||
+7
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1107,14 +1107,18 @@ public class SoftWrapApplianceManager implements Dumpable {
|
||||
|
||||
private static class DefaultVisibleAreaWidthProvider implements VisibleAreaWidthProvider {
|
||||
|
||||
private final Editor myEditor;
|
||||
private final EditorImpl myEditor;
|
||||
|
||||
DefaultVisibleAreaWidthProvider(Editor editor) {
|
||||
DefaultVisibleAreaWidthProvider(EditorImpl editor) {
|
||||
myEditor = editor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVisibleAreaWidth() {
|
||||
if (myEditor.isInDistractionFreeMode()) {
|
||||
int rightMargin = myEditor.getSettings().getRightMargin(myEditor.getProject());
|
||||
if (rightMargin > 0) return rightMargin * EditorUtil.getPlainSpaceWidth(myEditor);
|
||||
}
|
||||
return myEditor.getScrollingModel().getVisibleArea().width;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user