client: Fix text format shortcuts edge case
authorShane Synan <digitalcircuit36939@gmail.com>
Tue, 19 Jun 2018 00:59:05 +0000 (19:59 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 19 Jun 2018 21:52:02 +0000 (23:52 +0200)
commitd92889b37ed17d63f4db6be571f9254391186e83
tree12c44412dadaf431ce34920a81d9a9d46f6b88b6
parent04d0f8b23cc2b14c8af31a391fb4b11174b9244e
client: Fix text format shortcuts edge case

When toggling text formatting via keyboard shortcuts, always update
the button state, too.  This fixes an issue where in certain
situations formatting could not be removed by shortcut, only by
button.

(I originally avoided doing this out of concern it'd create a loop
 with the clicked() signal firing when setting check state.
 Thankfully that's not the case.)

Test case:

1.  Type "test message here"
2.  Select "message", mark as italic (button or shortcut)
3.  Move cursor to end of message, so italic button becomes unpressed
4.  Click at the end of the word "message" (after the 'e'), and
    drag-select/Shift-Arrow select up to the beginning of the message
    (before the 'm').
5.  Use shortcut to toggle italic, several times
6.  Use button to toggle italic, several times

> Before
The italic shortcut would not toggle on then off, clearing the format
> After
The italic shortcut works after toggling twice, just like the button.

Having to toggle twice in this situation is a bug that existed before
the formatting shortcut changes.
src/qtui/inputwidget.cpp