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

Double-width character measured incorrectly when in background of modal screen (again) #5243

Open
kwevin opened this issue Nov 16, 2024 · 2 comments

Comments

@kwevin
Copy link

kwevin commented Nov 16, 2024

Continuation of #5090

Textual Diagnostics

Versions

Name Value
Textual 0.85.2
Rich 13.9.4

MRE

from textual import events, on
from textual.app import App, ComposeResult
from textual.containers import Center, Grid, Middle
from textual.screen import ModalScreen
from textual.widgets import Button, DataTable, Label


class QuitScreen(ModalScreen):
    DEFAULT_CSS = """
    QuitScreen {
        align: center middle;
    }

    #dialog {
        grid-size: 2;
        grid-gutter: 1 2;
        grid-rows: 1fr 3;
        padding: 0 1;
        width: 60;
        height: 11;
        border: thick $primary 80%;
        background: $surface;
    }

    #question {
        column-span: 2;
        height: 1fr;
        width: 1fr;
        content-align: center middle;
    }
    Button {
        width: 100%;
    }   
    """
    """Screen with a dialog to quit."""

    def compose(self) -> ComposeResult:
        yield Grid(
            Label("Are you sure you want to quit?", id="question"),
            Button("Quit", variant="error", id="quit"),
            Button("Cancel", variant="primary", id="cancel"),
            id="dialog",
        )

    def on_button_pressed(self, event: Button.Pressed) -> None:
        if event.button.id == "quit":
            self.app.exit()
        else:
            self.app.pop_screen()


DATA = [
    ["Id", "Track", "Requested By", "Played At", "Artists", "Album", "Source"],
    ["20371", "Hitotsubu no Kiseki", "", "19:11:42", "BUTAOTOME, Ranko", "Abyss", ""],
    [
        "3508",
        "think twice",
        "kwevin",
        "19:06:32",
        "FUZZY CONTROL",
        "",
        "Kouchuu Ouja Mushiking Mori no Tami no Densetsu",
    ],
    ["14930", "Tomaranai Mirai", "", "19:02:23", "I-1club", "Resurrection/Tomaranai Mirai", ""],
    [
        "25041",
        "crossing field - LiVE is Smile Always-ASiA TOUR 2018",
        "",
        "18:57:46",
        "LiSA",
        "“LiVE is Smile Always-ASiA TOUR 2018-[eN]” LiVE at OSAKA-JO HALL 2018.06.30-07.01",
        "",
    ],
    [
        "19671",
        "HELLO, YOUR ANGEL♪",
        "",
        "18:53:14",
        "中谷 育 (CV: 原嶋あかり), 天空橋朋花 (CV: Koiwai Kotori)",
        "THE IDOLM@STER LIVE THE@TER DREAMERS 04",
        "THE iDOLM@STER: Million Live!",
    ],
    ["4649", "風が吹いてる", "", "18:48:40", "ヘクとパスカル", "", ""],
    ["6417", "Hello", "", "18:44:47", "新山詩織", "ハローグッバイ", ""],
    ["22184", "Masage Cannavaro", "", "18:38:58", "ATARASHII GAKKO!", "Wakage ga Itaru", ""],
    ["14216", "なんでもないや", "", "18:33:18", "Lefty Hand Cream", "Lefty Hand Covers", ""],
    ["3855", "空っぽの空に潰される", "", "18:28:17", "amazarashi", "", ""],
    ["7603", "フタリボシ with 伊東歌詞太郎", "", "18:23:50", "96neko", "7S", ""],
    ["8677", "Absolute Soul -blade-", "", "18:19:37", "Konomi Suzuki, Masami Okui", "Absolute Soul", ""],
    ["9212", "Endress Honey Roop", "", "18:15:09", "たま, ココ", "いのたま", ""],
    [
        "25016",
        "Crow Song -2015 Budokan Live Chocolate Ver.-",
        "",
        "18:10:40",
        "LiSA",
        'LiVE is Smile Always - PiNK & BLACK - in Nippon Budokan "Choco Doughnut"',
        "",
    ],
    ["21564", "farewell", "", "18:06:04", "綾倉盟", "Poptrick", ""],
    ["4071", "Love Wonderland", "", "18:01:39", "Happiness", "", ""],
    ["16781", "Yura Yura Ring-Dong Dance", "", "17:57:33", "Pastel*Palettes", "Yura Yura Ring-Dong Dance", ""],
    ["25330", "Zutto Soba ni", "", "17:52:26", "Co shu Nie", "LITMUS", ""],
    [
        "24936",
        "Daikirai na Hazu datta.",
        "",
        "17:48:19",
        "HoneyWorks, Kotarou Enomoto (CV: Natsuki Hanae), Hina Setoguchi (CV: Momo Asakura)",
        "Sukisugite Yabai. - Kokuhaku Jikko Iinkai Character Song Collection-",
        "",
    ],
    ["2891", "No title", "", "17:43:28", "REOL", "", ""],
]


class MyApp(App[None]):
    def compose(self) -> ComposeResult:
        with Middle(), Center():
            yield DataTable()

    def on_mount(self) -> None:
        table = self.query_one(DataTable)
        table.add_columns(*DATA[0])
        table.add_rows(DATA[1:])
        self.push_screen(QuitScreen())


app = MyApp()
app.run()

image

@willmcgugan
Copy link
Collaborator

I can't reproduce this. Please update to the latest Textual.

@Textualize Textualize deleted a comment from github-actions bot Nov 27, 2024
@kwevin
Copy link
Author

kwevin commented Dec 1, 2024

Still present in the latest version
image

Textual Diagnostics

Versions

Name Value
Textual 0.88.1
Rich 13.9.4

Python

Name Value
Version 3.11.1
Implementation CPython
Compiler MSC v.1934 64 bit (AMD64)
Executable C:\Users\Kevin\AppData\Local\pypoetry\Cache\virtualenvs\listentui-qruDwX8r-py3.11\Scripts\python.exe

Operating System

Name Value
System Windows
Release 10
Version 10.0.22621

Terminal

Name Value
Terminal Application Windows Terminal
TERM Not set
COLORTERM Not set
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=135, height=26
legacy_windows False
min_width 1
max_width 135
is_terminal True
encoding utf-8
max_height 26
justify None
overflow None
no_wrap False
highlight None
markup None
height None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants