Skip to content

The Unified and Autonomous Development Platform

Use timeout to improve performance of cursor activity

robin shine8107808e7894
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/source-view.js b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/source-view.js
index 2180d372ce..f043a4ebf8 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/source-view.js
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/component/repofile/blobview/source/source-view.js
@@ -131,9 +131,16 @@ gitplex.sourceview = {
if (scrollPos)
cm.scrollTo(scrollPos.left, scrollPos.top);
+ var cursorTimer;
cm.on("cursorActivity", function() {
- pmease.commons.history.setCursor(cm.getCursor());
+ if (cursorTimer)
+ clearTimeout(cursorTimer);
+ cursorTimer = setTimeout(function() {
+ cursorTimer = undefined;
+ pmease.commons.history.setCursor(cm.getCursor());
+ }, 1000);
});
+
var cursor = pmease.commons.history.getCursor();
if (cursor)
cm.setCursor(cursor);