1
>
/*---------------------------------------------------------------------------------------------
selection.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { IPosition, Position } from './position.js';
7
>
import { Range } from './range.js';
8
>
9
>
/**
10
>
* A selection in the editor.
11
>
* The selection is a range that has an orientation.
12
>
*/
13
>
export interface ISelection {
14
>
/**
15
>
* The line number on which the selection has started.
16
>
*/
17
>
readonly selectionStartLineNumber: number;
18
>
/**
19
>
* The column on `selectionStartLineNumber` where the selection has started.
20
>
*/
21
>
readonly selectionStartColumn: number;
22
>
/**
23
>
* The line number on which the selection has ended.
24
>
*/
25
>
readonly positionLineNumber: number;
26
>
/**
27
>
* The column on `positionLineNumber` where the selection has ended.
28
>
*/
29
>
readonly positionColumn: number;
30
>
}
31
>
32
>
/**
33
>
* The direction of a selection.
34
>
*/
35
>
export const enum SelectionDirection {
36
>
/**
37
>
* The selection starts above where it ends.
38
>
*/
39
>
LTR,
40
>
/**
41
>
* The selection starts below where it ends.
42
>
*/
43
>
RTL
44
>
}
45
>
46
>
/**
47
>
* A selection in the editor.
48
>
* The selection is a range that has an orientation.
49
>
*/
50
>
export class Selection extends Range {
51
>
/**
52
>
* The line number on which the selection has started.
53
>
*/
54
>
public readonly selectionStartLineNumber: number;
55
>
/**
56
>
* The column on `selectionStartLineNumber` where the selection has started.
57
>
*/
58
>
public readonly selectionStartColumn: number;
59
>
/**
60
>
* The line number on which the selection has ended.
61
>
*/
62
>
public readonly positionLineNumber: number;
63
>
/**
64
>
* The column on `positionLineNumber` where the selection has ended.
65
>
*/
66
>
public readonly positionColumn: number;
67
>
68
>
constructor(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number) {
69
super(selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn);
70
this.selectionStartLineNumber = selectionStartLineNumber;