How to fix the bug (?) for outline entries with long titles?

I suspect that the outline issue is essentially the same as this problem with a QED symbol that needs to be on the right:

And indeed Laurenz’ solution can be adapted to this use case:

#show outline.entry: it => {
  link(it.element.location(), {
    it.body
    box(width: 0pt)
    box(width: 1fr, it.fill)
    sym.wj
    [#it.element.location().page()]
  })
}

#outline()
#outline(
  title: [List of Figures],
  target: figure.where(kind: image)
)


#let prefix = "This is a" + " very" * 16
= #prefix long title
= #prefix long! title
== #prefix long title

#set heading(numbering: (..nums) => "Ch " + numbering("1.", ..nums))
#let prefix = "This is a" + " very" * 15
= #prefix looong title
= #prefix loooong title
== #prefix long title

#let prefix = "This is a" + " very" * 13
#figure(
  [a],
  caption: [#prefix looong caption]
)
#figure(
  [a],
  caption: [#prefix looong! caption]
)
#figure(
  [a],
  caption: [#prefix loooong caption]
)
Rendered outlines

What I didn’t attempt is duplicate @Andrew’s indentation of follow-up lines: for example, the word “title” in the second line of the third entry starts to the left of the start of the entry. Other than that, I think this solution worked pretty well.

1 Like