jenkins-bot has submitted this change and it was merged.

Change subject: Make no change to selection if insertDocument is a no-op
......................................................................


Make no change to selection if insertDocument is a no-op

Change-Id: Idf43d51e5b1f4aa71b12e930dce5b9e37ecbda30
---
M src/dm/ve.dm.SurfaceFragment.js
1 file changed, 6 insertions(+), 4 deletions(-)

Approvals:
  Divec: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/dm/ve.dm.SurfaceFragment.js b/src/dm/ve.dm.SurfaceFragment.js
index 35e5302..8837638 100644
--- a/src/dm/ve.dm.SurfaceFragment.js
+++ b/src/dm/ve.dm.SurfaceFragment.js
@@ -824,10 +824,12 @@
        }
 
        tx = new ve.dm.Transaction.newFromDocumentInsertion( doc, range.start, 
newDoc, newDocRange );
-       // Set the range to cover the inserted content; the offset translation 
will be wrong
-       // if newFromInsertion() decided to move the insertion point
-       newRange = tx.getModifiedRange();
-       this.change( tx, newRange ? new ve.dm.LinearSelection( doc, newRange ) 
: new ve.dm.NullSelection( doc ) );
+       if ( !tx.isNoOp() ) {
+               // Set the range to cover the inserted content; the offset 
translation will be wrong
+               // if newFromInsertion() decided to move the insertion point
+               newRange = tx.getModifiedRange();
+               this.change( tx, newRange ? new ve.dm.LinearSelection( doc, 
newRange ) : new ve.dm.NullSelection( doc ) );
+       }
 
        return this;
 };

-- 
To view, visit https://gerrit.wikimedia.org/r/300259
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf43d51e5b1f4aa71b12e930dce5b9e37ecbda30
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: DLynch <[email protected]>
Gerrit-Reviewer: Divec <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to