SideBySide: Allow to activate match brackets Codemirror addon
Now, that we migrated diff user preferences to Git backend, we can make activation of codemirror option: "highlight matched brackets" customizable. Change-Id: I37c1c1ee13ff872e3cbc349a7c9fee636312402e
This commit is contained in:
parent
ca09f4717d
commit
188b8237ea
@ -1709,6 +1709,8 @@ Number of spaces that should be used to display one tab.
|
||||
|'hide_empty_pane' |not set if `false`|
|
||||
Whether empty panes should be hidden. The left pane is empty when a
|
||||
file was added; the right pane is empty when a file was deleted.
|
||||
|`match_brackets` |not set if `false`|
|
||||
Whether matching brackets should be highlighted.
|
||||
|===========================================
|
||||
|
||||
[[diff-preferences-input]]
|
||||
|
@ -63,6 +63,7 @@ public class DiffPreferencesIT extends AbstractDaemonTest {
|
||||
assertThat(o.hideLineNumbers).isNull();
|
||||
assertThat(o.renderEntireFile).isNull();
|
||||
assertThat(o.hideEmptyPane).isNull();
|
||||
assertThat(o.matchBrackets).isNull();
|
||||
assertThat(o.ignoreWhitespace).isEqualTo(d.ignoreWhitespace);
|
||||
assertThat(o.theme).isEqualTo(d.theme);
|
||||
}
|
||||
@ -93,6 +94,7 @@ public class DiffPreferencesIT extends AbstractDaemonTest {
|
||||
i.hideLineNumbers ^= true;
|
||||
i.renderEntireFile ^= true;
|
||||
i.hideEmptyPane ^= true;
|
||||
i.matchBrackets ^= true;
|
||||
|
||||
RestResponse r = adminSession.put("/accounts/" + admin.email
|
||||
+ "/preferences.diff", i);
|
||||
@ -119,6 +121,7 @@ public class DiffPreferencesIT extends AbstractDaemonTest {
|
||||
assertThat(o.hideLineNumbers).isEqualTo(i.hideLineNumbers);
|
||||
assertThat(o.renderEntireFile).isEqualTo(i.renderEntireFile);
|
||||
assertThat(o.hideEmptyPane).isEqualTo(i.hideEmptyPane);
|
||||
assertThat(o.matchBrackets).isEqualTo(i.matchBrackets);
|
||||
assertThat(o.ignoreWhitespace).isEqualTo(i.ignoreWhitespace);
|
||||
assertThat(o.theme).isEqualTo(i.theme);
|
||||
|
||||
|
@ -55,6 +55,7 @@ public class DiffPreferencesInfo {
|
||||
public Boolean hideLineNumbers;
|
||||
public Boolean renderEntireFile;
|
||||
public Boolean hideEmptyPane;
|
||||
public Boolean matchBrackets;
|
||||
public Theme theme;
|
||||
public Whitespace ignoreWhitespace;
|
||||
public Boolean retainHeader;
|
||||
@ -84,6 +85,7 @@ public class DiffPreferencesInfo {
|
||||
i.hideLineNumbers = false;
|
||||
i.renderEntireFile = false;
|
||||
i.hideEmptyPane = false;
|
||||
i.matchBrackets = false;
|
||||
return i;
|
||||
}
|
||||
}
|
@ -46,6 +46,7 @@ public class DiffPreferences extends JavaScriptObject {
|
||||
p.retainHeader(in.retainHeader);
|
||||
p.skipUncommented(in.skipUncommented);
|
||||
p.skipDeleted(in.skipDeleted);
|
||||
p.matchBrackets(in.matchBrackets);
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -69,6 +70,7 @@ public class DiffPreferences extends JavaScriptObject {
|
||||
p.hideLineNumbers = hideLineNumbers();
|
||||
p.renderEntireFile = renderEntireFile();
|
||||
p.hideEmptyPane = hideEmptyPane();
|
||||
p.matchBrackets = matchBrackets();
|
||||
p.theme = theme();
|
||||
p.ignoreWhitespace = ignoreWhitespace();
|
||||
}
|
||||
@ -134,10 +136,11 @@ public class DiffPreferences extends JavaScriptObject {
|
||||
public final native void expandAllComments(boolean e) /*-{ this.expand_all_comments = e }-*/;
|
||||
public final native void manualReview(boolean r) /*-{ this.manual_review = r }-*/;
|
||||
public final native void renderEntireFile(boolean r) /*-{ this.render_entire_file = r }-*/;
|
||||
public final native void hideEmptyPane(boolean s) /*-{ this.hide_empty_pane = s }-*/;
|
||||
public final native void retainHeader(boolean r) /*-{ this.retain_header = r }-*/;
|
||||
public final native void hideEmptyPane(boolean s) /*-{ this.hide_empty_pane = s }-*/;
|
||||
public final native void skipUncommented(boolean s) /*-{ this.skip_uncommented = s }-*/;
|
||||
public final native void skipDeleted(boolean s) /*-{ this.skip_deleted = s }-*/;
|
||||
public final native void matchBrackets(boolean m) /*-{ this.match_brackets = m }-*/;
|
||||
public final native boolean intralineDifference() /*-{ return this.intraline_difference || false }-*/;
|
||||
public final native boolean showLineEndings() /*-{ return this.show_line_endings || false }-*/;
|
||||
public final native boolean showTabs() /*-{ return this.show_tabs || false }-*/;
|
||||
@ -153,6 +156,7 @@ public class DiffPreferences extends JavaScriptObject {
|
||||
public final native boolean retainHeader() /*-{ return this.retain_header || false }-*/;
|
||||
public final native boolean skipUncommented() /*-{ return this.skip_uncommented || false }-*/;
|
||||
public final native boolean skipDeleted() /*-{ return this.skip_deleted || false }-*/;
|
||||
public final native boolean matchBrackets() /*-{ return this.match_brackets || false }-*/;
|
||||
|
||||
private final native void setThemeRaw(String i) /*-{ this.theme = i }-*/;
|
||||
private final native void setIgnoreWhitespaceRaw(String i) /*-{ this.ignore_whitespace = i }-*/;
|
||||
|
@ -101,6 +101,7 @@ public class PreferencesBox extends Composite {
|
||||
@UiField ToggleButton manualReview;
|
||||
@UiField ToggleButton expandAllComments;
|
||||
@UiField ToggleButton renderEntireFile;
|
||||
@UiField ToggleButton matchBrackets;
|
||||
@UiField ListBox theme;
|
||||
@UiField Element modeLabel;
|
||||
@UiField ListBox mode;
|
||||
@ -192,6 +193,7 @@ public class PreferencesBox extends Composite {
|
||||
autoHideDiffTableHeader.setValue(!prefs.autoHideDiffTableHeader());
|
||||
manualReview.setValue(prefs.manualReview());
|
||||
expandAllComments.setValue(prefs.expandAllComments());
|
||||
matchBrackets.setValue(prefs.matchBrackets());
|
||||
setTheme(prefs.theme());
|
||||
|
||||
if (view == null || view.canRenderEntireFile(prefs)) {
|
||||
@ -482,6 +484,15 @@ public class PreferencesBox extends Composite {
|
||||
}
|
||||
}
|
||||
|
||||
@UiHandler("matchBrackets")
|
||||
void onMatchBrackets(ValueChangeEvent<Boolean> e) {
|
||||
prefs.matchBrackets(e.getValue());
|
||||
view.getCmFromSide(DisplaySide.A).setOption("matchBrackets",
|
||||
prefs.matchBrackets());
|
||||
view.getCmFromSide(DisplaySide.B).setOption("matchBrackets",
|
||||
prefs.matchBrackets());
|
||||
}
|
||||
|
||||
@UiHandler("theme")
|
||||
void onTheme(@SuppressWarnings("unused") ChangeEvent e) {
|
||||
final Theme newTheme = getSelectedTheme();
|
||||
|
@ -289,6 +289,13 @@ limitations under the License.
|
||||
<g:downFace><ui:msg>Slow</ui:msg></g:downFace>
|
||||
</g:ToggleButton></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><ui:msg>Match Brackets</ui:msg></th>
|
||||
<td><g:ToggleButton ui:field='matchBrackets'>
|
||||
<g:upFace><ui:msg>Off</ui:msg></g:upFace>
|
||||
<g:downFace><ui:msg>On</ui:msg></g:downFace>
|
||||
</g:ToggleButton></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
|
Loading…
Reference in New Issue
Block a user