Skip to content

Allow negative line spacing for the script editor in Editor Settings#76596

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
Calinou:editor-settings-allow-negative-line-spacing
Feb 20, 2026
Merged

Allow negative line spacing for the script editor in Editor Settings#76596
Repiteo merged 1 commit into
godotengine:masterfrom
Calinou:editor-settings-allow-negative-line-spacing

Conversation

@Calinou

@Calinou Calinou commented Apr 29, 2023

Copy link
Copy Markdown
Member

This can be used to make text even more compact with certain fonts.

In the meantime, you can edit editor_settings-4.tres while the editor is closed and manually input a negative value for text_editor/appearance/whitespace/line_spacing (add that line if it's not present in your configuration file).

@Calinou Calinou requested a review from a team as a code owner April 29, 2023 22:13
@Calinou Calinou added this to the 4.x milestone Apr 29, 2023
@Rindbee

Rindbee commented Apr 29, 2023

Copy link
Copy Markdown
Contributor

I don't think this is a good workaround. Using negative line_spacing on CodeEdit may cause a crash in some cases (when changing font_size/line_spacing, resulting in the condition font_size + line_spacing = -3 being met).

Comment thread editor/editor_resource_picker.cpp Outdated
Comment thread editor/editor_settings.cpp Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/appearance/whitespace/line_spacing", 4, "-10,50,1")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/appearance/whitespace/line_spacing", 4, "0,50,1,or_greater,or_lesser")

Alternatively just let users type in negative numbers manually in the editor?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, as this would allow using extremely large values that would make the editor look completely broken.

@Calinou Calinou force-pushed the editor-settings-allow-negative-line-spacing branch from 64e1b2a to 18d3e39 Compare April 29, 2023 22:55
This can be used to make text even more compact with certain fonts.
@Calinou Calinou force-pushed the editor-settings-allow-negative-line-spacing branch from 18d3e39 to 9bbad45 Compare July 31, 2025 16:24
@Calinou Calinou requested a review from a team July 31, 2025 16:24
@Calinou

Calinou commented Jul 31, 2025

Copy link
Copy Markdown
Member Author

I don't think this is a good workaround. Using negative line_spacing on CodeEdit may cause a crash in some cases (when changing font_size/line_spacing, resulting in the condition font_size + line_spacing = -3 being met).

I think it's better to fix the crash (which should be possible) if it still occurs on latest master.

@Repiteo Repiteo requested a review from a team as a code owner February 17, 2026 20:11

@kitbdev kitbdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, works as expected.

  • I think any crashes were fixed by #76605

-10 is good for the minimum, since going too low can result in overlapping or errors in some cases (-21 prints errors for me).

@Repiteo Repiteo modified the milestones: 4.x, 4.7 Feb 20, 2026
@Repiteo Repiteo merged commit 230e6bf into godotengine:master Feb 20, 2026
20 checks passed
@Repiteo

Repiteo commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Thanks!

@Calinou Calinou deleted the editor-settings-allow-negative-line-spacing branch February 20, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment