Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper to go to the middle of a line #1424

Merged
merged 9 commits into from
Jun 4, 2024
8 changes: 8 additions & 0 deletions core/edit/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,11 @@ def delete_line_end():
"""Delete to end of current line"""
actions.user.select_line_end()
actions.edit.delete()

def line_middle():
"""Go to the middle of the line"""
actions.edit.select_line()
half_line_length = int(len(actions.edit.selected_text()) / 2)
actions.edit.left()
for i in range(0, half_line_length):
actions.edit.right()
2 changes: 2 additions & 0 deletions core/edit/edit.talon
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,5 @@ redo that: edit.redo()
# Save
file save: edit.save()
file save all: edit.save_all()

[go] line mid: user.line_middle()