ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-843 Tweak diff selection.
Date Tue, 22 Sep 2015 08:50:23 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 fa130ca86 -> efa48db4f


IGNITE-843 Tweak diff selection.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/efa48db4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/efa48db4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/efa48db4

Branch: refs/heads/ignite-843
Commit: efa48db4f54abb7a733085d9d5c100a368d312b4
Parents: fa130ca
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Tue Sep 22 15:50:09 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Tue Sep 22 15:50:09 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/common-module.js           | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/efa48db4/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index 90b9d04..bb4d809 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -1342,16 +1342,25 @@ controlCenterModule.service('$preview', ['$timeout', '$interval',
function ($tim
             var prevLen = prevContent.length - (prevContent[prevContent.length - 1] == ''
? 1 : 0);
             var newLen = newContent.length - (newContent[newContent.length - 1] == '' ? 1
: 0);
 
+            var skipEnd = 0;
+
             var selected = false;
             var scrollTo = -1;
 
+            while (newContent[newLen - 1] == prevContent[prevLen - 1] && newLen >
0 && prevLen > 0) {
+                prevLen -= 1;
+                newLen -= 1;
+
+                skipEnd += 1;
+            }
+
             while (newIx < newLen || prevIx < prevLen) {
                 var start = -1;
                 var end = -1;
 
                 // Find an index of a first line with different text.
                 for (; (newIx < newLen || prevIx < prevLen) && start < 0;
newIx++, prevIx++) {
-                    if (newContent[newIx] != prevContent[prevIx]) {
+                    if (newIx >= newLen || prevIx >= prevLen || newContent[newIx] !=
prevContent[prevIx]) {
                         start = newIx;
 
                         break;
@@ -1382,7 +1391,7 @@ controlCenterModule.service('$preview', ['$timeout', '$interval', function
($tim
 
                     if (start == end) {
                         start = Math.max(0, start - 1);
-                        end = Math.min(newLen, end + 1)
+                        end = Math.min(newLen + skipEnd, end + 1)
                     }
 
                     if (start <= end) {


Mime
View raw message