Thanks to visit codestin.com
Credit goes to github.com

Skip to content

wrap_lines in st.code doesn't wrap if there's no whitespace #10824

@jrieke

Description

@jrieke

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

If wrap_lines=True is set in st.code, it only wraps on whitespace. That means long strings without a whitespace won't wrap.

Reproducible Code Example

Open in Streamlit Cloud

import streamlit as st

long_string = "askldfjlweklrjweifjlsdfliwjlierjilsildfjlslfijwilerijlesijlrlijsdflijslijerilweilrilsdfilsilfijlsdf"

st.code(long_string, wrap_lines=True)

Steps To Reproduce

Run this app, or see playground.

Expected Behavior

Wraps.

Current Behavior

Doesn't wrap.

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.43
  • Python version:
  • Operating System:
  • Browser:

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.codeRelated to the `st.code` elementpriority:P4Low prioritystatus:confirmedBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions