Repository: Textualize/textual

Issue:
Issues with in-demo CSS code display — pull request welcome?
Hi, thanks for making textual and sharing it as Open Source! :pray: :+1: 

When I played with `python -m textual` today, I noticed that the CSS section — after scrolling to the bottom — …

![textual_Screenshot_20230426_175034](https://user-images.githubusercontent.com/1577132/234631384-215978cf-c9b3-47f7-b6af-1641d264c5c7.png)

…makes it _appears_ as if `OptionGroup {` was the last of 50 lines of the [file `demo.css`](https://github.com/Textualize/textual/blob/4148b1d4501f405eac9c74485ff876ffc8201ca7/src/textual/demo.css#L50). From a user point of view it felt broken and unintended so I had a closer look to find that:
- commit e419a0821cda7c5860c171a20c09034daaf82dea added explicit `[:50]`
- the same commit resolves use of `EXAMPLE_CSS` and that variable is now unused.

I would like to make one or two pull requests dropping the `[:50]` and dropping unused variable `EXAMPLE_CSS`.
Would that be welcome, should it be one or two, or would you rather quickfix this yourself?

Thanks and best, Sebastian
Issues with in-demo CSS code display — pull request welcome?
Hi, thanks for making textual and sharing it as Open Source! :pray: :+1: 

When I played with `python -m textual` today, I noticed that the CSS section — after scrolling to the bottom — …

![textual_Screenshot_20230426_175034](https://user-images.githubusercontent.com/1577132/234631384-215978cf-c9b3-47f7-b6af-1641d264c5c7.png)

…makes it _appears_ as if `OptionGroup {` was the last of 50 lines of the [file `demo.css`](https://github.com/Textualize/textual/blob/4148b1d4501f405eac9c74485ff876ffc8201ca7/src/textual/demo.css#L50). From a user point of view it felt broken and unintended so I had a closer look to find that:
- commit e419a0821cda7c5860c171a20c09034daaf82dea added explicit `[:50]`
- the same commit resolves use of `EXAMPLE_CSS` and that variable is now unused.

I would like to make one or two pull requests dropping the `[:50]` and dropping unused variable `EXAMPLE_CSS`.
Would that be welcome, should it be one or two, or would you rather quickfix this yourself?

Thanks and best, Sebastian


Discussion:
Thank you for your issue. Give us a little time to review it.

PS. You might want to check the [FAQ](https://github.com/textualize/textual/blob/main/FAQ.md) if you haven't done so already.

This is an automated reply, generated by [FAQtory](https://github.com/willmcgugan/faqtory)
Hey @hartwork, thanks for reaching out. I agree that that looks a bit misleading, although _technically_ the prose above says that it is just an excerpt of the CSS.

I guess you could make a PR dropping the slicing of the CSS to just display the whole app CSS, assuming it is not a ridiculously long CSS file.

If it looks like _too much_ CSS, I suggest you split on `"\n\n"`, pick a couple of sections, and then join them back together with `"\n\n"`.
A single PR should be fine.
Thank you for your issue. Give us a little time to review it.

PS. You might want to check the [FAQ](https://github.com/textualize/textual/blob/main/FAQ.md) if you haven't done so already.

This is an automated reply, generated by [FAQtory](https://github.com/willmcgugan/faqtory)
Hey @hartwork, thanks for reaching out. I agree that that looks a bit misleading, although _technically_ the prose above says that it is just an excerpt of the CSS.

I guess you could make a PR dropping the slicing of the CSS to just display the whole app CSS, assuming it is not a ridiculously long CSS file.

If it looks like _too much_ CSS, I suggest you split on `"\n\n"`, pick a couple of sections, and then join them back together with `"\n\n"`.
A single PR should be fine.

Resolving patch:
diff --git a/src/textual/demo.py b/src/textual/demo.py
--- a/src/textual/demo.py
+++ b/src/textual/demo.py
@@ -94,25 +94,6 @@
 Here's an example of some CSS used in this app:
 """
 
-
-EXAMPLE_CSS = """\
-Screen {
-    layers: base overlay notes;
-    overflow: hidden;
-}
-
-Sidebar {
-    width: 40;
-    background: $panel;
-    transition: offset 500ms in_out_cubic;
-    layer: overlay;
-
-}
-
-Sidebar.-hidden {
-    offset-x: -100%;
-}"""
-
 DATA = {
     "foo": [
         3.1427,
@@ -313,7 +294,7 @@ def add_note(self, renderable: RenderableType) -> None:
         self.query_one(TextLog).write(renderable)
 
     def compose(self) -> ComposeResult:
-        example_css = "\n".join(Path(self.css_path[0]).read_text().splitlines()[:50])
+        example_css = Path(self.css_path[0]).read_text()
         yield Container(
             Sidebar(classes="-hidden"),
             Header(show_clock=False),


Test patch: