I have a similar question as in Avoid page breaks in lstlistings. In my case, it's not a problem to have page breaks in a listing (some of them are too long anyways). But LaTeX sometimes constructs things like:
- First part of listing
- Page break
- Second part of listing
If it has to page break a listing, then I would at least expect that it will break the listing right at the end of the page and continue at the beginning of the next page. Not inserting figures and stuff in between.
How can I achieve that?