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

fix(text area): end mouse selection only if currently selecting #4436

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

### Fixed

- Fixed `TextArea` to end mouse selection only if currently selecting https://github.com/Textualize/textual/pull/4436

## [0.57.1] - 2024-04-20

### Fixed
Expand Down
11 changes: 6 additions & 5 deletions src/textual/widgets/_text_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,17 +1513,18 @@ async def _on_mouse_move(self, event: events.MouseMove) -> None:

def _end_mouse_selection(self) -> None:
"""Finalize the selection that has been made using the mouse."""
self._selecting = False
self.release_mouse()
self.record_cursor_width()
self._restart_blink()
if self._selecting:
self._selecting = False
self.release_mouse()
self.record_cursor_width()
self._restart_blink()

async def _on_mouse_up(self, event: events.MouseUp) -> None:
"""Finalize the selection that has been made using the mouse."""
self._end_mouse_selection()

async def _on_hide(self, event: events.Hide) -> None:
"""Finalize the selection that has been made using the mouse when thew widget is hidden."""
"""Finalize the selection that has been made using the mouse when the widget is hidden."""
self._end_mouse_selection()

async def _on_paste(self, event: events.Paste) -> None:
Expand Down
Loading