From 94a25953faccd26abcf3d9244a638286beb7a5b8 Mon Sep 17 00:00:00 2001 From: yann300 Date: Sun, 24 Sep 2017 17:02:17 +0200 Subject: [PATCH] add getCursorPosition fn to editor --- src/app/editor/editor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/editor/editor.js b/src/app/editor/editor.js index b3950854d0..cc761f6aa3 100644 --- a/src/app/editor/editor.js +++ b/src/app/editor/editor.js @@ -126,6 +126,10 @@ function Editor (opts = {}) { return currentSession } + this.getCursorPosition = function () { + return editor.session.doc.positionToIndex(editor.getCursorPosition(), 0) + } + this.discard = function (path) { if (currentSession !== path) { delete sessions[path]