~ubuntu-branches/ubuntu/vivid/kate/vivid-updates

« back to all changes in this revision

Viewing changes to part/script/data/test_selectioniface.js

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// kate-script
2
 
// If you select some text before running the script, this line will be overwritten.
3
 
if ( view.hasSelection() )
4
 
{
5
 
    document.removeText( 0, 0, 0, document.lineLength(0) );
6
 
    document.insertText( 0, 0, "// initial selection: " + view.selectionStartLine + "," + view.selectionStartColumn + " - " + view.selectionEndLine + "," + view.selectionEndColumn );
7
 
}
8
 
// test selection interface
9
 
view.selectAll();
10
 
view.setSelection( 0, 0, 0, 20 );
11
 
view.clearSelection();
12
 
 
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) );
18
 
// Delete that text
19
 
view.removeSelectedText();
20
 
 
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) );
26
 
 
27
 
document.insertText( line, document.lineLength( line ), " Selection is " + view.selectionStartLine + "," + view.selectionStartColumn + " - " + view.selectionEndLine + "," + view.selectionEndColumn );