The new Adobe InDesign CC 2019 “Indents and Spacing” › “Space Between Paragraphs Using Same Style” option is excellent. It has allowed me to replace four styles for formatting a code listing (Listing, Listing:First Line, Listing:Final Line, Listing:Single Line) with just one Listing style (see https://graphicdesign.stackexchange.com/a/101784/20096 for details).
However, now I have a new problem. I want all my Listing-style lines to have “Keep with Next” set to 1, except for the final line in the listing, for which I wish to use “Keep with Next” set to 0. The only way I know to accomplish this is to hand-select each final line of a same-style paragraph sequence, and hand-edit the “Keep with Next” value. (I know, with some study, I could write a script to do it.)
Is there a way I can configure InDesign to automatically set “Keep with Next” to a different value for the final paragraph in a sequence of same-style paragraphs?