While cppcheck did not turn out any suspicious error messages, using
the "performance" flag highlighted several nitpicks in three categories
* do not use it++ for iterators, ++it is better
* do not use size() to test for emptyness, empty() is here
* do not use "const T" as a function parameter, "const & T" is better
I doubt that any of these is a real performance problem, but the code is cleaner anyway.
When there is a single document open, the tabbar gets hidden. The only and selected tab is still visible though as a break in the line delining the tabwidget. To fix this we paint the tabwidget ourselves and remove the presence of the hidden tab.
When the socket does not exist anymore, we should not try to access it. In
trying to do so, std::map will create a new shared_ptr but this pointer
doesn't point at anything. To prevent this, we explicitly check whether
the socket is available.
This reverts the previous fix in [0a33374c/lyxgit] and fixes it
differently.
We always have to call 'notifyCursorLeaves', but we only have to make sure
that we call the 'fixIfBroken()' functions first.
We rely on the 'or' operator to prevent us from calling
'notifyCursorLeaves' if one of the two cursors is broken. This doesn't
work when using the '|' operator. The compiler 'optimizes' the code in
such a way that we always call notifyCursorLeaves anyway. Using the '||'
operator fixes this.
The undo range is extended to encompass all the paragraph after the end that
are a non-zero depth. The reason is that these paragraphs may see their depth
reduced if the last paragraph sees its depth reduced.
Note that there is a memory cost, since we store paragraphs than may not be
modified in practice. This may matter for some pathological files (people
putting all their document at depth 1 for a weird reason?)
I tried to be careful, but this can introduce new bugs. Please test.
Only user of this function is code that has been commented out, comment
out this function as well.
Signed-off-by: Lars Gullik Bjønnes <larsbj@gullik.org>