Merge pull request #908 from rstudio/patch/blinking-cursor
add function to disable blinking cursor
This commit is contained in:
commit
cb244b730f
1 changed files with 9 additions and 0 deletions
|
|
@ -48,6 +48,7 @@ var Cursor = function(parentEl) {
|
||||||
parentEl.appendChild(this.element);
|
parentEl.appendChild(this.element);
|
||||||
|
|
||||||
this.isVisible = false;
|
this.isVisible = false;
|
||||||
|
this.isBlinking = true;
|
||||||
|
|
||||||
this.cursors = [];
|
this.cursors = [];
|
||||||
this.cursor = this.addCursor();
|
this.cursor = this.addCursor();
|
||||||
|
|
@ -64,6 +65,12 @@ var Cursor = function(parentEl) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.setBlinking = function(blinking) {
|
||||||
|
this.isBlinking = blinking;
|
||||||
|
if (blinking)
|
||||||
|
this.restartTimer();
|
||||||
|
};
|
||||||
|
|
||||||
this.addCursor = function() {
|
this.addCursor = function() {
|
||||||
var el = dom.createElement("div");
|
var el = dom.createElement("div");
|
||||||
var className = "ace_cursor";
|
var className = "ace_cursor";
|
||||||
|
|
@ -104,6 +111,8 @@ var Cursor = function(parentEl) {
|
||||||
|
|
||||||
this.restartTimer = function() {
|
this.restartTimer = function() {
|
||||||
clearInterval(this.blinkId);
|
clearInterval(this.blinkId);
|
||||||
|
if (!this.isBlinking)
|
||||||
|
return;
|
||||||
if (!this.isVisible)
|
if (!this.isVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue