Skip to content

Commit

Permalink
Only enable resume hinting with arrow if at the end of the line
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Apr 28, 2023
1 parent d016fdb commit e9945f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion IPython/terminal/shortcuts/__init__.py
Expand Up @@ -277,7 +277,9 @@ def create_identifier(handler: Callable):
Binding(
auto_suggest.resume_hinting,
["right"],
"default_buffer_focused & emacs_like_insert_mode",
"is_cursor_at_the_end_of_line"
" & default_buffer_focused"
" & emacs_like_insert_mode",
),
]

Expand Down
8 changes: 8 additions & 0 deletions IPython/terminal/shortcuts/filters.py
Expand Up @@ -52,6 +52,13 @@ def has_line_below() -> bool:
return document.cursor_position_row < len(document.lines) - 1


@undoc
@Condition
def is_cursor_at_the_end_of_line() -> bool:
document = get_app().current_buffer.document
return document.is_cursor_at_the_end_of_line


@undoc
@Condition
def has_line_above() -> bool:
Expand Down Expand Up @@ -179,6 +186,7 @@ def is_windows_os():
"never": Never(),
"has_line_below": has_line_below,
"has_line_above": has_line_above,
"is_cursor_at_the_end_of_line": is_cursor_at_the_end_of_line,
"has_selection": has_selection,
"has_suggestion": has_suggestion,
"vi_mode": vi_mode,
Expand Down

0 comments on commit e9945f7

Please sign in to comment.