Skip to content

Commit

Permalink
Added Cursorless prefects to ordinal_or_last capture
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Nov 21, 2024
1 parent 8cd7c21 commit 2e4164f
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 2e4164f

Please sign in to comment.