dfaure added inline comments. INLINE COMMENTS
> poboiko wrote in nestedlisthelper.cpp:87 > That's the current block being checked, not the next one. I've just checked > to be sure, last block can be unindented :) > > TBH, I don't really know if it's even possible for the current block to be > invalid (that would probably mean that `textCursor()` returned by `QTextEdit` > is invalid?). > I've just borrowed this particular check from the old code... Oh. I see. Well, it would be much more readable to move that if() *before* the line that declares and sets nextBlock. And yes I can't really see how this can happen, either. > nestedlisthelper.cpp:93 > } > - > - QTextCursor cursor = textEdit->textCursor(); > - bool handled = false; > - > - if (!cursor.hasSelection() && cursor.currentList()) { > - > - // Check if we're on the last list item. > - // itemNumber is zero indexed > - QTextBlock currentBlock = cursor.block(); > - if (cursor.currentList()->count() == > cursor.currentList()->itemNumber(currentBlock) + 1) { > - // Last block in this list, but may have just gained another > list below. > - if (currentBlock.next().textList()) { > - reformatList(); > - } > - > - // No need to reformatList in this case. reformatList is slow. > - if ((event->key() == Qt::Key_Return) || (event->key() == > Qt::Key_Backspace)) { > - handled = true; > - } > - } else { > - reformatList(); > - } > + if (!nextBlock.textList()) { > + return true; nextBlock is only used here so I would move its definition to just before this line. (same thing in the previous method, about prevBlock) REPOSITORY R310 KTextWidgets REVISION DETAIL https://phabricator.kde.org/D29208 To: poboiko, #frameworks, dfaure, mlaurent Cc: kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns