-
Notifications
You must be signed in to change notification settings - Fork 144
feat: add Shift+Enter as newline insert keybinding #229
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -985,6 +985,14 @@ def test_ctrl_enter_newline(self, captured_bindings): | |||||||||||||||||||||||||||||
| handler(event) | ||||||||||||||||||||||||||||||
| event.app.current_buffer.insert_text.assert_called_with("\n") | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| def test_shift_enter_newline(self, captured_bindings): | ||||||||||||||||||||||||||||||
| """Test shift-enter inserts newline (terminal-dependent).""" | ||||||||||||||||||||||||||||||
| handler = self._find_handler(captured_bindings, "s-enter") | ||||||||||||||||||||||||||||||
| if handler is not None: | ||||||||||||||||||||||||||||||
| event = MagicMock() | ||||||||||||||||||||||||||||||
| handler(event) | ||||||||||||||||||||||||||||||
| event.app.current_buffer.insert_text.assert_called_with("\n") | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Comment on lines
+988
to
+995
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make this test fail when the binding is missing.
Proposed fix def test_shift_enter_newline(self, captured_bindings):
"""Test shift-enter inserts newline (terminal-dependent)."""
handler = self._find_handler(captured_bindings, "s-enter")
- if handler is not None:
- event = MagicMock()
- handler(event)
- event.app.current_buffer.insert_text.assert_called_with("\n")
+ assert handler is not None
+ event = MagicMock()
+ handler(event)
+ event.app.current_buffer.insert_text.assert_called_with("\n")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| def test_ctrl_v_linux_xsel_fallback_filenotfound(self, captured_bindings): | ||||||||||||||||||||||||||||||
| """Cover the FileNotFoundError xsel fallback path.""" | ||||||||||||||||||||||||||||||
| handler = self._find_handler(captured_bindings, "c-v") | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: mpfaffenberger/code_puppy
Length of output: 1795
Update or remove Shift+Enter handler that silently fails to register.
prompt_toolkit3.0.52 does not defines-enteras a valid key name. WhenKeyBindings.add("s-enter", ...)is called,_parse_key()rejects it withValueError(unrecognized multi-character keys raiseInvalid key), and the surroundingtry/exceptsilently swallows the error. This means Shift+Enter is never installed, even though the CLI help and test imply it works.Either remove this handler if Shift+Enter support is not available, or replace it with a terminal-aware implementation that actually works. Update any help text or tests that describe this feature as available.
🤖 Prompt for AI Agents