5
5
from pathlib import Path
6
6
from typing import cast
7
7
8
- ##############################################################################
9
- # Rich imports.
10
- from rich .text import Text
11
-
12
8
##############################################################################
13
9
# Textual imports.
14
10
from textual import on , work
@@ -42,25 +38,11 @@ def __init__(self, location_id: int, location: HikeLocation) -> None:
42
38
self .location_id = location_id
43
39
"""The ID of the location within the history."""
44
40
super ().__init__ (
45
- # From Textual 2.x onwards overflow="ellipsis" is broken in the
46
- # "improved" OptionList.
47
- #
48
- # https://github.com/Textualize/textual/issues/5701
49
- #
50
- # The result is ugly as fuck, and as best as I can tell I can't
51
- # achieve the originally-intended layout; at least it isn't as
52
- # obvious and accessible as simply using a `Text` was. So for
53
- # now I'm going to wrap this in Textual's new `Content` -- which
54
- # seems to be Rich-like only worse -- and accept it looks as
55
- # ugly as fuck but less ugly than without this workaround.
56
- Content .from_rich_text (
57
- Text .from_markup (
58
- f"{ LOCAL_FILE_ICON } [bold]{ location .name } [/]\n [dim]{ location .parent } [/]"
59
- if isinstance (location , Path )
60
- else f"{ REMOTE_FILE_ICON } [bold]{ Path (location .path ).name } [/]"
61
- f"\n [dim]{ Path (location .path ).parent } \n { location .host } [/]" ,
62
- overflow = "ellipsis" ,
63
- )
41
+ Content .from_markup (
42
+ f"{ LOCAL_FILE_ICON } [bold]{ location .name } [/]\n [dim]{ location .parent } [/]"
43
+ if isinstance (location , Path )
44
+ else f"{ REMOTE_FILE_ICON } [bold]{ Path (location .path ).name } [/]"
45
+ f"\n [dim]{ Path (location .path ).parent } \n { location .host } [/]"
64
46
),
65
47
id = str (location_id ),
66
48
)
@@ -74,6 +56,8 @@ class HistoryView(EnhancedOptionList):
74
56
HistoryView {
75
57
height: 1fr;
76
58
border: none;
59
+ text-wrap: nowrap;
60
+ text-overflow: ellipsis;
77
61
&:focus {
78
62
border: none;
79
63
}
0 commit comments