core: fix hotlist problems after apply of a layout (bug #41481)

This commit fixes a problem when computing the value of "num_displayed"
in all buffers. For merged buffers (with same number), the num_displayed
of each merged buffer must be incremented (and not only the current
active buffer).