Merge branch 'stable-2.14'

* stable-2.14:
  Add support for CodeEditor edit config indentWithTabs
  Change lineWrapping from saying false to using prefs.lineWrapping()

Change-Id: I4a94a9179f780a9b31c802478209075c102e7a55
This commit is contained in:
Paladox
2017-07-02 18:43:21 +01:00
7 changed files with 34 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ public class EditPreferences extends JavaScriptObject {
p.hideLineNumbers(in.hideLineNumbers);
p.matchBrackets(in.matchBrackets);
p.lineWrapping(in.lineWrapping);
p.indentWithTabs(in.indentWithTabs);
p.autoCloseBrackets(in.autoCloseBrackets);
p.showBase(in.showBase);
p.theme(in.theme);
@@ -52,6 +53,7 @@ public class EditPreferences extends JavaScriptObject {
p.hideLineNumbers = hideLineNumbers();
p.matchBrackets = matchBrackets();
p.lineWrapping = lineWrapping();
p.indentWithTabs = indentWithTabs();
p.autoCloseBrackets = autoCloseBrackets();
p.showBase = showBase();
p.theme = theme();
@@ -94,6 +96,8 @@ public class EditPreferences extends JavaScriptObject {
public final native void lineWrapping(boolean w) /*-{ this.line_wrapping = w }-*/;
public final native void indentWithTabs(boolean w) /*-{ this.indent_with_tabs = w }-*/;
public final native void autoCloseBrackets(boolean c) /*-{ this.auto_close_brackets = c }-*/;
public final native void showBase(boolean s) /*-{ this.show_base = s }-*/;
@@ -144,6 +148,8 @@ public class EditPreferences extends JavaScriptObject {
public final native boolean lineWrapping() /*-{ return this.line_wrapping || false }-*/;
public final native boolean indentWithTabs() /*-{ return this.indent_with_tabs || false }-*/;
public final native boolean
autoCloseBrackets() /*-{ return this.auto_close_brackets || false }-*/;

View File

@@ -69,6 +69,7 @@ public class EditPreferencesBox extends Composite {
@UiField ToggleButton lineNumbers;
@UiField ToggleButton matchBrackets;
@UiField ToggleButton lineWrapping;
@UiField ToggleButton indentWithTabs;
@UiField ToggleButton autoCloseBrackets;
@UiField ToggleButton showBase;
@UiField ListBox theme;
@@ -106,6 +107,7 @@ public class EditPreferencesBox extends Composite {
lineNumbers.setValue(prefs.hideLineNumbers());
matchBrackets.setValue(prefs.matchBrackets());
lineWrapping.setValue(prefs.lineWrapping());
indentWithTabs.setValue(prefs.indentWithTabs());
autoCloseBrackets.setValue(prefs.autoCloseBrackets());
showBase.setValue(prefs.showBase());
setTheme(prefs.theme());
@@ -215,6 +217,15 @@ public class EditPreferencesBox extends Composite {
}
}
@UiHandler("indentWithTabs")
void onIndentWithTabs(ValueChangeEvent<Boolean> e) {
prefs.indentWithTabs(e.getValue());
if (view != null) {
view.getEditor().setOption("indentWithTabs", prefs.indentWithTabs());
}
}
@UiHandler("autoCloseBrackets")
void onCloseBrackets(ValueChangeEvent<Boolean> e) {
prefs.autoCloseBrackets(e.getValue());

View File

@@ -245,6 +245,13 @@ limitations under the License.
<g:downFace><ui:msg>On</ui:msg></g:downFace>
</g:ToggleButton></td>
</tr>
<tr>
<th><ui:msg>Indent With Tabs</ui:msg></th>
<td><g:ToggleButton ui:field='indentWithTabs'>
<g:upFace><ui:msg>Off</ui:msg></g:upFace>
<g:downFace><ui:msg>On</ui:msg></g:downFace>
</g:ToggleButton></td>
</tr>
<tr>
<th><ui:msg>Auto Close Brackets</ui:msg></th>
<td><g:ToggleButton ui:field='autoCloseBrackets'>

View File

@@ -550,7 +550,8 @@ public class EditScreen extends Screen {
.set("indentUnit", prefs.indentUnit())
.set("keyMap", prefs.keyMapType().name().toLowerCase())
.set("lineNumbers", prefs.hideLineNumbers())
.set("lineWrapping", false)
.set("lineWrapping", prefs.lineWrapping())
.set("indentWithTabs", prefs.indentWithTabs())
.set("matchBrackets", prefs.matchBrackets())
.set("mode", mode != null ? mode.mime() : null)
.set("origLeft", editContent)