Merge branch 'zhudock-ignorecase-wrapdiff'

This commit is contained in:
Jamie Peabody
2017-02-28 22:34:12 +00:00
3 changed files with 14 additions and 3 deletions

View File

@@ -114,6 +114,7 @@ $(document).ready(function() {
var optmap = {
au: 'autoupdate',
ws: 'ignorews',
cs: 'ignorecase',
sb: 'sidebar',
vp: 'viewport',
wl: 'wrap_lines',
@@ -223,6 +224,15 @@ $(document).ready(function() {
updateHistory(params);
}
},
'options-ignorecase': {
get: function() { return ed.mergely('options').ignorecase },
set: function(value) {
var cs = !ed.mergely('options').ignorecase;
ed.mergely('options', {ignorecase: cs});
var params = updateQueryStringParam('cs', cs ? 1 : 0, 0);
updateHistory(params);
}
},
'options-sidebars': {
get: function() { console.log('sidebar', this); return ed.mergely('options').sidebar },
set: function(value) {
@@ -348,6 +358,7 @@ $(document).ready(function() {
'options-swapmargin',
'options-viewport',
'options-ignorews',
'options-ignorecase',
'options-wrap',
'options-linenumbers',
].indexOf(id) >= 0) {

View File

@@ -140,6 +140,7 @@ if (isset($_GET['debug'])) {
<ul>
<li id="options-wrap">Wrap lines</li>
<li id="options-ignorews">Ignore white space</li>
<li id="options-ignorecase">Ignore case</li>
<li class="separator"></li>
<li id="options-viewport" title="Improves performance for large files">Enable viewport</li>
<li id="options-sidebars" title="Improves performance for large files">Enable side bars</li>

View File

@@ -395,7 +395,6 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
viewport: false,
ignorews: false,
ignorecase: false,
wrapdiff: false,
fadein: 'fast',
editor_width: '650px',
editor_height: '400px',
@@ -499,14 +498,14 @@ jQuery.extend(Mgly.CodeMirrorDiffView.prototype, {
scrollToDiff: function(direction) {
if (!this.changes.length) return;
if (direction == 'next') {
if (this.settings.wrapdiff && this._current_diff == this.changes.length -1) {
if (this._current_diff == this.changes.length -1) {
this._current_diff = 0;
} else {
this._current_diff = Math.min(++this._current_diff, this.changes.length - 1);
}
}
else if (direction == 'prev') {
if (this.settings.wrapdiff && this._current_diff == 0) {
if (this._current_diff == 0) {
this._current_diff = this.changes.length - 1;
} else {
this._current_diff = Math.max(--this._current_diff, 0);