From 82119c52ca6b3fd7a054bcade39fdd06ae683620 Mon Sep 17 00:00:00 2001 From: "Jesper K. Pedersen" Date: Wed, 8 May 2013 08:48:52 +0200 Subject: 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 --- examples/rectangle-commands.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples') 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)) { -- cgit v1.2.3