Merge branch 'main' into feat-directory-tree-add-directory-selected-message

This commit is contained in:
Will McGugan
2023-09-11 10:30:02 +01:00
committed by GitHub
4 changed files with 21 additions and 2 deletions

View File

@@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
defaults:
run:
shell: bash
@@ -33,6 +33,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: x64
allow-prereleases: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3

View File

@@ -5,12 +5,18 @@ 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]
## Unreleased
### Added
- Added `DirectoryTree.DirectorySelected` message https://github.com/Textualize/textual/issues/3200
### Fixed
- Fixed a crash when removing an option from an `OptionList` while the mouse is hovering over the last option https://github.com/Textualize/textual/issues/3270
## [0.36.0] - 2023-09-05
### Added

View File

@@ -613,6 +613,7 @@ class OptionList(ScrollView, can_focus=True):
self._refresh_content_tracking(force=True)
# Force a re-validation of the highlight.
self.highlighted = self.highlighted
self._mouse_hovering_over = None
self.refresh()
def remove_option(self, option_id: str) -> Self:

View File

@@ -5,6 +5,7 @@ from __future__ import annotations
import pytest
from textual.app import App, ComposeResult
from textual.geometry import Offset
from textual.widgets import OptionList
from textual.widgets.option_list import Option, OptionDoesNotExist
@@ -99,3 +100,13 @@ async def test_remove_invalid_index() -> None:
async with OptionListApp().run_test() as pilot:
with pytest.raises(OptionDoesNotExist):
pilot.app.query_one(OptionList).remove_option_at_index(23)
async def test_remove_with_hover_on_last_option():
"""https://github.com/Textualize/textual/issues/3270"""
async with OptionListApp().run_test() as pilot:
await pilot.hover(OptionList, Offset(1, 1) + Offset(2, 1))
option_list = pilot.app.query_one(OptionList)
assert option_list._mouse_hovering_over == 1
option_list.remove_option_at_index(0)
assert option_list._mouse_hovering_over == None