So I am writing a programming book and I decided to include \sections in the ToC as well (see picture below). The problem I am having is that I have ugliness where \chapter is the last item on the page and only on the next page I have the \sections for that chapter (see the very end of picture).
How can I fix ToC to move this 3 Text Conversion and Substitution to a new page rather than leaving it hanging on the current page?
I am using memoir class, btw.
