imgui_markdown icon indicating copy to clipboard operation
imgui_markdown copied to clipboard

Added configurable spacing after and before headers

Open MayitaMayoso opened this issue 1 year ago • 6 comments

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 avatar May 15 '24 11:05 MayitaMayoso

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

MayitaMayoso avatar May 15 '24 11:05 MayitaMayoso

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 avatar May 15 '24 11:05 dougbinks

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

MayitaMayoso avatar May 15 '24 13:05 MayitaMayoso

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

dougbinks avatar May 15 '24 17:05 dougbinks

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 avatar May 20 '24 15:05 dougbinks

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

dougbinks avatar Jun 02 '24 10:06 dougbinks