Skip to content
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

Added configurable spacing after and before headers #27

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

MayitaMayoso
Copy link

I felt the spacing after headers was too big so I added the ability to configure how big are the spaces after and before the headers.

@MayitaMayoso
Copy link
Author

IDE keep messing with the format, please ignore my previous commits to my fork 😅.

@MayitaMayoso MayitaMayoso changed the title Added spacing after and before on header format Added configurable spacing after and before headers May 15, 2024
@dougbinks
Copy link
Member

Thanks for this PR.

Your implementation as it stands will break current users layout, so it needs to be changed so that the default is to use ImGui::NewLine(). I think the easiest way to do this is to use a negative spaceBefore or spaceAfter to mean use Newline() and to default to -1.0f in the struct MarkdownConfig:

    MarkdownHeadingFormat   headingFormats[ NUMHEADINGS ] = { { NULL, true, -1.0f, -1.0f }, { NULL, true, -1.0f, -1.0f  }, { NULL, true, -1.0f, -1.0f  } };

Note you also need to remove the defaults from struct MarkdownHeadingFormat as these should be set as above (this makes it easier for people to see how to initialize these).

@dougbinks dougbinks self-requested a review May 15, 2024 11:25
@MayitaMayoso
Copy link
Author

Added the mentioned suggestions! I did set as -1.0f the default values so it does not affect the format of other people.

@dougbinks
Copy link
Member

Thanks - I'll pull this to review once I get some time.

@dougbinks
Copy link
Member

This does not compile for me as the function ImGui::Spacing() does not have a parameter:

https://github.com/ocornut/imgui/blob/master/imgui.h#L482

I think you could possibly use a Dummy of a given height and zero width?

@dougbinks
Copy link
Member

Just a reminder that this PR is waiting on a fix as it does not compile against the latest Dear ImGui library code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants