Add support for CodeEditor edit config indentWithTabs

Will allow us to switch on or off the indentWithTabs config which will
indent the lines in tabs.

Bug: Issue 6609
Change-Id: If0e75de66a20d028ba066ff207f1d24e4633be27
This commit is contained in:
Paladox none
2017-06-28 17:03:33 +00:00
parent f4b2a76864
commit 6406b2c223
7 changed files with 33 additions and 0 deletions

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

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