Merge branch 'stable-2.12' into stable-2.13

* stable-2.12:
  Adds a new pref config called lineWrapping to Edit and Diff

Change-Id: Id52cfeb3522690028e158590b87da94c695a3722
This commit is contained in:
Paladox
2016-09-13 22:28:08 +01:00
committed by David Pursehouse
14 changed files with 72 additions and 1 deletions

View File

@@ -1474,6 +1474,7 @@ link:#edit-preferences-info[EditPreferencesInfo] entity.
"show_whitespace_errors": true, "show_whitespace_errors": true,
"hide_line_numbers": true, "hide_line_numbers": true,
"match_brackets": true, "match_brackets": true,
"line_wrapping": false,
"auto_close_brackets": true "auto_close_brackets": true
} }
---- ----
@@ -1507,6 +1508,7 @@ link:#edit-preferences-info[EditPreferencesInfo] entity.
"syntax_highlighting": true, "syntax_highlighting": true,
"hide_line_numbers": true, "hide_line_numbers": true,
"match_brackets": true, "match_brackets": true,
"line_wrapping": false,
"auto_close_brackets": true "auto_close_brackets": true
} }
---- ----
@@ -2211,6 +2213,8 @@ 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. file was added; the right pane is empty when a file was deleted.
|`match_brackets` |not set if `false`| |`match_brackets` |not set if `false`|
Whether matching brackets should be highlighted. Whether matching brackets should be highlighted.
|`line_wrapping` |not set if `false`|
Whether to enable line wrapping or not.
|=========================================== |===========================================
[[diff-preferences-input]] [[diff-preferences-input]]
@@ -2264,6 +2268,8 @@ scrolling down more than half of a page.
True if the line numbers should be hidden. True if the line numbers should be hidden.
|`tab_size` |optional| |`tab_size` |optional|
Number of spaces that should be used to display one tab. Number of spaces that should be used to display one tab.
|`line_wrapping` |optional|
Whether to enable line wrapping or not.
|=========================================== |===========================================
[[edit-preferences-info]] [[edit-preferences-info]]
@@ -2301,6 +2307,8 @@ Whether syntax highlighting should be enabled.
Whether line numbers should be hidden. Whether line numbers should be hidden.
|`match_brackets` |not set if `false`| |`match_brackets` |not set if `false`|
Whether matching brackets should be highlighted. Whether matching brackets should be highlighted.
|`line_wrapping` |not set if `false`|
Whether to enable line wrapping or not.
|`auto_close_brackets` |not set if `false`| |`auto_close_brackets` |not set if `false`|
Whether brackets and quotes should be auto-closed during typing. Whether brackets and quotes should be auto-closed during typing.
|=========================================== |===========================================

View File

@@ -1108,6 +1108,15 @@ file.
+ +
Large files that exceed 4000 lines will not be fully rendered. Large files that exceed 4000 lines will not be fully rendered.
- [[line-wrapping]]`Line Wrapping`:
+
Controls weather to enable line wrapping or not.
+
If `false` is selected then line wrapping is disabled.
This is the default option.
+
If `true` is selected then line wrapping is enabled.
[[keyboard-shortcuts]] [[keyboard-shortcuts]]
== Keyboard Shortcuts == Keyboard Shortcuts

View File

@@ -99,6 +99,7 @@ public class DiffPreferencesIT extends AbstractDaemonTest {
i.renderEntireFile ^= true; i.renderEntireFile ^= true;
i.hideEmptyPane ^= true; i.hideEmptyPane ^= true;
i.matchBrackets ^= true; i.matchBrackets ^= true;
i.lineWrapping ^= true;
DiffPreferencesInfo o = gApi.accounts() DiffPreferencesInfo o = gApi.accounts()
.id(admin.getId().toString()) .id(admin.getId().toString())

View File

@@ -42,6 +42,7 @@ public class EditPreferencesIT extends AbstractDaemonTest {
assertThat(out.syntaxHighlighting).isTrue(); assertThat(out.syntaxHighlighting).isTrue();
assertThat(out.hideLineNumbers).isNull(); assertThat(out.hideLineNumbers).isNull();
assertThat(out.matchBrackets).isTrue(); assertThat(out.matchBrackets).isTrue();
assertThat(out.lineWrapping).isNull();
assertThat(out.autoCloseBrackets).isNull(); assertThat(out.autoCloseBrackets).isNull();
assertThat(out.showBase).isNull(); assertThat(out.showBase).isNull();
assertThat(out.theme).isEqualTo(Theme.DEFAULT); assertThat(out.theme).isEqualTo(Theme.DEFAULT);
@@ -58,6 +59,7 @@ public class EditPreferencesIT extends AbstractDaemonTest {
out.syntaxHighlighting = false; out.syntaxHighlighting = false;
out.hideLineNumbers = true; out.hideLineNumbers = true;
out.matchBrackets = false; out.matchBrackets = false;
out.lineWrapping = true;
out.autoCloseBrackets = true; out.autoCloseBrackets = true;
out.showBase = true; out.showBase = true;
out.theme = Theme.TWILIGHT; out.theme = Theme.TWILIGHT;
@@ -93,6 +95,7 @@ public class EditPreferencesIT extends AbstractDaemonTest {
assertThat(out.syntaxHighlighting).isNull(); assertThat(out.syntaxHighlighting).isNull();
assertThat(out.hideLineNumbers).isEqualTo(in.hideLineNumbers); assertThat(out.hideLineNumbers).isEqualTo(in.hideLineNumbers);
assertThat(out.matchBrackets).isNull(); assertThat(out.matchBrackets).isNull();
assertThat(out.lineWrapping).isEqualTo(in.lineWrapping);
assertThat(out.autoCloseBrackets).isEqualTo(in.autoCloseBrackets); assertThat(out.autoCloseBrackets).isEqualTo(in.autoCloseBrackets);
assertThat(out.showBase).isEqualTo(in.showBase); assertThat(out.showBase).isEqualTo(in.showBase);
assertThat(out.theme).isEqualTo(in.theme); assertThat(out.theme).isEqualTo(in.theme);

View File

@@ -56,6 +56,7 @@ public class DiffPreferencesInfo {
public Boolean renderEntireFile; public Boolean renderEntireFile;
public Boolean hideEmptyPane; public Boolean hideEmptyPane;
public Boolean matchBrackets; public Boolean matchBrackets;
public Boolean lineWrapping;
public Theme theme; public Theme theme;
public Whitespace ignoreWhitespace; public Whitespace ignoreWhitespace;
public Boolean retainHeader; public Boolean retainHeader;
@@ -88,6 +89,7 @@ public class DiffPreferencesInfo {
i.renderEntireFile = false; i.renderEntireFile = false;
i.hideEmptyPane = false; i.hideEmptyPane = false;
i.matchBrackets = false; i.matchBrackets = false;
i.lineWrapping = false;
return i; return i;
} }
} }

View File

@@ -26,6 +26,7 @@ public class EditPreferencesInfo {
public Boolean syntaxHighlighting; public Boolean syntaxHighlighting;
public Boolean hideLineNumbers; public Boolean hideLineNumbers;
public Boolean matchBrackets; public Boolean matchBrackets;
public Boolean lineWrapping;
public Boolean autoCloseBrackets; public Boolean autoCloseBrackets;
public Boolean showBase; public Boolean showBase;
public Theme theme; public Theme theme;
@@ -43,6 +44,7 @@ public class EditPreferencesInfo {
i.syntaxHighlighting = true; i.syntaxHighlighting = true;
i.hideLineNumbers = false; i.hideLineNumbers = false;
i.matchBrackets = true; i.matchBrackets = true;
i.lineWrapping = false;
i.autoCloseBrackets = false; i.autoCloseBrackets = false;
i.showBase = false; i.showBase = false;
i.theme = Theme.DEFAULT; i.theme = Theme.DEFAULT;

View File

@@ -48,6 +48,7 @@ public class DiffPreferences extends JavaScriptObject {
p.skipUncommented(in.skipUncommented); p.skipUncommented(in.skipUncommented);
p.skipDeleted(in.skipDeleted); p.skipDeleted(in.skipDeleted);
p.matchBrackets(in.matchBrackets); p.matchBrackets(in.matchBrackets);
p.lineWrapping(in.lineWrapping);
return p; return p;
} }
@@ -73,6 +74,7 @@ public class DiffPreferences extends JavaScriptObject {
p.renderEntireFile = renderEntireFile(); p.renderEntireFile = renderEntireFile();
p.hideEmptyPane = hideEmptyPane(); p.hideEmptyPane = hideEmptyPane();
p.matchBrackets = matchBrackets(); p.matchBrackets = matchBrackets();
p.lineWrapping = lineWrapping();
p.theme = theme(); p.theme = theme();
p.ignoreWhitespace = ignoreWhitespace(); p.ignoreWhitespace = ignoreWhitespace();
} }
@@ -144,6 +146,7 @@ public class DiffPreferences extends JavaScriptObject {
public final native void skipUncommented(boolean s) /*-{ this.skip_uncommented = 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 skipDeleted(boolean s) /*-{ this.skip_deleted = s }-*/;
public final native void matchBrackets(boolean m) /*-{ this.match_brackets = m }-*/; public final native void matchBrackets(boolean m) /*-{ this.match_brackets = m }-*/;
public final native void lineWrapping(boolean w) /*-{ this.line_wrapping = w }-*/;
public final native boolean intralineDifference() /*-{ return this.intraline_difference || false }-*/; 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 showLineEndings() /*-{ return this.show_line_endings || false }-*/;
public final native boolean showTabs() /*-{ return this.show_tabs || false }-*/; public final native boolean showTabs() /*-{ return this.show_tabs || false }-*/;
@@ -161,6 +164,7 @@ public class DiffPreferences extends JavaScriptObject {
public final native boolean skipUncommented() /*-{ return this.skip_uncommented || 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 skipDeleted() /*-{ return this.skip_deleted || false }-*/;
public final native boolean matchBrackets() /*-{ return this.match_brackets || false }-*/; public final native boolean matchBrackets() /*-{ return this.match_brackets || false }-*/;
public final native boolean lineWrapping() /*-{ return this.line_wrapping || false }-*/;
private native void setThemeRaw(String i) /*-{ this.theme = i }-*/; private native void setThemeRaw(String i) /*-{ this.theme = i }-*/;
private native void setIgnoreWhitespaceRaw(String i) /*-{ this.ignore_whitespace = i }-*/; private native void setIgnoreWhitespaceRaw(String i) /*-{ this.ignore_whitespace = i }-*/;

View File

@@ -32,6 +32,7 @@ public class EditPreferences extends JavaScriptObject {
p.syntaxHighlighting(in.syntaxHighlighting); p.syntaxHighlighting(in.syntaxHighlighting);
p.hideLineNumbers(in.hideLineNumbers); p.hideLineNumbers(in.hideLineNumbers);
p.matchBrackets(in.matchBrackets); p.matchBrackets(in.matchBrackets);
p.lineWrapping(in.lineWrapping);
p.autoCloseBrackets(in.autoCloseBrackets); p.autoCloseBrackets(in.autoCloseBrackets);
p.showBase(in.showBase); p.showBase(in.showBase);
p.theme(in.theme); p.theme(in.theme);
@@ -50,6 +51,7 @@ public class EditPreferences extends JavaScriptObject {
p.syntaxHighlighting = syntaxHighlighting(); p.syntaxHighlighting = syntaxHighlighting();
p.hideLineNumbers = hideLineNumbers(); p.hideLineNumbers = hideLineNumbers();
p.matchBrackets = matchBrackets(); p.matchBrackets = matchBrackets();
p.lineWrapping = lineWrapping();
p.autoCloseBrackets = autoCloseBrackets(); p.autoCloseBrackets = autoCloseBrackets();
p.showBase = showBase(); p.showBase = showBase();
p.theme = theme(); p.theme = theme();
@@ -77,6 +79,7 @@ public class EditPreferences extends JavaScriptObject {
public final native void syntaxHighlighting(boolean s) /*-{ this.syntax_highlighting = s }-*/; public final native void syntaxHighlighting(boolean s) /*-{ this.syntax_highlighting = s }-*/;
public final native void hideLineNumbers(boolean s) /*-{ this.hide_line_numbers = s }-*/; public final native void hideLineNumbers(boolean s) /*-{ this.hide_line_numbers = s }-*/;
public final native void matchBrackets(boolean m) /*-{ this.match_brackets = m }-*/; public final native void matchBrackets(boolean m) /*-{ this.match_brackets = m }-*/;
public final native void lineWrapping(boolean w) /*-{ this.line_wrapping = w }-*/;
public final native void autoCloseBrackets(boolean c) /*-{ this.auto_close_brackets = c }-*/; public final native void autoCloseBrackets(boolean c) /*-{ this.auto_close_brackets = c }-*/;
public final native void showBase(boolean s) /*-{ this.show_base = s }-*/; public final native void showBase(boolean s) /*-{ this.show_base = s }-*/;
@@ -114,6 +117,7 @@ public class EditPreferences extends JavaScriptObject {
public final native boolean syntaxHighlighting() /*-{ return this.syntax_highlighting || false }-*/; public final native boolean syntaxHighlighting() /*-{ return this.syntax_highlighting || false }-*/;
public final native boolean hideLineNumbers() /*-{ return this.hide_line_numbers || false }-*/; public final native boolean hideLineNumbers() /*-{ return this.hide_line_numbers || false }-*/;
public final native boolean matchBrackets() /*-{ return this.match_brackets || false }-*/; public final native boolean matchBrackets() /*-{ return this.match_brackets || false }-*/;
public final native boolean lineWrapping() /*-{ return this.line_wrapping || false }-*/;
public final native boolean autoCloseBrackets() /*-{ return this.auto_close_brackets || false }-*/; public final native boolean autoCloseBrackets() /*-{ return this.auto_close_brackets || false }-*/;
public final native boolean showBase() /*-{ return this.show_base || false }-*/; public final native boolean showBase() /*-{ return this.show_base || false }-*/;
private native int get(String n, int d) /*-{ return this.hasOwnProperty(n) ? this[n] : d }-*/; private native int get(String n, int d) /*-{ return this.hasOwnProperty(n) ? this[n] : d }-*/;

View File

@@ -102,6 +102,7 @@ public class PreferencesBox extends Composite {
@UiField ToggleButton expandAllComments; @UiField ToggleButton expandAllComments;
@UiField ToggleButton renderEntireFile; @UiField ToggleButton renderEntireFile;
@UiField ToggleButton matchBrackets; @UiField ToggleButton matchBrackets;
@UiField ToggleButton lineWrapping;
@UiField ToggleButton skipDeleted; @UiField ToggleButton skipDeleted;
@UiField ToggleButton skipUnchanged; @UiField ToggleButton skipUnchanged;
@UiField ToggleButton skipUncommented; @UiField ToggleButton skipUncommented;
@@ -197,6 +198,7 @@ public class PreferencesBox extends Composite {
manualReview.setValue(prefs.manualReview()); manualReview.setValue(prefs.manualReview());
expandAllComments.setValue(prefs.expandAllComments()); expandAllComments.setValue(prefs.expandAllComments());
matchBrackets.setValue(prefs.matchBrackets()); matchBrackets.setValue(prefs.matchBrackets());
lineWrapping.setValue(prefs.lineWrapping());
skipDeleted.setValue(!prefs.skipDeleted()); skipDeleted.setValue(!prefs.skipDeleted());
skipUnchanged.setValue(!prefs.skipUnchanged()); skipUnchanged.setValue(!prefs.skipUnchanged());
skipUncommented.setValue(!prefs.skipUncommented()); skipUncommented.setValue(!prefs.skipUncommented());
@@ -503,6 +505,15 @@ public class PreferencesBox extends Composite {
prefs.matchBrackets()); prefs.matchBrackets());
} }
@UiHandler("lineWrapping")
void onLineWrapping(ValueChangeEvent<Boolean> e) {
prefs.lineWrapping(e.getValue());
view.getCmFromSide(DisplaySide.A).setOption("lineWrapping",
prefs.lineWrapping());
view.getCmFromSide(DisplaySide.B).setOption("lineWrapping",
prefs.lineWrapping());
}
@UiHandler("skipDeleted") @UiHandler("skipDeleted")
void onSkipDeleted(ValueChangeEvent<Boolean> e) { void onSkipDeleted(ValueChangeEvent<Boolean> e) {
prefs.skipDeleted(!e.getValue()); prefs.skipDeleted(!e.getValue());

View File

@@ -297,6 +297,13 @@ limitations under the License.
<g:downFace><ui:msg>On</ui:msg></g:downFace> <g:downFace><ui:msg>On</ui:msg></g:downFace>
</g:ToggleButton></td> </g:ToggleButton></td>
</tr> </tr>
<tr>
<th><ui:msg>Line Wrapping</ui:msg></th>
<td><g:ToggleButton ui:field='lineWrapping'>
<g:upFace><ui:msg>Off</ui:msg></g:upFace>
<g:downFace><ui:msg>On</ui:msg></g:downFace>
</g:ToggleButton></td>
</tr>
<tr> <tr>
<th><ui:msg>Skip Deleted Files</ui:msg></th> <th><ui:msg>Skip Deleted Files</ui:msg></th>
<td><g:ToggleButton ui:field='skipDeleted'> <td><g:ToggleButton ui:field='skipDeleted'>

View File

@@ -253,6 +253,7 @@ public class SideBySide extends DiffScreen {
.set("lineNumbers", prefs.showLineNumbers()) .set("lineNumbers", prefs.showLineNumbers())
.set("lineWrapping", false) .set("lineWrapping", false)
.set("matchBrackets", prefs.matchBrackets()) .set("matchBrackets", prefs.matchBrackets())
.set("lineWrapping", prefs.lineWrapping())
.set("mode", getFileSize() == FileSize.SMALL ? getContentType(meta) : null) .set("mode", getFileSize() == FileSize.SMALL ? getContentType(meta) : null)
.set("readOnly", true) .set("readOnly", true)
.set("scrollbarStyle", "overlay") .set("scrollbarStyle", "overlay")

View File

@@ -78,7 +78,9 @@ limitations under the License.
.b { border-left: 1px solid #ddd; } .b { border-left: 1px solid #ddd; }
.a .diff { background-color: #faa; } .a .diff { background-color: #faa; }
.b .diff { background-color: #9f9; } /* Set min-width for lineWrapping to make sure it gets enough width
before lineWrapping and to make sure it dosent do a ugly line wrap */
.b .diff { background-color: #9f9; min-width: 60em; }
.a .intralineBg { background-color: #fee; } .a .intralineBg { background-color: #fee; }
.b .intralineBg { background-color: #dfd; } .b .intralineBg { background-color: #dfd; }
.noIntraline .a .intralineBg { background-color: #faa; } .noIntraline .a .intralineBg { background-color: #faa; }

View File

@@ -68,6 +68,7 @@ public class EditPreferencesBox extends Composite {
@UiField ToggleButton whitespaceErrors; @UiField ToggleButton whitespaceErrors;
@UiField ToggleButton lineNumbers; @UiField ToggleButton lineNumbers;
@UiField ToggleButton matchBrackets; @UiField ToggleButton matchBrackets;
@UiField ToggleButton lineWrapping;
@UiField ToggleButton autoCloseBrackets; @UiField ToggleButton autoCloseBrackets;
@UiField ToggleButton showBase; @UiField ToggleButton showBase;
@UiField ListBox theme; @UiField ListBox theme;
@@ -104,6 +105,7 @@ public class EditPreferencesBox extends Composite {
whitespaceErrors.setValue(prefs.showWhitespaceErrors()); whitespaceErrors.setValue(prefs.showWhitespaceErrors());
lineNumbers.setValue(prefs.hideLineNumbers()); lineNumbers.setValue(prefs.hideLineNumbers());
matchBrackets.setValue(prefs.matchBrackets()); matchBrackets.setValue(prefs.matchBrackets());
lineWrapping.setValue(prefs.lineWrapping());
autoCloseBrackets.setValue(prefs.autoCloseBrackets()); autoCloseBrackets.setValue(prefs.autoCloseBrackets());
showBase.setValue(prefs.showBase()); showBase.setValue(prefs.showBase());
setTheme(prefs.theme()); setTheme(prefs.theme());
@@ -205,6 +207,14 @@ public class EditPreferencesBox extends Composite {
} }
} }
@UiHandler("lineWrapping")
void onLineWrapping(ValueChangeEvent<Boolean> e) {
prefs.lineWrapping(e.getValue());
if (view != null) {
view.getEditor().setOption("lineWrapping", prefs.lineWrapping());
}
}
@UiHandler("autoCloseBrackets") @UiHandler("autoCloseBrackets")
void onCloseBrackets(ValueChangeEvent<Boolean> e) { void onCloseBrackets(ValueChangeEvent<Boolean> e) {
prefs.autoCloseBrackets(e.getValue()); prefs.autoCloseBrackets(e.getValue());

View File

@@ -238,6 +238,13 @@ limitations under the License.
<g:downFace><ui:msg>On</ui:msg></g:downFace> <g:downFace><ui:msg>On</ui:msg></g:downFace>
</g:ToggleButton></td> </g:ToggleButton></td>
</tr> </tr>
<tr>
<th><ui:msg>Line Wrapping</ui:msg></th>
<td><g:ToggleButton ui:field='lineWrapping'>
<g:upFace><ui:msg>Off</ui:msg></g:upFace>
<g:downFace><ui:msg>On</ui:msg></g:downFace>
</g:ToggleButton></td>
</tr>
<tr> <tr>
<th><ui:msg>Auto Close Brackets</ui:msg></th> <th><ui:msg>Auto Close Brackets</ui:msg></th>
<td><g:ToggleButton ui:field='autoCloseBrackets'> <td><g:ToggleButton ui:field='autoCloseBrackets'>