completion-mode: correctly set completion character

Auto completion is case-insensitive. Calculation of the completion
character must be case-insensitive as well.

Otherwise, if you have two labels "bar" and "Baz", and you type

    Lba<Tab>

the letters 'b' and 'B' are marked, when really 'r' and 'z' should be
marked. The same goes for contacts with an initial segment that differs
only in case.
ctrl-n, ctrl-p: don't close message if there is no next one

This fixes the following inconsistent behaviour.

- have a thread with multiple messages

old behaviour:

1. close all messages
2. move cursor on a later message
3. repeatedly press ctrl-p until you reach the first message
4. pressing ctrl-p one more time closes the first message again

Step 4. should not close the message. In fact, if you close all but the
first message in step 1, then step 4 doesn't close the message. This is
inconsistent.

new behaviour:

The first message stays open when you press ctrl-p, no matter if it was
opened or closed before.

Analoguous for ctrl-n and the last message in a thread.
Merge #287: completion-mode: Correctly set completion character
history: bugfixes