2
// If you select some text before running the script, this line will be overwritten.
3
if ( view.hasSelection() )
5
document.removeText( 0, 0, 0, document.lineLength(0) );
6
document.insertText( 0, 0, "// initial selection: " + view.selectionStartLine + "," + view.selectionStartColumn + " - " + view.selectionEndLine + "," + view.selectionEndColumn );
8
// test selection interface
10
view.setSelection( 0, 0, 0, 20 );
11
view.clearSelection();
13
// insert some text and select that
14
var line = document.lines();
15
document.insertLine( line, "foo" );
16
document.insertText( line, 0, "// This is a new line" );
17
view.setSelection( line, 0, line, document.lineLength(line) );
19
view.removeSelectedText();
21
// insert some text and select that
22
var line = document.lines();
23
document.insertLine( line, "bar" );
24
document.insertText( line, 0, "// This is a new line" );
25
view.setSelection( line, 0, line, document.lineLength(line) );
27
document.insertText( line, document.lineLength( line ), " Selection is " + view.selectionStartLine + "," + view.selectionStartColumn + " - " + view.selectionEndLine + "," + view.selectionEndColumn );