File tree Expand file tree Collapse file tree 2 files changed +61
-3
lines changed
data/fixtures/recorded/actions
packages/cursorless-engine/src/actions Expand file tree Collapse file tree 2 files changed +61
-3
lines changed Original file line number Diff line number Diff line change
1
+ languageId : plaintext
2
+ command :
3
+ version : 7
4
+ spokenForm : move block after file
5
+ action :
6
+ name : moveToTarget
7
+ source :
8
+ type : primitive
9
+ modifiers :
10
+ - type : containingScope
11
+ scopeType : {type: paragraph}
12
+ destination :
13
+ type : primitive
14
+ insertionMode : after
15
+ target :
16
+ type : primitive
17
+ modifiers :
18
+ - type : containingScope
19
+ scopeType : {type: document}
20
+ usePrePhraseSnapshot : false
21
+ initialState :
22
+ documentContents : |-
23
+ a
24
+
25
+ b
26
+ selections :
27
+ - anchor : {line: 0, character: 0}
28
+ active : {line: 0, character: 0}
29
+ marks : {}
30
+ finalState :
31
+ documentContents : |-
32
+ b
33
+
34
+ a
35
+ selections :
36
+ - anchor : {line: 0, character: 0}
37
+ active : {line: 0, character: 0}
38
+ thatMark :
39
+ - type : UntypedTarget
40
+ contentRange :
41
+ start : {line: 2, character: 0}
42
+ end : {line: 2, character: 1}
43
+ isReversed : false
44
+ hasExplicitRange : true
45
+ sourceMark :
46
+ - type : UntypedTarget
47
+ contentRange :
48
+ start : {line: 0, character: 0}
49
+ end : {line: 0, character: 0}
50
+ isReversed : false
51
+ hasExplicitRange : true
Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ abstract class BringMoveSwap {
70
70
71
71
sources . forEach ( ( source , i ) => {
72
72
let destination = destinations [ i ] ;
73
+ let destinationEdit : ExtendedEdit | undefined ;
74
+
73
75
if ( ( source == null || destination == null ) && ! shouldJoinSources ) {
74
76
throw new Error ( "Targets must have same number of args" ) ;
75
77
}
@@ -89,13 +91,15 @@ abstract class BringMoveSwap {
89
91
} else {
90
92
text = source . contentText ;
91
93
}
94
+
92
95
// Add destination edit
93
- results . push ( {
96
+ destinationEdit = {
94
97
edit : destination . constructChangeEdit ( text ) ,
95
98
editor : destination . editor ,
96
99
originalTarget : destination . target ,
97
100
isSource : false ,
98
- } ) ;
101
+ } ;
102
+ results . push ( destinationEdit ) ;
99
103
} else {
100
104
destination = destinations [ 0 ] ;
101
105
}
@@ -106,10 +110,13 @@ abstract class BringMoveSwap {
106
110
// Allow move where the destination contains the source. eg "bring token to line"
107
111
if (
108
112
this . type !== "move" ||
109
- ! destination . target . getRemovalRange ( ) . contains ( source . contentRange )
113
+ destinationEdit == null ||
114
+ destinationEdit . editor . id !== source . editor . id ||
115
+ ! destinationEdit . edit . range . contains ( source . contentRange )
110
116
) {
111
117
usedSources . push ( source ) ;
112
118
}
119
+
113
120
if ( this . type === "bring" ) {
114
121
results . push ( {
115
122
edit : source
You can’t perform that action at this time.
0 commit comments