-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve gr.Code
#9450
Improve gr.Code
#9450
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/c6d533a471545439a67d32143ed73a2bb34a0c23/gradio-4.44.1-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@c6d533a471545439a67d32143ed73a2bb34a0c23#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/c6d533a471545439a67d32143ed73a2bb34a0c23/gradio-client-1.6.0-beta.3.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/c6d533a471545439a67d32143ed73a2bb34a0c23/dist/lite.js""></script> |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
I think this looks better and also is consistent with all other Blocks that fill to match the height of neighboring containers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @hannahblair !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care of this @hannahblair!
I agree with @aliabid94's comments but they aren't blocking.
Yeah, I agree that the autofill looks better. Perhaps the best way of doing this is allowing edit: actually maybe |
@aliabid94 I've addressed this by actually introducing line wrapping into the code editor which I think makes it much more usable and you can see the cursor location on focus. Scrolling horizontally feels a bit clunky IMO. Let me know what you think! |
I really think this should be an option if we add it. Line wrapping is not standard for code editors and (imo) is a worse UX. |
@aliabid94 the expanding with the content behaviour is how other components behave, like gr.Textbox, gr.Image, gr.FileUploader etc - we don't have a default height for |
The new icons and styling look great! |
Description
min_width
param which wasn't being applied to the frontendmax_lines
toNone
by default (breaking change). This means that by default the Code component will fill the container and expand with the content just as the other components do. Settingmax_lines
to a number will still fix the height.Closes: #9414
Closes #6041
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh