prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Slider value visually overlaps with the edge of the sidebar
  # Summary
  
  The value label collides with the edges of the sidebar. It should change alignment when it gets close to the edges. 
  
  # Steps to reproduce
  
  ```py
  min_weight = st.sidebar.slider("Minimum weight", 2500, 6500)
  ```
  
  ## Expected behavior:
  
  The value label should not collide with the edges. 
  
  ## Actual behavior:
  
  <img width="382" alt="Screen Shot 2020-09-30 at 22 42 44" src="https://user-images.githubusercontent.com/589034/94772484-97067200-036e-11eb-9f82-10453aa7452e.png">
  
  
  ## Is this a regression?
  
  no
  
  # Debug info
  
  - Streamlit version: 0.65.2
  - Browser version: Chrome
  
  
  </issue>
  <code>
  [start of e2e/scripts/st_slider.py]
  1 # Copyright 2018-2021 Streamlit Inc.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #    http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 import streamlit as st
  16 
  17 w1 = st.slider("Label 1", 0, 100, 25, 1)
  18 st.write("Value 1:", w1)
  19 
  20 w2 = st.slider("Label 2", 0.0, 100.0, (25.0, 75.0), 0.5)
  21 st.write("Value 2:", w2)
  22 
  23 w3 = st.slider(
  24     "Label 3 - This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long label",
  25     0,
  26     100,
  27     1,
  28     1,
  29 )
  30 st.write("Value 3:", w3)
  31 
  32 if st._is_running_with_streamlit:
  33 
  34     def on_change():
  35         st.session_state.slider_changed = True
  36 
  37     st.slider(
  38         "Label 4",
  39         min_value=0,
  40         max_value=100,
  41         value=25,
  42         step=1,
  43         key="slider4",
  44         on_change=on_change,
  45     )
  46     st.write("Value 4:", st.session_state.slider4)
  47     st.write("Slider changed:", "slider_changed" in st.session_state)
  48
  [end of e2e/scripts/st_slider.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/e2e/scripts/st_slider.py b/e2e/scripts/st_slider.py
  --- a/e2e/scripts/st_slider.py
  +++ b/e2e/scripts/st_slider.py
  @@ -14,6 +14,13 @@
   
   import streamlit as st
   
  +s1 = st.sidebar.slider("Label A", 0, 12345678, 12345678)
  +st.sidebar.write("Value A:", s1)
  +
  +with st.sidebar.expander("Expander"):
  +    s2 = st.slider("Label B", 10000, 25000, 10000)
  +    st.write("Value B:", s2)
  +
   w1 = st.slider("Label 1", 0, 100, 25, 1)
   st.write("Value 1:", w1)
  
verification_info: {"golden_diff": "diff --git a/e2e/scripts/st_slider.py b/e2e/scripts/st_slider.py\n--- a/e2e/scripts/st_slider.py\n+++ b/e2e/scripts/st_slider.py\n@@ -14,6 +14,13 @@\n \n import streamlit as st\n \n+s1 = st.sidebar.slider(\"Label A\", 0, 12345678, 12345678)\n+st.sidebar.write(\"Value A:\", s1)\n+\n+with st.sidebar.expander(\"Expander\"):\n+    s2 = st.slider(\"Label B\", 10000, 25000, 10000)\n+    st.write(\"Value B:\", s2)\n+\n w1 = st.slider(\"Label 1\", 0, 100, 25, 1)\n st.write(\"Value 1:\", w1)\n", "issue": "Slider value visually overlaps with the edge of the sidebar\n# Summary\r\n\r\nThe value label collides with the edges of the sidebar. It should change alignment when it gets close to the edges. \r\n\r\n# Steps to reproduce\r\n\r\n```py\r\nmin_weight = st.sidebar.slider(\"Minimum weight\", 2500, 6500)\r\n```\r\n\r\n## Expected behavior:\r\n\r\nThe value label should not collide with the edges. \r\n\r\n## Actual behavior:\r\n\r\n<img width=\"382\" alt=\"Screen Shot 2020-09-30 at 22 42 44\" src=\"https://user-images.githubusercontent.com/589034/94772484-97067200-036e-11eb-9f82-10453aa7452e.png\">\r\n\r\n\r\n## Is this a regression?\r\n\r\nno\r\n\r\n# Debug info\r\n\r\n- Streamlit version: 0.65.2\r\n- Browser version: Chrome\r\n\n", "before_files": [{"content": "# Copyright 2018-2021 Streamlit Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport streamlit as st\n\nw1 = st.slider(\"Label 1\", 0, 100, 25, 1)\nst.write(\"Value 1:\", w1)\n\nw2 = st.slider(\"Label 2\", 0.0, 100.0, (25.0, 75.0), 0.5)\nst.write(\"Value 2:\", w2)\n\nw3 = st.slider(\n    \"Label 3 - This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long label\",\n    0,\n    100,\n    1,\n    1,\n)\nst.write(\"Value 3:\", w3)\n\nif st._is_running_with_streamlit:\n\n    def on_change():\n        st.session_state.slider_changed = True\n\n    st.slider(\n        \"Label 4\",\n        min_value=0,\n        max_value=100,\n        value=25,\n        step=1,\n        key=\"slider4\",\n        on_change=on_change,\n    )\n    st.write(\"Value 4:\", st.session_state.slider4)\n    st.write(\"Slider changed:\", \"slider_changed\" in st.session_state)\n", "path": "e2e/scripts/st_slider.py"}]}