Skip to content

Commit

Permalink
Fix empty paste.
Browse files Browse the repository at this point in the history
Related issues: #2563.
  • Loading branch information
rodrigogiraoserrao committed May 15, 2023
1 parent fe7812d commit 81289c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed `TreeNode.collapse` and `TreeNode.collapse_all` not posting a `Tree.NodeCollapsed` message https://github.com/Textualize/textual/issues/2535
- Fixed `TreeNode.toggle` and `TreeNode.toggle_all` not posting a `Tree.NodeExpanded` or `Tree.NodeCollapsed` message https://github.com/Textualize/textual/issues/2535
- `footer--description` component class was being ignored https://github.com/Textualize/textual/issues/2544
- Pasting empty selection in `Input` would raise an exception https://github.com/Textualize/textual/issues/2563

### Added

Expand Down
2 changes: 1 addition & 1 deletion src/textual/widgets/_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ async def _on_key(self, event: events.Key) -> None:
event.prevent_default()

def _on_paste(self, event: events.Paste) -> None:
line = event.text.splitlines()[0]
line = event.text.splitlines()[0] if event.text else ""
self.insert_text_at_cursor(line)
event.stop()

Expand Down

0 comments on commit 81289c3

Please sign in to comment.