Set initial cursor location at (1, 1) instead of (0, 0)

This commit is contained in:
jos 2017-12-28 15:51:50 +01:00
parent ddf6e1f16a
commit 8aef543fa6
1 changed files with 14 additions and 13 deletions

View File

@ -260,7 +260,7 @@ textmode.create = function (container, options) {
var lnVal = document.createElement('span');
lnVal.className = 'jsoneditor-curserinfo-val';
lnVal.innerText = 0;
lnVal.innerText = '1';
statusBar.appendChild(lnLabel);
statusBar.appendChild(lnVal);
@ -271,7 +271,7 @@ textmode.create = function (container, options) {
var colVal = document.createElement('span');
colVal.className = 'jsoneditor-curserinfo-val';
colVal.innerText = 0;
colVal.innerText = '1';
statusBar.appendChild(colLabel);
statusBar.appendChild(colVal);
@ -286,7 +286,7 @@ textmode.create = function (container, options) {
var countVal = document.createElement('span');
countVal.className = 'jsoneditor-curserinfo-count';
countVal.innerText = 0;
countVal.innerText = '0';
countVal.style.display = 'none';
this.curserInfoElements.countLabel = countLabel;
@ -382,9 +382,10 @@ textmode._onBlur = function (event) {
* Update the status bar cursor info
*/
textmode._updateCursorInfoDisplay = function () {
if(this.options.statusBar) {
var me = this;
var line, col, count;
if(this.options.statusBar) {
if (this.textarea) {
setTimeout(function() { //this to verify we get the most updated textarea cursor selection
var selectionRange = util.getInputSelection(me.textarea);
@ -405,6 +406,7 @@ textmode._updateCursorInfoDisplay = function () {
count = selectedText.length;
updateDisplay();
}
}
function updateDisplay() {
@ -416,7 +418,6 @@ textmode._updateCursorInfoDisplay = function () {
me.curserInfoElements.lnVal.innerText = line;
me.curserInfoElements.colVal.innerText = col;
}
}
};
/**