Fix line wrapping when logged in

+ The property on the diff preferences being used was tab_width
  instead of tab_size so when it was calculating the width of the
  line, a zero-width tab_size was resulting in the visible width
  to be incorrect in all cases.

Change-Id: I815f19fff2bd986fee65c92fde2bfc53596911d8
This commit is contained in:
Andrew Bonventre
2016-01-22 12:22:19 -05:00
parent ace0c4ee33
commit 1a154e5d93
3 changed files with 5 additions and 5 deletions

View File

@@ -212,7 +212,7 @@ limitations under the License.
// gerrit-extension-api/src/main/jcg/gerrit/extensions/client/DiffPreferencesInfo.java
this._diffPreferences = {
context: 10,
tab_width: 8,
tab_size: 8,
};
}
},

View File

@@ -95,7 +95,7 @@ limitations under the License.
path="[[path]]"
content="{{_diff.leftSide}}"
width="[[sideWidth]]"
tab-width="[[prefs.tab_width]]"
tab-width="[[prefs.tab_size]]"
can-comment="[[_loggedIn]]"
project-config="[[projectConfig]]"
on-expand-context="_handleExpandContext"
@@ -108,7 +108,7 @@ limitations under the License.
path="[[path]]"
content="{{_diff.rightSide}}"
width="[[sideWidth]]"
tab-width="[[prefs.tab_width]]"
tab-width="[[prefs.tab_size]]"
can-comment="[[_loggedIn]]"
project-config="[[projectConfig]]"
on-expand-context="_handleExpandContext"
@@ -797,7 +797,7 @@ limitations under the License.
_visibleLineLength: function(contents) {
// http://jsperf.com/performance-of-match-vs-split
var numTabs = contents.split('\t').length - 1;
return contents.length - numTabs + (this.prefs.tab_width * numTabs);
return contents.length - numTabs + (this.prefs.tab_size * numTabs);
},
_maxLinesSpanned: function(left, right) {

View File

@@ -44,7 +44,7 @@ limitations under the License.
element.path = 'sieve.go';
element.prefs = {
context: 10,
tab_width: 8,
tab_size: 8,
};
server = sinon.fakeServer.create();