Skip to content

Commit

Permalink
Added Cursorless prefects to ordinal_or_last capture (#2691)
Browse files Browse the repository at this point in the history
This capture was missing our Cursorless prefix 

## Checklist

- [/] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [/] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [/] I have not broken the cheatsheet
  • Loading branch information
AndreasArvidsson authored Dec 1, 2024
1 parent 8cd7c21 commit 1e996d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cursorless-talon/src/modifiers/ordinal_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
@mod.capture(
rule="<user.ordinals_small> | [<user.ordinals_small>] {user.cursorless_last_modifier}"
)
def ordinal_or_last(m) -> int:
def cursorless_ordinal_or_last(m) -> int:
"""An ordinal or the word 'last'"""
if m[-1] == "last":
return -getattr(m, "ordinals_small", 1)
return m.ordinals_small - 1


@mod.capture(
rule="<user.ordinal_or_last> [<user.cursorless_range_connective> <user.ordinal_or_last>] <user.cursorless_scope_type>"
rule="<user.cursorless_ordinal_or_last> [<user.cursorless_range_connective> <user.cursorless_ordinal_or_last>] <user.cursorless_scope_type>"
)
def cursorless_ordinal_range(m) -> dict[str, Any]:
"""Ordinal range"""
anchor = create_ordinal_scope_modifier(
m.cursorless_scope_type, m.ordinal_or_last_list[0]
m.cursorless_scope_type, m.cursorless_ordinal_or_last_list[0]
)
if len(m.ordinal_or_last_list) > 1:
if len(m.cursorless_ordinal_or_last_list) > 1:
active = create_ordinal_scope_modifier(
m.cursorless_scope_type, m.ordinal_or_last_list[1]
m.cursorless_scope_type, m.cursorless_ordinal_or_last_list[1]
)
range_connective: RangeConnective = m.cursorless_range_connective
return {
Expand Down

0 comments on commit 1e996d2

Please sign in to comment.