summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJesper K. Pedersen <jesper.pedersen@kdab.com>2013-05-08 08:48:52 +0200
committerJesper K. Pedersen <jesper.pedersen@kdab.com>2013-05-13 10:17:19 +0200
commit82119c52ca6b3fd7a054bcade39fdd06ae683620 (patch)
treef57dc757d3eb8330d8e8e49acdd5b096f2a0ec38 /examples
parentf5448f89f28f6e3ffd252e2b7e26b302662aab45 (diff)
simplify position handling on the scripting site
The script side do not need access to the native position format (which is characters from the beginning of the file) So instead return the Position object directly instead of the script side needing to call convertPosition Change-Id: I85f800e01d6d5786c873a18311ef9377375b4b00 Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/rectangle-commands.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/rectangle-commands.js b/examples/rectangle-commands.js
index 33e2bef..ba8a6eb 100644
--- a/examples/rectangle-commands.js
+++ b/examples/rectangle-commands.js
@@ -1,12 +1,12 @@
var editor = editors.current()
var anchorPos = editor.position(PositionOperation.Anchor)
-var anchorColumn = editor.convertPosition(anchorPos).column
-var anchorLine = editor.convertPosition(anchorPos).line
+var anchorColumn = anchorPos.column
+var anchorLine = anchorPos.line
var pointPos = editor.position(PositionOperation.Current)
-var pointColumn = editor.convertPosition(pointPos).column
-var pointLine = editor.convertPosition(pointPos).line
+var pointColumn = pointPos.column
+var pointLine = pointPos.line
var startColumn, endColumn, startLine, endLine
if ( anchorLine < pointLine || (anchorLine == pointLine && anchorColumn < pointColumn)) {