File tree Expand file tree Collapse file tree 1 file changed +18
-18
lines changed Expand file tree Collapse file tree 1 file changed +18
-18
lines changed Original file line number Diff line number Diff line change 7
7
@mod .capture (
8
8
rule = (
9
9
"<user.cursorless_primitive_target> | "
10
- "past <user.cursorless_primitive_target> | "
11
- "<user.cursorless_primitive_target> past <user.cursorless_primitive_target>"
10
+ "( past|until|tween) <user.cursorless_primitive_target> | "
11
+ "<user.cursorless_primitive_target> ( past|until|tween) <user.cursorless_primitive_target>"
12
12
)
13
13
)
14
14
def cursorless_range (m ) -> str :
15
- if "past" in m :
16
- end = m [- 1 ]
17
- if m [0 ] == "past" :
18
- start = BASE_TARGET .copy ()
19
- else :
20
- start = m .cursorless_primitive_target_list [0 ]
21
- return {
22
- "type" : "range" ,
23
- "start" : start ,
24
- "end" : end ,
25
- }
15
+ length = len (m )
16
+ if length == 1 :
17
+ return m [0 ]
26
18
27
- return m [0 ]
19
+ if length == 2 :
20
+ start = BASE_TARGET .copy ()
21
+ else :
22
+ start = m [0 ]
23
+ modifier = m [- 2 ]
24
+ return {
25
+ "type" : "range" ,
26
+ "start" : start ,
27
+ "end" : m [- 1 ],
28
+ "excludeStart" : modifier == "tween" ,
29
+ "excludeEnd" : modifier in ["tween" , "until" ],
30
+ }
28
31
29
32
30
33
@mod .capture (rule = ("<user.cursorless_range> (and <user.cursorless_range>)*" ))
31
34
def cursorless_target (m ) -> str :
32
35
if len (m .cursorless_range_list ) == 1 :
33
36
return m .cursorless_range
34
- return {
35
- "type" : "list" ,
36
- "elements" : m .cursorless_range_list
37
- }
37
+ return {"type" : "list" , "elements" : m .cursorless_range_list }
You can’t perform that action at this time.
0 commit comments