nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: Textualize/rich
Pull request #2254 (2022-05-05 10:30:10)

Forward the internal handle name wrapped in `rich.progress._Reader`
## Type of changes

- [x] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [ ] Tests
- [ ] Other

## Checklist

- [x] I've run the latest [black](https://github.com/psf/black) with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.

## Description

Hi all!

This is just a quick follow-up patch for file/progress so that the reader takes the `name` attribute from the internal handle. Currently, the `_Reader` has a `name` attribute (inherited from `RawIOBase`) but it's always `None`.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb65a531..8df3c65b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 - Change SVG export to create a simpler SVG
 - Fix render_lines crash when render height was negative https://github.com/Textualize/rich/pull/2246
+- Make objects from `rich.progress.open` forward the name of the internal handle https://github.com/Textualize/rich/pull/2254
 
 ### Added
 
diff --git a/rich/progress.py b/rich/progress.py
index ca52c4b9..c8eeefbf 100644
--- a/rich/progress.py
+++ b/rich/progress.py
@@ -216,6 +216,10 @@ class _Reader(RawIOBase, BinaryIO):
     def isatty(self) -> bool:
         return self.handle.isatty()
 
+    @property
+    def name(self) -> str:
+        return self.handle.name
+
     def readable(self) -> bool:
         return self.handle.readable()
 


Test patch:
diff --git a/tests/test_progress.py b/tests/test_progress.py
index 8a90ad80..792ee636 100644
--- a/tests/test_progress.py
+++ b/tests/test_progress.py
@@ -600,6 +600,7 @@ def test_open_text_mode() -> None:
     try:
         with rich.progress.open(filename, "r") as f:
             assert f.read() == "Hello, World!"
+            assert f.name == filename
         assert f.closed
     finally:
         os.remove(filename)
@@ -613,6 +614,7 @@ def test_wrap_file() -> None:
         with open(filename, "rb") as file:
             with rich.progress.wrap_file(file, total=total) as f:
                 assert f.read() == b"Hello, World!"
+                assert f.name == filename
             assert f.closed
             assert not f.handle.closed
             assert not file.closed
Repository: Textualize/rich
Pull request #2343 (2022-06-15 16:07:46)

Fix interaction between `Console(record=True)` and `Capture` context manager
## Type of changes

- [x] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [ ] Tests
- [ ] Other

## Checklist

- [x] I've run the latest [black](https://github.com/psf/black) with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.

## Description

Fixes the issue described in https://github.com/Textualize/rich/issues/2172


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 24306ba8..6888cd36 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Allow exceptions that are raised while a Live is rendered to be displayed and/or processed https://github.com/Textualize/rich/pull/2305
 - Fix crashes that can happen with `inspect` when docstrings contain some special control codes https://github.com/Textualize/rich/pull/2294
 - Fix edges used in first row of tables when `show_header=False` https://github.com/Textualize/rich/pull/2330
+- Fix interaction between `Capture` contexts and `Console(record=True)` https://github.com/Textualize/rich/pull/2343
 - Fixed hash issue in Styles class https://github.com/Textualize/rich/pull/2346
 
 ## [12.4.4] - 2022-05-24
diff --git a/rich/console.py b/rich/console.py
index eba27611..230ca769 100644
--- a/rich/console.py
+++ b/rich/console.py
@@ -1959,11 +1959,11 @@ class Console:
             del self._buffer[:]
             return
         with self._lock:
-            if self._buffer_index == 0:
+            if self.record:
+                with self._record_buffer_lock:
+                    self._record_buffer.extend(self._buffer[:])
 
-                if self.record:
-                    with self._record_buffer_lock:
-                        self._record_buffer.extend(self._buffer[:])
+            if self._buffer_index == 0:
 
                 if self.is_jupyter:  # pragma: no cover
                     from .jupyter import display


Test patch:
diff --git a/tests/test_console.py b/tests/test_console.py
index 828d3775..2db88af0 100644
--- a/tests/test_console.py
+++ b/tests/test_console.py
@@ -351,6 +351,23 @@ def test_capture():
     assert capture.get() == "Hello\n"
 
 
+def test_capture_and_record(capsys):
+    recorder = Console(record=True)
+    recorder.print("ABC")
+
+    with recorder.capture() as capture:
+        recorder.print("Hello")
+
+    assert capture.get() == "Hello\n"
+
+    recorded_text = recorder.export_text()
+    out, err = capsys.readouterr()
+
+    assert recorded_text == "ABC\nHello\n"
+    assert capture.get() == "Hello\n"
+    assert out == "ABC\n"
+
+
 def test_input(monkeypatch, capsys):
     def fake_input(prompt=""):
         console.file.write(prompt)
Repository: Textualize/rich
Pull request #2449 (2022-08-05 14:40:01)

Force color
## Type of changes

- [ ] Bug fix
- [x] New feature
- [ ] Documentation / docstrings
- [ ] Tests
- [ ] Other

## Checklist

- [x] I've run the latest [black](https://github.com/psf/black) with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.

## Description

Adds support for `FORCE_COLOR` environment variable.
Presence of this variable in the environment results in `Console.force_terminal = True`.
If `FORCE_COLOR` and `NO_COLOR` are both set, `NO_COLOR` takes priority.

### `NO_COLOR = 1` only

<img width="542" alt="image" src="https://user-images.githubusercontent.com/5740731/183630837-8c4221a6-679f-487f-be5e-dcb4957db42c.png">

### `NO_COLOR = 1` and `FORCE_COLOR = 1`

<img width="489" alt="image" src="https://user-images.githubusercontent.com/5740731/183630920-a280a0eb-6d1c-4da7-9654-d7b37a5d1bee.png">


### `FORCE_COLOR = 1` only

<img width="485" alt="image" src="https://user-images.githubusercontent.com/5740731/183631049-52987368-76cc-4233-be62-5f54b71b54eb.png">






Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4b2800e8..4b95a479 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,8 +5,13 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+
 ## [Unreleased]
 
+### Added
+
+- Add support for `FORCE_COLOR` env var https://github.com/Textualize/rich/pull/2449
+
 ### Fixed
 
 - Fix NO_COLOR support on legacy Windows https://github.com/Textualize/rich/pull/2458
diff --git a/rich/console.py b/rich/console.py
index 4f4675b1..4a3ebb55 100644
--- a/rich/console.py
+++ b/rich/console.py
@@ -697,7 +697,12 @@ class Console:
         self._height = height
 
         self._color_system: Optional[ColorSystem]
-        self._force_terminal = force_terminal
+
+        if force_terminal is not None:
+            self._force_terminal = force_terminal
+        else:
+            self._force_terminal = self._environ.get("FORCE_COLOR") is not None
+
         self._file = file
         self.quiet = quiet
         self.stderr = stderr


Test patch:
diff --git a/tests/test_console.py b/tests/test_console.py
index 2db88af0..07692f19 100644
--- a/tests/test_console.py
+++ b/tests/test_console.py
@@ -895,3 +895,11 @@ def test_render_lines_height_minus_vertical_pad_is_negative():
 
     # Ensuring that no exception is raised...
     console.render_lines(Padding("hello", pad=(1, 0)), options=options)
+
+
+@mock.patch.dict(os.environ, {"FORCE_COLOR": "anything"})
+def test_force_color():
+    # Even though we use a non-tty file, the presence of FORCE_COLOR env var
+    # means is_terminal returns True.
+    console = Console(file=io.StringIO())
+    assert console.is_terminal
Repository: Textualize/rich
Pull request #2529 (2022-09-19 14:15:29)

Add Kitty exception
Adds an exception for Kitty terminal.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f1cbe4ca..bcb3f0af 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,14 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 
-## [Unreleased]
+## [12.6.0] - Unreleased
 
 ### Added
 
 - Parse ANSI escape sequences in pretty repr https://github.com/Textualize/rich/pull/2470
 - Add support for `FORCE_COLOR` env var https://github.com/Textualize/rich/pull/2449
 - Allow a `max_depth` argument to be passed to the `install()` hook https://github.com/Textualize/rich/issues/2486
-- Document using `None` as name in `__rich_repr__` for tuple posotional args https://github.com/Textualize/rich/pull/2379
+- Document using `None` as name in `__rich_repr__` for tuple positional args https://github.com/Textualize/rich/pull/2379
 
 ### Fixed
 
diff --git a/rich/console.py b/rich/console.py
index 585221e0..2638155e 100644
--- a/rich/console.py
+++ b/rich/console.py
@@ -106,7 +106,11 @@ _STD_STREAMS = (_STDIN_FILENO, _STDOUT_FILENO, _STDERR_FILENO)
 _STD_STREAMS_OUTPUT = (_STDOUT_FILENO, _STDERR_FILENO)
 
 
-_TERM_COLORS = {"256color": ColorSystem.EIGHT_BIT, "16color": ColorSystem.STANDARD}
+_TERM_COLORS = {
+    "kitty": ColorSystem.EIGHT_BIT,
+    "256color": ColorSystem.EIGHT_BIT,
+    "16color": ColorSystem.STANDARD,
+}
 
 
 class ConsoleDimensions(NamedTuple):


Test patch:
diff --git a/tests/test_console.py b/tests/test_console.py
index fa676535..369f0a67 100644
--- a/tests/test_console.py
+++ b/tests/test_console.py
@@ -66,6 +66,16 @@ def test_truecolor_terminal():
     assert console.color_system == "truecolor"
 
 
+@pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")
+def test_kitty_terminal():
+    console = Console(
+        force_terminal=True,
+        legacy_windows=False,
+        _environ={"TERM": "xterm-kitty"},
+    )
+    assert console.color_system == "256"
+
+
 def test_console_options_update():
     options = ConsoleOptions(
         ConsoleDimensions(80, 25),
Repository: Textualize/rich
Pull request #2736 (2023-01-06 14:15:24)

fix issue splitting segments
Fixes an issue where splitting a string with mix cell lengths results in the wrong pair of Segments.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f3af54fd..ab3c436e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [13.0.1] - 2022-01-06
+
+### Fixed
+
+- Fixed issue with Segment.split_cells for mixed single and double cell widths
+
 ## [13.0.0] - 2022-12-30
 
 ### Fixed
diff --git a/rich/segment.py b/rich/segment.py
index 6c87a791..d489d137 100644
--- a/rich/segment.py
+++ b/rich/segment.py
@@ -119,7 +119,7 @@ class Segment(NamedTuple):
 
         cell_size = get_character_cell_size
 
-        pos = int((cut / cell_length) * len(text))
+        pos = int((cut / cell_length) * (len(text) - 1))
 
         before = text[:pos]
         cell_pos = cell_len(before)


Test patch:
diff --git a/tests/test_segment.py b/tests/test_segment.py
index 5c3bbc39..3db60b90 100644
--- a/tests/test_segment.py
+++ b/tests/test_segment.py
@@ -273,6 +273,11 @@ def test_divide_edge_2():
         ("💩X💩Y💩Z💩A💩", 4, (Segment("💩X "), Segment(" Y💩Z💩A💩"))),
         ("XYZABC", 4, (Segment("XYZA"), Segment("BC"))),
         ("XYZABC", 5, (Segment("XYZAB"), Segment("C"))),
+        (
+            "a1あ１１bcdaef",
+            9,
+            (Segment("a1あ１１b"), Segment("cdaef")),
+        ),
     ],
 )
 def test_split_cells_emoji(text, split, result):
Repository: Textualize/rich
Pull request #2820 (2023-02-19 22:52:18)

fix for empty dataclass
Fixes https://github.com/Textualize/rich/issues/2819


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26effda4..b8cfd514 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [13.3.2] - Unreleased
+
+### Fixed
+
+- Fixed pretty printing of empty dataclass https://github.com/Textualize/rich/issues/2819
+
 ## [13.3.1] - 2023-01-28
 
 ### Fixed
diff --git a/rich/pretty.py b/rich/pretty.py
index 83c6c1e6..f257b15a 100644
--- a/rich/pretty.py
+++ b/rich/pretty.py
@@ -793,6 +793,7 @@ def traverse(
                     close_brace=")",
                     children=children,
                     last=root,
+                    empty=f"{obj.__class__.__name__}()",
                 )
 
                 for last, field in loop_last(


Test patch:
diff --git a/tests/test_pretty.py b/tests/test_pretty.py
index 53256379..46dd57a8 100644
--- a/tests/test_pretty.py
+++ b/tests/test_pretty.py
@@ -175,6 +175,11 @@ class ExampleDataclass:
     last: int = field(default=1, repr=False)
 
 
+@dataclass
+class Empty:
+    pass
+
+
 def test_pretty_dataclass():
     dc = ExampleDataclass(1000, "Hello, World", 999, ["foo", "bar", "baz"])
     result = pretty_repr(dc, max_width=80)
@@ -195,6 +200,11 @@ def test_pretty_dataclass():
     assert result == "ExampleDataclass(foo=1000, bar=..., baz=['foo', 'bar', 'baz'])"
 
 
+def test_empty_dataclass():
+    assert pretty_repr(Empty()) == "Empty()"
+    assert pretty_repr([Empty()]) == "[Empty()]"
+
+
 class StockKeepingUnit(NamedTuple):
     name: str
     description: str
Repository: Textualize/rich
Pull request #2923 (2023-04-12 16:35:16)

fix for is_terminal
Fixes `FORCE_COLOR` not being respected.

Fixes https://github.com/Textualize/rich/issues/2859


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ef99e5e..21386b2a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [13.3.4] - 2023-04-12
+
+### Fixed
+
+- Fixed for `is_terminal` ignoring FORCE_COLOR https://github.com/Textualize/rich/pull/2923
+
 ## [13.3.3] - 2023-02-27
 
 ### Added
@@ -1930,6 +1936,8 @@ Major version bump for a breaking change to `Text.stylize signature`, which corr
 
 - First official release, API still to be stabilized
 
+[13.3.4]: https://github.com/textualize/rich/compare/v13.3.3...v13.3.4
+[13.3.3]: https://github.com/textualize/rich/compare/v13.3.2...v13.3.3
 [13.3.2]: https://github.com/textualize/rich/compare/v13.3.1...v13.3.2
 [13.3.1]: https://github.com/textualize/rich/compare/v13.3.0...v13.3.1
 [13.3.0]: https://github.com/textualize/rich/compare/v13.2.0...v13.3.0
diff --git a/rich/console.py b/rich/console.py
index 8a0fdcd9..cd6f5e57 100644
--- a/rich/console.py
+++ b/rich/console.py
@@ -952,6 +952,7 @@ class Console:
         force_color = self._environ.get("FORCE_COLOR")
         if force_color is not None:
             self._force_terminal = True
+            return True
 
         isatty: Optional[Callable[[], bool]] = getattr(self.file, "isatty", None)
         try:
@@ -2000,7 +2001,6 @@ class Console:
                     self._record_buffer.extend(self._buffer[:])
 
             if self._buffer_index == 0:
-
                 if self.is_jupyter:  # pragma: no cover
                     from .jupyter import display
 


Test patch:
diff --git a/tests/test_console.py b/tests/test_console.py
index 3bcddefd..990dce14 100644
--- a/tests/test_console.py
+++ b/tests/test_console.py
@@ -979,3 +979,15 @@ def test_force_color_jupyter():
         file=io.StringIO(), _environ={"FORCE_COLOR": "1"}, force_jupyter=True
     )
     assert not console.is_terminal
+
+
+def test_force_color():
+    console = Console(
+        file=io.StringIO(),
+        _environ={
+            "FORCE_COLOR": "1",
+            "TERM": "xterm-256color",
+            "COLORTERM": "truecolor",
+        },
+    )
+    assert console.color_system in ("truecolor", "windows")
Repository: Textualize/rich
Pull request #3063 (2023-07-29 08:44:44)

Fix escaping trailing backslash
Fixes https://github.com/Textualize/rich/issues/2987


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae674ef1..31ce3911 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 - Fixed Text.expand_tabs not expanding spans.
 - Fixed TimeElapsedColumn from showing negative.
+- Fix for escaping strings with a trailing backslash https://github.com/Textualize/rich/issues/2987
 
 ### Added
 
diff --git a/rich/markup.py b/rich/markup.py
index 0ffd056d..cb927edd 100644
--- a/rich/markup.py
+++ b/rich/markup.py
@@ -64,6 +64,9 @@ def escape(
         return f"{backslashes}{backslashes}\\{text}"
 
     markup = _escape(escape_backslashes, markup)
+    if markup.endswith("\\") and not markup.endswith("\\\\"):
+        return markup + "\\"
+
     return markup
 
 
@@ -226,7 +229,6 @@ def render(
 
 
 if __name__ == "__main__":  # pragma: no cover
-
     MARKUP = [
         "[red]Hello World[/red]",
         "[magenta]Hello [b]World[/b]",


Test patch:
diff --git a/tests/test_markup.py b/tests/test_markup.py
index 894946b4..13835fac 100644
--- a/tests/test_markup.py
+++ b/tests/test_markup.py
@@ -3,7 +3,7 @@ import pytest
 from rich.console import Console
 from rich.errors import MarkupError
 from rich.markup import RE_TAGS, Tag, _parse, escape, render
-from rich.text import Span
+from rich.text import Span, Text
 
 
 def test_re_no_match():
@@ -44,6 +44,18 @@ def test_escape():
     assert escape("[nil, [nil]]") == r"[nil, \[nil]]"
 
 
+def test_escape_backslash_end():
+    # https://github.com/Textualize/rich/issues/2987
+    value = "C:\\"
+    assert escape(value) == "C:\\\\"
+
+    escaped_tags = f"[red]{escape(value)}[/red]"
+    assert escaped_tags == "[red]C:\\\\[/red]"
+    escaped_text = Text.from_markup(escaped_tags)
+    assert escaped_text.plain == "C:\\"
+    assert escaped_text.spans == [Span(0, 3, "red")]
+
+
 def test_render_escape():
     console = Console(width=80, color_system=None)
     console.begin_capture()
Repository: Textualize/rich
Pull request #3064 (2023-07-29 09:07:48)

fix for markdown table
Fixes https://github.com/Textualize/rich/issues/3053


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 31ce3911..2cac5fe5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Fixed Text.expand_tabs not expanding spans.
 - Fixed TimeElapsedColumn from showing negative.
 - Fix for escaping strings with a trailing backslash https://github.com/Textualize/rich/issues/2987
+- Fixed exception in Markdown with partial table https://github.com/Textualize/rich/issues/3053 
 
 ### Added
 
diff --git a/rich/markdown.py b/rich/markdown.py
index e2cedfaa..704da301 100644
--- a/rich/markdown.py
+++ b/rich/markdown.py
@@ -254,15 +254,14 @@ class TableElement(MarkdownElement):
     ) -> RenderResult:
         table = Table(box=box.SIMPLE_HEAVY)
 
-        assert self.header is not None
-        assert self.header.row is not None
-        for column in self.header.row.cells:
-            table.add_column(column.content)
-
-        assert self.body is not None
-        for row in self.body.rows:
-            row_content = [element.content for element in row.cells]
-            table.add_row(*row_content)
+        if self.header is not None and self.header.row is not None:
+            for column in self.header.row.cells:
+                table.add_column(column.content)
+
+        if self.body is not None:
+            for row in self.body.rows:
+                row_content = [element.content for element in row.cells]
+                table.add_row(*row_content)
 
         yield table
 


Test patch:
diff --git a/tests/test_markdown.py b/tests/test_markdown.py
index 861665cf..1321dcea 100644
--- a/tests/test_markdown.py
+++ b/tests/test_markdown.py
@@ -133,6 +133,14 @@ def test_markdown_table():
     assert result == expected
 
 
+def test_partial_table():
+    markdown = Markdown("| Simple | Table |\n| ------ | ----- ")
+    result = render(markdown)
+    print(repr(result))
+    expected = "\n                  \n \x1b[1m \x1b[0m\x1b[1mSimple\x1b[0m\x1b[1m \x1b[0m \x1b[1m \x1b[0m\x1b[1mTable\x1b[0m\x1b[1m \x1b[0m \n ━━━━━━━━━━━━━━━━ \n                  \n"
+    assert result == expected
+
+
 if __name__ == "__main__":
     markdown = Markdown(MARKDOWN)
     rendered = render(markdown)
Repository: Textualize/rich
Pull request #3454 (2024-08-15 16:22:06)

Fix [BUG] @ breaks highlighting in hyperlink #3327
## Type of changes

- [x] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [x] Tests
- [ ] Other

## Checklist

- [ ] I've run the latest [black](https://github.com/psf/black) with default args on new code.
- [ ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.

## Description
Fixed the bug [#3327](https://github.com/Textualize/rich/issues/3327).

Changes -
1. Added '@' in rich.highlighter:ReprHighlighter url regex pattern.
2. Added a test case in test_highlighter for the url with '@'.

## Note
Poetry installed black v22.12.0 and its formatting differs a bit from the latest version v24.8.0. Hence I've formatted with the prior to keep it consistent.


Patch:
diff --git a/rich/highlighter.py b/rich/highlighter.py
index 27714b25..e4c462e2 100644
--- a/rich/highlighter.py
+++ b/rich/highlighter.py
@@ -98,7 +98,7 @@ class ReprHighlighter(RegexHighlighter):
             r"(?P<number>(?<!\w)\-?[0-9]+\.?[0-9]*(e[-+]?\d+?)?\b|0x[0-9a-fA-F]*)",
             r"(?P<path>\B(/[-\w._+]+)*\/)(?P<filename>[-\w._+]*)?",
             r"(?<![\\\w])(?P<str>b?'''.*?(?<!\\)'''|b?'.*?(?<!\\)'|b?\"\"\".*?(?<!\\)\"\"\"|b?\".*?(?<!\\)\")",
-            r"(?P<url>(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#~]*)",
+            r"(?P<url>(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#~@]*)",
         ),
     ]
 


Test patch:
diff --git a/tests/test_highlighter.py b/tests/test_highlighter.py
index 30851cf7..d1992827 100644
--- a/tests/test_highlighter.py
+++ b/tests/test_highlighter.py
@@ -134,6 +134,7 @@ highlight_tests = [
     (" http://example.org ", [Span(1, 19, "repr.url")]),
     (" http://example.org/index.html ", [Span(1, 30, "repr.url")]),
     (" http://example.org/index.html#anchor ", [Span(1, 37, "repr.url")]),
+    ("https://www.youtube.com/@LinusTechTips", [Span(0, 38, "repr.url")]),
     (
         " http://example.org/index.html?param1=value1 ",
         [