Documentation of ko/editor

Hi,

Can you point me to the place where I can find the ko/editor documentation for (javascript) UserScripts?

thanks, Quintijn

Here you go.

  • Carey

Thanks!

I made a simple UserScript, that gives the cursor position:

var editor = require(“ko/editor”);
var cursorPos = editor.getCursorPosition(“relative”);
var clipboard = require(“sdk/clipboard”);
clipboard.set(cursorPos.toString());

With “absolute” it works, but with “relative” it gives [object Object]. Can you point to explanation where this object is explained?

Several years ago, one of your team sent me a python program that could handle introspection in the Komodo windows, I think this was a running program, which had a TCP/IP connection with a calling Python program. I then did not have the time and abilities to delve into this. Do you still have such a program available?

I am trying to make Komodo windows better for speech recognition, via the Natlink extension (opensource) that connects with Dragon.

1 Like

Hi @quintijn,

That sounds awesome. The explanation for abs vs. relative position should be in the ko/editor docs but I don’t see a clear explanation so here’s one:

Absolute position is an int relative to the start of the doc, starting at 0.
Relative is an object of {line, ch, absolute} which is the line and char/column of the position. It also includes the Abs pos.

eg. Give a doc:

abcd
<|>efgh

<|> indicating where the cursor is.
``
Relative Pos
require("ko/editor").getCursorPosition('relative') //Object {line: 2, ch: 0, absolute: 5}
Abs Pos
require("ko/editor").getCursorPosition('absolute') // 5