Repository: Textualize/textual

Issue:
Extend `OptionList` so that an option's prompt can be replaced in some way
In support of #2518 the `OptionList` widget should have a method that allows for the replacement of an option's prompt, or at the very least the swapping out of one option for another.


Discussion:
Moving this back to backlog as, while it's a good idea, I think, it's far less critical now given that I've taken the multi-select widget in a slightly different direction when it comes to managing the changing of the options.
(This issue is reserved for the [EuroPython 2023 sprint](https://ep2023.europython.eu/sprints). If you are not participating in the sprint, please refrain from working on this issue. Thanks!)

[The `OptionList` widget](https://textual.textualize.io/widgets/option_list/) should grow a (couple of) method(s) to allow replacing prompts, like Dave mentions above.
Take a look at the methods that `OptionList` already implements to deal with prompts and notice many come in pairs.

Think about the following:

 - What makes more sense? Creating a `rename_prompt` method or a `replace_prompt`? Or both?
 - Should you create the method above _and_ a `_at_index` variation, or just one of the two?

Good luck and have fun!
I'd like to work on this one if it's still available;D :rocket: 



Resolving patch:
diff --git a/src/textual/widgets/_option_list.py b/src/textual/widgets/_option_list.py
--- a/src/textual/widgets/_option_list.py
+++ b/src/textual/widgets/_option_list.py
@@ -55,6 +55,14 @@ def prompt(self) -> RenderableType:
         """The prompt for the option."""
         return self.__prompt
 
+    def set_prompt(self, prompt: RenderableType) -> None:
+        """Set the prompt for the option.
+
+        Args:
+            prompt: The new prompt for the option.
+        """
+        self.__prompt = prompt
+
     @property
     def id(self) -> str | None:
         """The optional ID for the option."""
@@ -619,12 +627,7 @@ def remove_option(self, option_id: str) -> Self:
         Raises:
             OptionDoesNotExist: If no option has the given ID.
         """
-        try:
-            self._remove_option(self._option_ids[option_id])
-        except KeyError:
-            raise OptionDoesNotExist(
-                f"There is no option with an ID of '{option_id}'"
-            ) from None
+        self._remove_option(self.get_option_index(option_id))
         return self
 
     def remove_option_at_index(self, index: int) -> Self:
@@ -647,6 +650,54 @@ def remove_option_at_index(self, index: int) -> Self:
             ) from None
         return self
 
+    def _replace_option_prompt(self, index: int, prompt: RenderableType) -> None:
+        """Replace the prompt of an option in the list.
+
+        Args:
+            index: The index of the option to replace the prompt of.
+            prompt: The new prompt for the option.
+
+        Raises:
+            OptionDoesNotExist: If there is no option with the given index.
+        """
+        self.get_option_at_index(index).set_prompt(prompt)
+        self._refresh_content_tracking(force=True)
+        self.refresh()
+
+    def replace_option_prompt(self, option_id: str, prompt: RenderableType) -> Self:
+        """Replace the prompt of the option with the given ID.
+
+        Args:
+            option_id: The ID of the option to replace the prompt of.
+            prompt: The new prompt for the option.
+
+        Returns:
+            The `OptionList` instance.
+
+        Raises:
+            OptionDoesNotExist: If no option has the given ID.
+        """
+        self._replace_option_prompt(self.get_option_index(option_id), prompt)
+        return self
+
+    def replace_option_prompt_at_index(
+        self, index: int, prompt: RenderableType
+    ) -> Self:
+        """Replace the prompt of the option at the given index.
+
+        Args:
+            index: The index of the option to replace the prompt of.
+            prompt: The new prompt for the option.
+
+        Returns:
+            The `OptionList` instance.
+
+        Raises:
+            OptionDoesNotExist: If there is no option with the given index.
+        """
+        self._replace_option_prompt(index, prompt)
+        return self
+
     def clear_options(self) -> Self:
         """Clear the content of the option list.
 
@@ -720,12 +771,7 @@ def enable_option(self, option_id: str) -> Self:
         Raises:
             OptionDoesNotExist: If no option has the given ID.
         """
-        try:
-            return self.enable_option_at_index(self._option_ids[option_id])
-        except KeyError:
-            raise OptionDoesNotExist(
-                f"There is no option with an ID of '{option_id}'"
-            ) from None
+        return self.enable_option_at_index(self.get_option_index(option_id))
 
     def disable_option(self, option_id: str) -> Self:
         """Disable the option with the given ID.
@@ -739,12 +785,7 @@ def disable_option(self, option_id: str) -> Self:
         Raises:
             OptionDoesNotExist: If no option has the given ID.
         """
-        try:
-            return self.disable_option_at_index(self._option_ids[option_id])
-        except KeyError:
-            raise OptionDoesNotExist(
-                f"There is no option with an ID of '{option_id}'"
-            ) from None
+        return self.disable_option_at_index(self.get_option_index(option_id))
 
     @property
     def option_count(self) -> int:
@@ -761,7 +802,7 @@ def get_option_at_index(self, index: int) -> Option:
             The option at that index.
 
         Raises:
-            OptionDoesNotExist: If there is no option with the index.
+            OptionDoesNotExist: If there is no option with the given index.
         """
         try:
             return self._options[index]
@@ -779,11 +820,22 @@ def get_option(self, option_id: str) -> Option:
         Returns:
             The option with the ID.
 
+        Raises:
+            OptionDoesNotExist: If no option has the given ID.
+        """
+        return self.get_option_at_index(self.get_option_index(option_id))
+
+    def get_option_index(self, option_id):
+        """Get the index of the option with the given ID.
+
+        Args:
+            option_id: The ID of the option to get the index of.
+
         Raises:
             OptionDoesNotExist: If no option has the given ID.
         """
         try:
-            return self.get_option_at_index(self._option_ids[option_id])
+            return self._option_ids[option_id]
         except KeyError:
             raise OptionDoesNotExist(
                 f"There is no option with an ID of '{option_id}'"


Test patch:
diff --git a/tests/option_list/test_option_prompt_replacement.py b/tests/option_list/test_option_prompt_replacement.py
new file mode 100644
--- /dev/null
+++ b/tests/option_list/test_option_prompt_replacement.py
@@ -0,0 +1,72 @@
+"""Test replacing options prompt from an option list."""
+import pytest
+
+from textual.app import App, ComposeResult
+from textual.widgets import OptionList
+from textual.widgets.option_list import Option, OptionDoesNotExist
+
+
+class OptionListApp(App[None]):
+    """Test option list application."""
+
+    def compose(self) -> ComposeResult:
+        yield OptionList(
+            Option("0", id="0"),
+            Option("line1\nline2"),
+        )
+
+
+async def test_replace_option_prompt_with_invalid_id() -> None:
+    """Attempting to replace the prompt of an option ID that doesn't exist should raise an exception."""
+    async with OptionListApp().run_test() as pilot:
+        with pytest.raises(OptionDoesNotExist):
+            pilot.app.query_one(OptionList).replace_option_prompt("does-not-exist", "new-prompt")
+
+
+async def test_replace_option_prompt_with_invalid_index() -> None:
+    """Attempting to replace the prompt of an option index that doesn't exist should raise an exception."""
+    async with OptionListApp().run_test() as pilot:
+        with pytest.raises(OptionDoesNotExist):
+            pilot.app.query_one(OptionList).replace_option_prompt_at_index(23, "new-prompt")
+
+
+async def test_replace_option_prompt_with_valid_id() -> None:
+    """It should be possible to replace the prompt of an option ID that does exist."""
+    async with OptionListApp().run_test() as pilot:
+        option_list = pilot.app.query_one(OptionList)
+        option_list.replace_option_prompt("0", "new-prompt")
+        assert option_list.get_option("0").prompt == "new-prompt"
+
+
+async def test_replace_option_prompt_with_valid_index() -> None:
+    """It should be possible to replace the prompt of an option index that does exist."""
+    async with OptionListApp().run_test() as pilot:
+        option_list = pilot.app.query_one(OptionList).replace_option_prompt_at_index(1, "new-prompt")
+        assert option_list.get_option_at_index(1).prompt == "new-prompt"
+
+
+async def test_replace_single_line_option_prompt_with_multiple() -> None:
+    """It should be possible to replace single line prompt with multiple lines """
+    new_prompt = "new-prompt\nsecond line"
+    async with OptionListApp().run_test() as pilot:
+        option_list = pilot.app.query_one(OptionList)
+        option_list.replace_option_prompt("0", new_prompt)
+        assert option_list.get_option("0").prompt == new_prompt
+
+
+async def test_replace_multiple_line_option_prompt_with_single() -> None:
+    """It should be possible to replace multiple line prompt with a single line"""
+    new_prompt = "new-prompt"
+    async with OptionListApp().run_test() as pilot:
+        option_list = pilot.app.query_one(OptionList)
+        option_list.replace_option_prompt("0", new_prompt)
+        assert option_list.get_option("0").prompt == new_prompt
+
+
+async def test_replace_multiple_line_option_prompt_with_multiple() -> None:
+    """It should be possible to replace multiple line prompt with multiple lines"""
+    new_prompt = "new-prompt\nsecond line"
+    async with OptionListApp().run_test() as pilot:
+        option_list = pilot.app.query_one(OptionList)
+        option_list.replace_option_prompt_at_index(1, new_prompt)
+        assert option_list.get_option_at_index(1).prompt == new_prompt
diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr
--- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr
+++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr
@@ -20277,6 +20277,489 @@
   
   '''
 # ---
+# name: test_option_list_replace_prompt_from_single_line_to_single_line
+  '''
+  <svg class="rich-terminal" viewBox="0 0 994 635.5999999999999" xmlns="http://www.w3.org/2000/svg">
+      <!-- Generated with Rich https://www.textualize.io -->
+      <style>
+  
+      @font-face {
+          font-family: "Fira Code";
+          src: local("FiraCode-Regular"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Regular.woff2") format("woff2"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Regular.woff") format("woff");
+          font-style: normal;
+          font-weight: 400;
+      }
+      @font-face {
+          font-family: "Fira Code";
+          src: local("FiraCode-Bold"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Bold.woff2") format("woff2"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Bold.woff") format("woff");
+          font-style: bold;
+          font-weight: 700;
+      }
+  
+      .terminal-1891202557-matrix {
+          font-family: Fira Code, monospace;
+          font-size: 20px;
+          line-height: 24.4px;
+          font-variant-east-asian: full-width;
+      }
+  
+      .terminal-1891202557-title {
+          font-size: 18px;
+          font-weight: bold;
+          font-family: arial;
+      }
+  
+      .terminal-1891202557-r1 { fill: #c5c8c6 }
+  .terminal-1891202557-r2 { fill: #e3e3e3 }
+  .terminal-1891202557-r3 { fill: #1e1e1e }
+  .terminal-1891202557-r4 { fill: #0178d4 }
+  .terminal-1891202557-r5 { fill: #ddedf9;font-weight: bold }
+  .terminal-1891202557-r6 { fill: #e2e2e2 }
+  .terminal-1891202557-r7 { fill: #e1e1e1 }
+  .terminal-1891202557-r8 { fill: #ddedf9 }
+      </style>
+  
+      <defs>
+      <clipPath id="terminal-1891202557-clip-terminal">
+        <rect x="0" y="0" width="975.0" height="584.5999999999999" />
+      </clipPath>
+      <clipPath id="terminal-1891202557-line-0">
+      <rect x="0" y="1.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-1">
+      <rect x="0" y="25.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-2">
+      <rect x="0" y="50.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-3">
+      <rect x="0" y="74.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-4">
+      <rect x="0" y="99.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-5">
+      <rect x="0" y="123.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-6">
+      <rect x="0" y="147.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-7">
+      <rect x="0" y="172.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-8">
+      <rect x="0" y="196.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-9">
+      <rect x="0" y="221.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-10">
+      <rect x="0" y="245.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-11">
+      <rect x="0" y="269.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-12">
+      <rect x="0" y="294.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-13">
+      <rect x="0" y="318.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-14">
+      <rect x="0" y="343.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-15">
+      <rect x="0" y="367.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-16">
+      <rect x="0" y="391.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-17">
+      <rect x="0" y="416.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-18">
+      <rect x="0" y="440.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-19">
+      <rect x="0" y="465.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-20">
+      <rect x="0" y="489.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-21">
+      <rect x="0" y="513.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-1891202557-line-22">
+      <rect x="0" y="538.3" width="976" height="24.65"/>
+              </clipPath>
+      </defs>
+  
+      <rect fill="#292929" stroke="rgba(255,255,255,0.35)" stroke-width="1" x="1" y="1" width="992" height="633.6" rx="8"/><text class="terminal-1891202557-title" fill="#c5c8c6" text-anchor="middle" x="496" y="27">OptionListApp</text>
+              <g transform="translate(26,22)">
+              <circle cx="0" cy="0" r="7" fill="#ff5f57"/>
+              <circle cx="22" cy="0" r="7" fill="#febc2e"/>
+              <circle cx="44" cy="0" r="7" fill="#28c840"/>
+              </g>
+          
+      <g transform="translate(9, 41)" clip-path="url(#terminal-1891202557-clip-terminal)">
+      <rect fill="#282828" x="0" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="12.2" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="24.4" y="1.5" width="61" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="85.4" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="97.6" y="1.5" width="292.8" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="390.4" y="1.5" width="158.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="549" y="1.5" width="305" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="854" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="866.2" y="1.5" width="0" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="866.2" y="1.5" width="97.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="963.8" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="25.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="25.9" width="951.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="25.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="24.4" y="50.3" width="268.4" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="292.8" y="50.3" width="658.8" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="74.7" width="73.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="97.6" y="74.7" width="854" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="99.1" width="61" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="85.4" y="99.1" width="866.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="123.5" width="97.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="122" y="123.5" width="829.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="147.9" width="61" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="85.4" y="147.9" width="866.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="172.3" width="85.4" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="109.8" y="172.3" width="841.8" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="196.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="196.7" width="951.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="196.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="221.1" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="245.5" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="269.9" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="294.3" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="318.7" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="343.1" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="367.5" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="391.9" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="416.3" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="440.7" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="465.1" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="489.5" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="513.9" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="538.3" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="562.7" width="976" height="24.65" shape-rendering="crispEdges"/>
+      <g class="terminal-1891202557-matrix">
+      <text class="terminal-1891202557-r2" x="12.2" y="20" textLength="12.2" clip-path="url(#terminal-1891202557-line-0)">⭘</text><text class="terminal-1891202557-r2" x="390.4" y="20" textLength="158.6" clip-path="url(#terminal-1891202557-line-0)">OptionListApp</text><text class="terminal-1891202557-r1" x="976" y="20" textLength="12.2" clip-path="url(#terminal-1891202557-line-0)">
+  </text><text class="terminal-1891202557-r3" x="0" y="44.4" textLength="12.2" clip-path="url(#terminal-1891202557-line-1)">▊</text><text class="terminal-1891202557-r4" x="12.2" y="44.4" textLength="951.6" clip-path="url(#terminal-1891202557-line-1)">▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔</text><text class="terminal-1891202557-r4" x="963.8" y="44.4" textLength="12.2" clip-path="url(#terminal-1891202557-line-1)">▎</text><text class="terminal-1891202557-r1" x="976" y="44.4" textLength="12.2" clip-path="url(#terminal-1891202557-line-1)">
+  </text><text class="terminal-1891202557-r3" x="0" y="68.8" textLength="12.2" clip-path="url(#terminal-1891202557-line-2)">▊</text><text class="terminal-1891202557-r5" x="24.4" y="68.8" textLength="268.4" clip-path="url(#terminal-1891202557-line-2)">1.&#160;Another&#160;single&#160;line</text><text class="terminal-1891202557-r4" x="963.8" y="68.8" textLength="12.2" clip-path="url(#terminal-1891202557-line-2)">▎</text><text class="terminal-1891202557-r1" x="976" y="68.8" textLength="12.2" clip-path="url(#terminal-1891202557-line-2)">
+  </text><text class="terminal-1891202557-r3" x="0" y="93.2" textLength="12.2" clip-path="url(#terminal-1891202557-line-3)">▊</text><text class="terminal-1891202557-r6" x="24.4" y="93.2" textLength="73.2" clip-path="url(#terminal-1891202557-line-3)">2.&#160;Two</text><text class="terminal-1891202557-r4" x="963.8" y="93.2" textLength="12.2" clip-path="url(#terminal-1891202557-line-3)">▎</text><text class="terminal-1891202557-r1" x="976" y="93.2" textLength="12.2" clip-path="url(#terminal-1891202557-line-3)">
+  </text><text class="terminal-1891202557-r3" x="0" y="117.6" textLength="12.2" clip-path="url(#terminal-1891202557-line-4)">▊</text><text class="terminal-1891202557-r6" x="24.4" y="117.6" textLength="61" clip-path="url(#terminal-1891202557-line-4)">lines</text><text class="terminal-1891202557-r4" x="963.8" y="117.6" textLength="12.2" clip-path="url(#terminal-1891202557-line-4)">▎</text><text class="terminal-1891202557-r1" x="976" y="117.6" textLength="12.2" clip-path="url(#terminal-1891202557-line-4)">
+  </text><text class="terminal-1891202557-r3" x="0" y="142" textLength="12.2" clip-path="url(#terminal-1891202557-line-5)">▊</text><text class="terminal-1891202557-r6" x="24.4" y="142" textLength="97.6" clip-path="url(#terminal-1891202557-line-5)">3.&#160;Three</text><text class="terminal-1891202557-r4" x="963.8" y="142" textLength="12.2" clip-path="url(#terminal-1891202557-line-5)">▎</text><text class="terminal-1891202557-r1" x="976" y="142" textLength="12.2" clip-path="url(#terminal-1891202557-line-5)">
+  </text><text class="terminal-1891202557-r3" x="0" y="166.4" textLength="12.2" clip-path="url(#terminal-1891202557-line-6)">▊</text><text class="terminal-1891202557-r6" x="24.4" y="166.4" textLength="61" clip-path="url(#terminal-1891202557-line-6)">lines</text><text class="terminal-1891202557-r4" x="963.8" y="166.4" textLength="12.2" clip-path="url(#terminal-1891202557-line-6)">▎</text><text class="terminal-1891202557-r1" x="976" y="166.4" textLength="12.2" clip-path="url(#terminal-1891202557-line-6)">
+  </text><text class="terminal-1891202557-r3" x="0" y="190.8" textLength="12.2" clip-path="url(#terminal-1891202557-line-7)">▊</text><text class="terminal-1891202557-r6" x="24.4" y="190.8" textLength="85.4" clip-path="url(#terminal-1891202557-line-7)">of&#160;text</text><text class="terminal-1891202557-r4" x="963.8" y="190.8" textLength="12.2" clip-path="url(#terminal-1891202557-line-7)">▎</text><text class="terminal-1891202557-r1" x="976" y="190.8" textLength="12.2" clip-path="url(#terminal-1891202557-line-7)">
+  </text><text class="terminal-1891202557-r3" x="0" y="215.2" textLength="12.2" clip-path="url(#terminal-1891202557-line-8)">▊</text><text class="terminal-1891202557-r4" x="12.2" y="215.2" textLength="951.6" clip-path="url(#terminal-1891202557-line-8)">▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁</text><text class="terminal-1891202557-r4" x="963.8" y="215.2" textLength="12.2" clip-path="url(#terminal-1891202557-line-8)">▎</text><text class="terminal-1891202557-r1" x="976" y="215.2" textLength="12.2" clip-path="url(#terminal-1891202557-line-8)">
+  </text><text class="terminal-1891202557-r1" x="976" y="239.6" textLength="12.2" clip-path="url(#terminal-1891202557-line-9)">
+  </text><text class="terminal-1891202557-r1" x="976" y="264" textLength="12.2" clip-path="url(#terminal-1891202557-line-10)">
+  </text><text class="terminal-1891202557-r1" x="976" y="288.4" textLength="12.2" clip-path="url(#terminal-1891202557-line-11)">
+  </text><text class="terminal-1891202557-r1" x="976" y="312.8" textLength="12.2" clip-path="url(#terminal-1891202557-line-12)">
+  </text><text class="terminal-1891202557-r1" x="976" y="337.2" textLength="12.2" clip-path="url(#terminal-1891202557-line-13)">
+  </text><text class="terminal-1891202557-r1" x="976" y="361.6" textLength="12.2" clip-path="url(#terminal-1891202557-line-14)">
+  </text><text class="terminal-1891202557-r1" x="976" y="386" textLength="12.2" clip-path="url(#terminal-1891202557-line-15)">
+  </text><text class="terminal-1891202557-r1" x="976" y="410.4" textLength="12.2" clip-path="url(#terminal-1891202557-line-16)">
+  </text><text class="terminal-1891202557-r1" x="976" y="434.8" textLength="12.2" clip-path="url(#terminal-1891202557-line-17)">
+  </text><text class="terminal-1891202557-r1" x="976" y="459.2" textLength="12.2" clip-path="url(#terminal-1891202557-line-18)">
+  </text><text class="terminal-1891202557-r1" x="976" y="483.6" textLength="12.2" clip-path="url(#terminal-1891202557-line-19)">
+  </text><text class="terminal-1891202557-r1" x="976" y="508" textLength="12.2" clip-path="url(#terminal-1891202557-line-20)">
+  </text><text class="terminal-1891202557-r1" x="976" y="532.4" textLength="12.2" clip-path="url(#terminal-1891202557-line-21)">
+  </text><text class="terminal-1891202557-r1" x="976" y="556.8" textLength="12.2" clip-path="url(#terminal-1891202557-line-22)">
+  </text>
+      </g>
+      </g>
+  </svg>
+  
+  '''
+# ---
+# name: test_option_list_replace_prompt_from_single_line_to_two_lines
+  '''
+  <svg class="rich-terminal" viewBox="0 0 994 635.5999999999999" xmlns="http://www.w3.org/2000/svg">
+      <!-- Generated with Rich https://www.textualize.io -->
+      <style>
+  
+      @font-face {
+          font-family: "Fira Code";
+          src: local("FiraCode-Regular"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Regular.woff2") format("woff2"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Regular.woff") format("woff");
+          font-style: normal;
+          font-weight: 400;
+      }
+      @font-face {
+          font-family: "Fira Code";
+          src: local("FiraCode-Bold"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Bold.woff2") format("woff2"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Bold.woff") format("woff");
+          font-style: bold;
+          font-weight: 700;
+      }
+  
+      .terminal-2188746417-matrix {
+          font-family: Fira Code, monospace;
+          font-size: 20px;
+          line-height: 24.4px;
+          font-variant-east-asian: full-width;
+      }
+  
+      .terminal-2188746417-title {
+          font-size: 18px;
+          font-weight: bold;
+          font-family: arial;
+      }
+  
+      .terminal-2188746417-r1 { fill: #c5c8c6 }
+  .terminal-2188746417-r2 { fill: #e3e3e3 }
+  .terminal-2188746417-r3 { fill: #1e1e1e }
+  .terminal-2188746417-r4 { fill: #0178d4 }
+  .terminal-2188746417-r5 { fill: #ddedf9;font-weight: bold }
+  .terminal-2188746417-r6 { fill: #e2e2e2 }
+  .terminal-2188746417-r7 { fill: #e1e1e1 }
+  .terminal-2188746417-r8 { fill: #ddedf9 }
+      </style>
+  
+      <defs>
+      <clipPath id="terminal-2188746417-clip-terminal">
+        <rect x="0" y="0" width="975.0" height="584.5999999999999" />
+      </clipPath>
+      <clipPath id="terminal-2188746417-line-0">
+      <rect x="0" y="1.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-1">
+      <rect x="0" y="25.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-2">
+      <rect x="0" y="50.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-3">
+      <rect x="0" y="74.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-4">
+      <rect x="0" y="99.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-5">
+      <rect x="0" y="123.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-6">
+      <rect x="0" y="147.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-7">
+      <rect x="0" y="172.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-8">
+      <rect x="0" y="196.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-9">
+      <rect x="0" y="221.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-10">
+      <rect x="0" y="245.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-11">
+      <rect x="0" y="269.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-12">
+      <rect x="0" y="294.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-13">
+      <rect x="0" y="318.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-14">
+      <rect x="0" y="343.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-15">
+      <rect x="0" y="367.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-16">
+      <rect x="0" y="391.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-17">
+      <rect x="0" y="416.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-18">
+      <rect x="0" y="440.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-19">
+      <rect x="0" y="465.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-20">
+      <rect x="0" y="489.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-21">
+      <rect x="0" y="513.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2188746417-line-22">
+      <rect x="0" y="538.3" width="976" height="24.65"/>
+              </clipPath>
+      </defs>
+  
+      <rect fill="#292929" stroke="rgba(255,255,255,0.35)" stroke-width="1" x="1" y="1" width="992" height="633.6" rx="8"/><text class="terminal-2188746417-title" fill="#c5c8c6" text-anchor="middle" x="496" y="27">OptionListApp</text>
+              <g transform="translate(26,22)">
+              <circle cx="0" cy="0" r="7" fill="#ff5f57"/>
+              <circle cx="22" cy="0" r="7" fill="#febc2e"/>
+              <circle cx="44" cy="0" r="7" fill="#28c840"/>
+              </g>
+          
+      <g transform="translate(9, 41)" clip-path="url(#terminal-2188746417-clip-terminal)">
+      <rect fill="#282828" x="0" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="12.2" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="24.4" y="1.5" width="61" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="85.4" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="97.6" y="1.5" width="292.8" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="390.4" y="1.5" width="158.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="549" y="1.5" width="305" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="854" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="866.2" y="1.5" width="0" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="866.2" y="1.5" width="97.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="963.8" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="25.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="25.9" width="951.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="25.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="24.4" y="50.3" width="73.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="97.6" y="50.3" width="854" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="24.4" y="74.7" width="61" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="85.4" y="74.7" width="866.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="99.1" width="73.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="97.6" y="99.1" width="854" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="123.5" width="61" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="85.4" y="123.5" width="866.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="147.9" width="97.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="122" y="147.9" width="829.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="172.3" width="61" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="85.4" y="172.3" width="866.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="196.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="196.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="196.7" width="85.4" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="109.8" y="196.7" width="841.8" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="196.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="196.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="221.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="221.1" width="951.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="221.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="245.5" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="269.9" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="294.3" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="318.7" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="343.1" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="367.5" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="391.9" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="416.3" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="440.7" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="465.1" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="489.5" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="513.9" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="538.3" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="562.7" width="976" height="24.65" shape-rendering="crispEdges"/>
+      <g class="terminal-2188746417-matrix">
+      <text class="terminal-2188746417-r2" x="12.2" y="20" textLength="12.2" clip-path="url(#terminal-2188746417-line-0)">⭘</text><text class="terminal-2188746417-r2" x="390.4" y="20" textLength="158.6" clip-path="url(#terminal-2188746417-line-0)">OptionListApp</text><text class="terminal-2188746417-r1" x="976" y="20" textLength="12.2" clip-path="url(#terminal-2188746417-line-0)">
+  </text><text class="terminal-2188746417-r3" x="0" y="44.4" textLength="12.2" clip-path="url(#terminal-2188746417-line-1)">▊</text><text class="terminal-2188746417-r4" x="12.2" y="44.4" textLength="951.6" clip-path="url(#terminal-2188746417-line-1)">▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔</text><text class="terminal-2188746417-r4" x="963.8" y="44.4" textLength="12.2" clip-path="url(#terminal-2188746417-line-1)">▎</text><text class="terminal-2188746417-r1" x="976" y="44.4" textLength="12.2" clip-path="url(#terminal-2188746417-line-1)">
+  </text><text class="terminal-2188746417-r3" x="0" y="68.8" textLength="12.2" clip-path="url(#terminal-2188746417-line-2)">▊</text><text class="terminal-2188746417-r5" x="24.4" y="68.8" textLength="73.2" clip-path="url(#terminal-2188746417-line-2)">1.&#160;Two</text><text class="terminal-2188746417-r4" x="963.8" y="68.8" textLength="12.2" clip-path="url(#terminal-2188746417-line-2)">▎</text><text class="terminal-2188746417-r1" x="976" y="68.8" textLength="12.2" clip-path="url(#terminal-2188746417-line-2)">
+  </text><text class="terminal-2188746417-r3" x="0" y="93.2" textLength="12.2" clip-path="url(#terminal-2188746417-line-3)">▊</text><text class="terminal-2188746417-r5" x="24.4" y="93.2" textLength="61" clip-path="url(#terminal-2188746417-line-3)">lines</text><text class="terminal-2188746417-r4" x="963.8" y="93.2" textLength="12.2" clip-path="url(#terminal-2188746417-line-3)">▎</text><text class="terminal-2188746417-r1" x="976" y="93.2" textLength="12.2" clip-path="url(#terminal-2188746417-line-3)">
+  </text><text class="terminal-2188746417-r3" x="0" y="117.6" textLength="12.2" clip-path="url(#terminal-2188746417-line-4)">▊</text><text class="terminal-2188746417-r6" x="24.4" y="117.6" textLength="73.2" clip-path="url(#terminal-2188746417-line-4)">2.&#160;Two</text><text class="terminal-2188746417-r4" x="963.8" y="117.6" textLength="12.2" clip-path="url(#terminal-2188746417-line-4)">▎</text><text class="terminal-2188746417-r1" x="976" y="117.6" textLength="12.2" clip-path="url(#terminal-2188746417-line-4)">
+  </text><text class="terminal-2188746417-r3" x="0" y="142" textLength="12.2" clip-path="url(#terminal-2188746417-line-5)">▊</text><text class="terminal-2188746417-r6" x="24.4" y="142" textLength="61" clip-path="url(#terminal-2188746417-line-5)">lines</text><text class="terminal-2188746417-r4" x="963.8" y="142" textLength="12.2" clip-path="url(#terminal-2188746417-line-5)">▎</text><text class="terminal-2188746417-r1" x="976" y="142" textLength="12.2" clip-path="url(#terminal-2188746417-line-5)">
+  </text><text class="terminal-2188746417-r3" x="0" y="166.4" textLength="12.2" clip-path="url(#terminal-2188746417-line-6)">▊</text><text class="terminal-2188746417-r6" x="24.4" y="166.4" textLength="97.6" clip-path="url(#terminal-2188746417-line-6)">3.&#160;Three</text><text class="terminal-2188746417-r4" x="963.8" y="166.4" textLength="12.2" clip-path="url(#terminal-2188746417-line-6)">▎</text><text class="terminal-2188746417-r1" x="976" y="166.4" textLength="12.2" clip-path="url(#terminal-2188746417-line-6)">
+  </text><text class="terminal-2188746417-r3" x="0" y="190.8" textLength="12.2" clip-path="url(#terminal-2188746417-line-7)">▊</text><text class="terminal-2188746417-r6" x="24.4" y="190.8" textLength="61" clip-path="url(#terminal-2188746417-line-7)">lines</text><text class="terminal-2188746417-r4" x="963.8" y="190.8" textLength="12.2" clip-path="url(#terminal-2188746417-line-7)">▎</text><text class="terminal-2188746417-r1" x="976" y="190.8" textLength="12.2" clip-path="url(#terminal-2188746417-line-7)">
+  </text><text class="terminal-2188746417-r3" x="0" y="215.2" textLength="12.2" clip-path="url(#terminal-2188746417-line-8)">▊</text><text class="terminal-2188746417-r6" x="24.4" y="215.2" textLength="85.4" clip-path="url(#terminal-2188746417-line-8)">of&#160;text</text><text class="terminal-2188746417-r4" x="963.8" y="215.2" textLength="12.2" clip-path="url(#terminal-2188746417-line-8)">▎</text><text class="terminal-2188746417-r1" x="976" y="215.2" textLength="12.2" clip-path="url(#terminal-2188746417-line-8)">
+  </text><text class="terminal-2188746417-r3" x="0" y="239.6" textLength="12.2" clip-path="url(#terminal-2188746417-line-9)">▊</text><text class="terminal-2188746417-r4" x="12.2" y="239.6" textLength="951.6" clip-path="url(#terminal-2188746417-line-9)">▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁</text><text class="terminal-2188746417-r4" x="963.8" y="239.6" textLength="12.2" clip-path="url(#terminal-2188746417-line-9)">▎</text><text class="terminal-2188746417-r1" x="976" y="239.6" textLength="12.2" clip-path="url(#terminal-2188746417-line-9)">
+  </text><text class="terminal-2188746417-r1" x="976" y="264" textLength="12.2" clip-path="url(#terminal-2188746417-line-10)">
+  </text><text class="terminal-2188746417-r1" x="976" y="288.4" textLength="12.2" clip-path="url(#terminal-2188746417-line-11)">
+  </text><text class="terminal-2188746417-r1" x="976" y="312.8" textLength="12.2" clip-path="url(#terminal-2188746417-line-12)">
+  </text><text class="terminal-2188746417-r1" x="976" y="337.2" textLength="12.2" clip-path="url(#terminal-2188746417-line-13)">
+  </text><text class="terminal-2188746417-r1" x="976" y="361.6" textLength="12.2" clip-path="url(#terminal-2188746417-line-14)">
+  </text><text class="terminal-2188746417-r1" x="976" y="386" textLength="12.2" clip-path="url(#terminal-2188746417-line-15)">
+  </text><text class="terminal-2188746417-r1" x="976" y="410.4" textLength="12.2" clip-path="url(#terminal-2188746417-line-16)">
+  </text><text class="terminal-2188746417-r1" x="976" y="434.8" textLength="12.2" clip-path="url(#terminal-2188746417-line-17)">
+  </text><text class="terminal-2188746417-r1" x="976" y="459.2" textLength="12.2" clip-path="url(#terminal-2188746417-line-18)">
+  </text><text class="terminal-2188746417-r1" x="976" y="483.6" textLength="12.2" clip-path="url(#terminal-2188746417-line-19)">
+  </text><text class="terminal-2188746417-r1" x="976" y="508" textLength="12.2" clip-path="url(#terminal-2188746417-line-20)">
+  </text><text class="terminal-2188746417-r1" x="976" y="532.4" textLength="12.2" clip-path="url(#terminal-2188746417-line-21)">
+  </text><text class="terminal-2188746417-r1" x="976" y="556.8" textLength="12.2" clip-path="url(#terminal-2188746417-line-22)">
+  </text>
+      </g>
+      </g>
+  </svg>
+  
+  '''
+# ---
+# name: test_option_list_replace_prompt_from_two_lines_to_three_lines
+  '''
+  <svg class="rich-terminal" viewBox="0 0 994 635.5999999999999" xmlns="http://www.w3.org/2000/svg">
+      <!-- Generated with Rich https://www.textualize.io -->
+      <style>
+  
+      @font-face {
+          font-family: "Fira Code";
+          src: local("FiraCode-Regular"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Regular.woff2") format("woff2"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Regular.woff") format("woff");
+          font-style: normal;
+          font-weight: 400;
+      }
+      @font-face {
+          font-family: "Fira Code";
+          src: local("FiraCode-Bold"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff2/FiraCode-Bold.woff2") format("woff2"),
+                  url("https://cdnjs.cloudflare.com/ajax/libs/firacode/6.2.0/woff/FiraCode-Bold.woff") format("woff");
+          font-style: bold;
+          font-weight: 700;
+      }
+  
+      .terminal-2667681921-matrix {
+          font-family: Fira Code, monospace;
+          font-size: 20px;
+          line-height: 24.4px;
+          font-variant-east-asian: full-width;
+      }
+  
+      .terminal-2667681921-title {
+          font-size: 18px;
+          font-weight: bold;
+          font-family: arial;
+      }
+  
+      .terminal-2667681921-r1 { fill: #c5c8c6 }
+  .terminal-2667681921-r2 { fill: #e3e3e3 }
+  .terminal-2667681921-r3 { fill: #1e1e1e }
+  .terminal-2667681921-r4 { fill: #0178d4 }
+  .terminal-2667681921-r5 { fill: #ddedf9;font-weight: bold }
+  .terminal-2667681921-r6 { fill: #e2e2e2 }
+  .terminal-2667681921-r7 { fill: #e1e1e1 }
+  .terminal-2667681921-r8 { fill: #ddedf9 }
+      </style>
+  
+      <defs>
+      <clipPath id="terminal-2667681921-clip-terminal">
+        <rect x="0" y="0" width="975.0" height="584.5999999999999" />
+      </clipPath>
+      <clipPath id="terminal-2667681921-line-0">
+      <rect x="0" y="1.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-1">
+      <rect x="0" y="25.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-2">
+      <rect x="0" y="50.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-3">
+      <rect x="0" y="74.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-4">
+      <rect x="0" y="99.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-5">
+      <rect x="0" y="123.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-6">
+      <rect x="0" y="147.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-7">
+      <rect x="0" y="172.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-8">
+      <rect x="0" y="196.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-9">
+      <rect x="0" y="221.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-10">
+      <rect x="0" y="245.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-11">
+      <rect x="0" y="269.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-12">
+      <rect x="0" y="294.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-13">
+      <rect x="0" y="318.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-14">
+      <rect x="0" y="343.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-15">
+      <rect x="0" y="367.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-16">
+      <rect x="0" y="391.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-17">
+      <rect x="0" y="416.3" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-18">
+      <rect x="0" y="440.7" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-19">
+      <rect x="0" y="465.1" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-20">
+      <rect x="0" y="489.5" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-21">
+      <rect x="0" y="513.9" width="976" height="24.65"/>
+              </clipPath>
+  <clipPath id="terminal-2667681921-line-22">
+      <rect x="0" y="538.3" width="976" height="24.65"/>
+              </clipPath>
+      </defs>
+  
+      <rect fill="#292929" stroke="rgba(255,255,255,0.35)" stroke-width="1" x="1" y="1" width="992" height="633.6" rx="8"/><text class="terminal-2667681921-title" fill="#c5c8c6" text-anchor="middle" x="496" y="27">OptionListApp</text>
+              <g transform="translate(26,22)">
+              <circle cx="0" cy="0" r="7" fill="#ff5f57"/>
+              <circle cx="22" cy="0" r="7" fill="#febc2e"/>
+              <circle cx="44" cy="0" r="7" fill="#28c840"/>
+              </g>
+          
+      <g transform="translate(9, 41)" clip-path="url(#terminal-2667681921-clip-terminal)">
+      <rect fill="#282828" x="0" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="12.2" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="24.4" y="1.5" width="61" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="85.4" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="97.6" y="1.5" width="292.8" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="390.4" y="1.5" width="158.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="549" y="1.5" width="305" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="854" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="866.2" y="1.5" width="0" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="866.2" y="1.5" width="97.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#282828" x="963.8" y="1.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="25.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="25.9" width="951.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="25.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="24.4" y="50.3" width="170.8" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="195.2" y="50.3" width="756.4" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="50.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="74.7" width="97.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="122" y="74.7" width="829.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="74.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="99.1" width="61" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="85.4" y="99.1" width="866.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="99.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="123.5" width="85.4" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="109.8" y="123.5" width="841.8" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="123.5" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="147.9" width="97.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="122" y="147.9" width="829.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="147.9" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="172.3" width="61" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="85.4" y="172.3" width="866.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="172.3" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="196.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="196.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="24.4" y="196.7" width="85.4" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="109.8" y="196.7" width="841.8" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="951.6" y="196.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="196.7" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="221.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#262626" x="12.2" y="221.1" width="951.6" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="963.8" y="221.1" width="12.2" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="245.5" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="269.9" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="294.3" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="318.7" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="343.1" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="367.5" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="391.9" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="416.3" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="440.7" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="465.1" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="489.5" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="513.9" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#1e1e1e" x="0" y="538.3" width="976" height="24.65" shape-rendering="crispEdges"/><rect fill="#0178d4" x="0" y="562.7" width="976" height="24.65" shape-rendering="crispEdges"/>
+      <g class="terminal-2667681921-matrix">
+      <text class="terminal-2667681921-r2" x="12.2" y="20" textLength="12.2" clip-path="url(#terminal-2667681921-line-0)">⭘</text><text class="terminal-2667681921-r2" x="390.4" y="20" textLength="158.6" clip-path="url(#terminal-2667681921-line-0)">OptionListApp</text><text class="terminal-2667681921-r1" x="976" y="20" textLength="12.2" clip-path="url(#terminal-2667681921-line-0)">
+  </text><text class="terminal-2667681921-r3" x="0" y="44.4" textLength="12.2" clip-path="url(#terminal-2667681921-line-1)">▊</text><text class="terminal-2667681921-r4" x="12.2" y="44.4" textLength="951.6" clip-path="url(#terminal-2667681921-line-1)">▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔</text><text class="terminal-2667681921-r4" x="963.8" y="44.4" textLength="12.2" clip-path="url(#terminal-2667681921-line-1)">▎</text><text class="terminal-2667681921-r1" x="976" y="44.4" textLength="12.2" clip-path="url(#terminal-2667681921-line-1)">
+  </text><text class="terminal-2667681921-r3" x="0" y="68.8" textLength="12.2" clip-path="url(#terminal-2667681921-line-2)">▊</text><text class="terminal-2667681921-r5" x="24.4" y="68.8" textLength="170.8" clip-path="url(#terminal-2667681921-line-2)">1.&#160;Single&#160;line</text><text class="terminal-2667681921-r4" x="963.8" y="68.8" textLength="12.2" clip-path="url(#terminal-2667681921-line-2)">▎</text><text class="terminal-2667681921-r1" x="976" y="68.8" textLength="12.2" clip-path="url(#terminal-2667681921-line-2)">
+  </text><text class="terminal-2667681921-r3" x="0" y="93.2" textLength="12.2" clip-path="url(#terminal-2667681921-line-3)">▊</text><text class="terminal-2667681921-r6" x="24.4" y="93.2" textLength="97.6" clip-path="url(#terminal-2667681921-line-3)">1.&#160;Three</text><text class="terminal-2667681921-r4" x="963.8" y="93.2" textLength="12.2" clip-path="url(#terminal-2667681921-line-3)">▎</text><text class="terminal-2667681921-r1" x="976" y="93.2" textLength="12.2" clip-path="url(#terminal-2667681921-line-3)">
+  </text><text class="terminal-2667681921-r3" x="0" y="117.6" textLength="12.2" clip-path="url(#terminal-2667681921-line-4)">▊</text><text class="terminal-2667681921-r6" x="24.4" y="117.6" textLength="61" clip-path="url(#terminal-2667681921-line-4)">lines</text><text class="terminal-2667681921-r4" x="963.8" y="117.6" textLength="12.2" clip-path="url(#terminal-2667681921-line-4)">▎</text><text class="terminal-2667681921-r1" x="976" y="117.6" textLength="12.2" clip-path="url(#terminal-2667681921-line-4)">
+  </text><text class="terminal-2667681921-r3" x="0" y="142" textLength="12.2" clip-path="url(#terminal-2667681921-line-5)">▊</text><text class="terminal-2667681921-r6" x="24.4" y="142" textLength="85.4" clip-path="url(#terminal-2667681921-line-5)">of&#160;text</text><text class="terminal-2667681921-r4" x="963.8" y="142" textLength="12.2" clip-path="url(#terminal-2667681921-line-5)">▎</text><text class="terminal-2667681921-r1" x="976" y="142" textLength="12.2" clip-path="url(#terminal-2667681921-line-5)">
+  </text><text class="terminal-2667681921-r3" x="0" y="166.4" textLength="12.2" clip-path="url(#terminal-2667681921-line-6)">▊</text><text class="terminal-2667681921-r6" x="24.4" y="166.4" textLength="97.6" clip-path="url(#terminal-2667681921-line-6)">3.&#160;Three</text><text class="terminal-2667681921-r4" x="963.8" y="166.4" textLength="12.2" clip-path="url(#terminal-2667681921-line-6)">▎</text><text class="terminal-2667681921-r1" x="976" y="166.4" textLength="12.2" clip-path="url(#terminal-2667681921-line-6)">
+  </text><text class="terminal-2667681921-r3" x="0" y="190.8" textLength="12.2" clip-path="url(#terminal-2667681921-line-7)">▊</text><text class="terminal-2667681921-r6" x="24.4" y="190.8" textLength="61" clip-path="url(#terminal-2667681921-line-7)">lines</text><text class="terminal-2667681921-r4" x="963.8" y="190.8" textLength="12.2" clip-path="url(#terminal-2667681921-line-7)">▎</text><text class="terminal-2667681921-r1" x="976" y="190.8" textLength="12.2" clip-path="url(#terminal-2667681921-line-7)">
+  </text><text class="terminal-2667681921-r3" x="0" y="215.2" textLength="12.2" clip-path="url(#terminal-2667681921-line-8)">▊</text><text class="terminal-2667681921-r6" x="24.4" y="215.2" textLength="85.4" clip-path="url(#terminal-2667681921-line-8)">of&#160;text</text><text class="terminal-2667681921-r4" x="963.8" y="215.2" textLength="12.2" clip-path="url(#terminal-2667681921-line-8)">▎</text><text class="terminal-2667681921-r1" x="976" y="215.2" textLength="12.2" clip-path="url(#terminal-2667681921-line-8)">
+  </text><text class="terminal-2667681921-r3" x="0" y="239.6" textLength="12.2" clip-path="url(#terminal-2667681921-line-9)">▊</text><text class="terminal-2667681921-r4" x="12.2" y="239.6" textLength="951.6" clip-path="url(#terminal-2667681921-line-9)">▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁</text><text class="terminal-2667681921-r4" x="963.8" y="239.6" textLength="12.2" clip-path="url(#terminal-2667681921-line-9)">▎</text><text class="terminal-2667681921-r1" x="976" y="239.6" textLength="12.2" clip-path="url(#terminal-2667681921-line-9)">
+  </text><text class="terminal-2667681921-r1" x="976" y="264" textLength="12.2" clip-path="url(#terminal-2667681921-line-10)">
+  </text><text class="terminal-2667681921-r1" x="976" y="288.4" textLength="12.2" clip-path="url(#terminal-2667681921-line-11)">
+  </text><text class="terminal-2667681921-r1" x="976" y="312.8" textLength="12.2" clip-path="url(#terminal-2667681921-line-12)">
+  </text><text class="terminal-2667681921-r1" x="976" y="337.2" textLength="12.2" clip-path="url(#terminal-2667681921-line-13)">
+  </text><text class="terminal-2667681921-r1" x="976" y="361.6" textLength="12.2" clip-path="url(#terminal-2667681921-line-14)">
+  </text><text class="terminal-2667681921-r1" x="976" y="386" textLength="12.2" clip-path="url(#terminal-2667681921-line-15)">
+  </text><text class="terminal-2667681921-r1" x="976" y="410.4" textLength="12.2" clip-path="url(#terminal-2667681921-line-16)">
+  </text><text class="terminal-2667681921-r1" x="976" y="434.8" textLength="12.2" clip-path="url(#terminal-2667681921-line-17)">
+  </text><text class="terminal-2667681921-r1" x="976" y="459.2" textLength="12.2" clip-path="url(#terminal-2667681921-line-18)">
+  </text><text class="terminal-2667681921-r1" x="976" y="483.6" textLength="12.2" clip-path="url(#terminal-2667681921-line-19)">
+  </text><text class="terminal-2667681921-r1" x="976" y="508" textLength="12.2" clip-path="url(#terminal-2667681921-line-20)">
+  </text><text class="terminal-2667681921-r1" x="976" y="532.4" textLength="12.2" clip-path="url(#terminal-2667681921-line-21)">
+  </text><text class="terminal-2667681921-r1" x="976" y="556.8" textLength="12.2" clip-path="url(#terminal-2667681921-line-22)">
+  </text>
+      </g>
+      </g>
+  </svg>
+  
+  '''
+# ---
 # name: test_option_list_strings
   '''
   <svg class="rich-terminal" viewBox="0 0 994 635.5999999999999" xmlns="http://www.w3.org/2000/svg">
diff --git a/tests/snapshot_tests/snapshot_apps/option_list_multiline_options.py b/tests/snapshot_tests/snapshot_apps/option_list_multiline_options.py
new file mode 100644
--- /dev/null
+++ b/tests/snapshot_tests/snapshot_apps/option_list_multiline_options.py
@@ -0,0 +1,32 @@
+from __future__ import annotations
+
+
+from textual.app import App, ComposeResult
+from textual.widgets import OptionList, Header, Footer
+from textual.widgets.option_list import Option
+
+
+class OptionListApp(App[None]):
+
+    def compose(self) -> ComposeResult:
+        yield Header()
+        yield OptionList(
+            Option("1. Single line", id="one"),
+            Option("2. Two\nlines", id="two"),
+            Option("3. Three\nlines\nof text", id="three"),
+        )
+
+        yield Footer()
+
+    def key_1(self):
+        self.query_one(OptionList).replace_option_prompt_at_index(0, "1. Another single line")
+
+    def key_2(self):
+        self.query_one(OptionList).replace_option_prompt_at_index(0, "1. Two\nlines")
+
+    def key_3(self):
+        self.query_one(OptionList).replace_option_prompt_at_index(1, "1. Three\nlines\nof text")
+
+
+if __name__ == "__main__":
+    OptionListApp().run()
diff --git a/tests/snapshot_tests/test_snapshots.py b/tests/snapshot_tests/test_snapshots.py
--- a/tests/snapshot_tests/test_snapshots.py
+++ b/tests/snapshot_tests/test_snapshots.py
@@ -238,6 +238,18 @@ def test_option_list_build(snap_compare):
     assert snap_compare(SNAPSHOT_APPS_DIR / "option_list.py")
 
 
+def test_option_list_replace_prompt_from_single_line_to_single_line(snap_compare):
+    assert snap_compare(SNAPSHOT_APPS_DIR / "option_list_multiline_options.py", press=["1"])
+
+
+def test_option_list_replace_prompt_from_single_line_to_two_lines(snap_compare):
+    assert snap_compare(SNAPSHOT_APPS_DIR / "option_list_multiline_options.py", press=["2"])
+
+
+def test_option_list_replace_prompt_from_two_lines_to_three_lines(snap_compare):
+    assert snap_compare(SNAPSHOT_APPS_DIR / "option_list_multiline_options.py", press=["3"])
+
+
 def test_progress_bar_indeterminate(snap_compare):
     assert snap_compare(WIDGET_EXAMPLES_DIR / "progress_bar_isolated_.py", press=["f"])