~haaaad/geany/master

« back to all changes in this revision

Viewing changes to scintilla/src/Selection.h

  • Committer: elextr
  • Author(s): Colomban Wendling
  • Date: 2017-07-24 23:24:05 UTC
  • Revision ID: git-v1:18360460abb4f4bec23dff127031ecf4e9120f7f
Update Scintilla to version 3.7.5 (#1503)

* Update Scintilla to version 3.7.5

This now requires a C++11-capable compiler.

Closes #1308.

* Test using newer dist on Travis

Since Scintilla needs C++11

* Add debugging code for when configure fails

* Workaround a pkg-config-corsswrapper bug on Ubuntu 14.04

See https://bugs.launchpad.net/ubuntu/+source/mingw-w64/+bug/1327242

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#endif
14
14
 
15
15
class SelectionPosition {
16
 
        int position;
17
 
        int virtualSpace;
 
16
        Sci::Position position;
 
17
        Sci::Position virtualSpace;
18
18
public:
19
 
        explicit SelectionPosition(int position_=INVALID_POSITION, int virtualSpace_=0) : position(position_), virtualSpace(virtualSpace_) {
 
19
        explicit SelectionPosition(Sci::Position position_=INVALID_POSITION, Sci::Position virtualSpace_=0) : position(position_), virtualSpace(virtualSpace_) {
20
20
                PLATFORM_ASSERT(virtualSpace < 800000);
21
21
                if (virtualSpace < 0)
22
22
                        virtualSpace = 0;
25
25
                position = 0;
26
26
                virtualSpace = 0;
27
27
        }
28
 
        void MoveForInsertDelete(bool insertion, int startChange, int length);
 
28
        void MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length);
29
29
        bool operator ==(const SelectionPosition &other) const {
30
30
                return position == other.position && virtualSpace == other.virtualSpace;
31
31
        }
33
33
        bool operator >(const SelectionPosition &other) const;
34
34
        bool operator <=(const SelectionPosition &other) const;
35
35
        bool operator >=(const SelectionPosition &other) const;
36
 
        int Position() const {
 
36
        Sci::Position Position() const {
37
37
                return position;
38
38
        }
39
 
        void SetPosition(int position_) {
 
39
        void SetPosition(Sci::Position position_) {
40
40
                position = position_;
41
41
                virtualSpace = 0;
42
42
        }
43
 
        int VirtualSpace() const {
 
43
        Sci::Position VirtualSpace() const {
44
44
                return virtualSpace;
45
45
        }
46
 
        void SetVirtualSpace(int virtualSpace_) {
 
46
        void SetVirtualSpace(Sci::Position virtualSpace_) {
47
47
                PLATFORM_ASSERT(virtualSpace_ < 800000);
48
48
                if (virtualSpace_ >= 0)
49
49
                        virtualSpace = virtualSpace_;
50
50
        }
51
 
        void Add(int increment) {
 
51
        void Add(Sci::Position increment) {
52
52
                position = position + increment;
53
53
        }
54
54
        bool IsValid() const {
90
90
        }
91
91
        explicit SelectionRange(SelectionPosition single) : caret(single), anchor(single) {
92
92
        }
93
 
        explicit SelectionRange(int single) : caret(single), anchor(single) {
 
93
        explicit SelectionRange(Sci::Position single) : caret(single), anchor(single) {
94
94
        }
95
95
        SelectionRange(SelectionPosition caret_, SelectionPosition anchor_) : caret(caret_), anchor(anchor_) {
96
96
        }
97
 
        SelectionRange(int caret_, int anchor_) : caret(caret_), anchor(anchor_) {
 
97
        SelectionRange(Sci::Position caret_, Sci::Position anchor_) : caret(caret_), anchor(anchor_) {
98
98
        }
99
99
        bool Empty() const {
100
100
                return anchor == caret;
101
101
        }
102
 
        int Length() const;
103
 
        // int Width() const;   // Like Length but takes virtual space into account
 
102
        Sci::Position Length() const;
 
103
        // Sci::Position Width() const; // Like Length but takes virtual space into account
104
104
        bool operator ==(const SelectionRange &other) const {
105
105
                return caret == other.caret && anchor == other.anchor;
106
106
        }
115
115
                anchor.SetVirtualSpace(0);
116
116
                caret.SetVirtualSpace(0);
117
117
        }
118
 
        void MoveForInsertDelete(bool insertion, int startChange, int length);
119
 
        bool Contains(int pos) const;
 
118
        void MoveForInsertDelete(bool insertion, Sci::Position startChange, Sci::Position length);
 
119
        bool Contains(Sci::Position pos) const;
120
120
        bool Contains(SelectionPosition sp) const;
121
 
        bool ContainsCharacter(int posCharacter) const;
 
121
        bool ContainsCharacter(Sci::Position posCharacter) const;
122
122
        SelectionSegment Intersect(SelectionSegment check) const;
123
123
        SelectionPosition Start() const {
124
124
                return (anchor < caret) ? anchor : caret;
146
146
        Selection();
147
147
        ~Selection();
148
148
        bool IsRectangular() const;
149
 
        int MainCaret() const;
150
 
        int MainAnchor() const;
 
149
        Sci::Position MainCaret() const;
 
150
        Sci::Position MainAnchor() const;
151
151
        SelectionRange &Rectangular();
152
152
        SelectionSegment Limits() const;
153
153
        // This is for when you want to move the caret in response to a
166
166
        void SetMoveExtends(bool moveExtends_);
167
167
        bool Empty() const;
168
168
        SelectionPosition Last() const;
169
 
        int Length() const;
170
 
        void MovePositions(bool insertion, int startChange, int length);
 
169
        Sci::Position Length() const;
 
170
        void MovePositions(bool insertion, Sci::Position startChange, Sci::Position length);
171
171
        void TrimSelection(SelectionRange range);
172
172
        void TrimOtherSelections(size_t r, SelectionRange range);
173
173
        void SetSelection(SelectionRange range);
177
177
        void DropAdditionalRanges();
178
178
        void TentativeSelection(SelectionRange range);
179
179
        void CommitTentative();
180
 
        int CharacterInSelection(int posCharacter) const;
181
 
        int InSelectionForEOL(int pos) const;
182
 
        int VirtualSpaceFor(int pos) const;
 
180
        int CharacterInSelection(Sci::Position posCharacter) const;
 
181
        int InSelectionForEOL(Sci::Position pos) const;
 
182
        Sci::Position VirtualSpaceFor(Sci::Position pos) const;
183
183
        void Clear();
184
184
        void RemoveDuplicates();
185
185
        void RotateMain();