Hi, I need to adhere precise word/character counts in sections of a document. For this I need to have instantaneous visual feedback of stats when selecting blocks of text.
The attached patch does this. Is there some objection to push this into master? (If no objection raised I'll add string translation layer to the patch.) Pavel
diff --git a/src/Text.cpp b/src/Text.cpp index 7857e5e06c..6a7b80d93f 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -2146,6 +2146,18 @@ docstring Text::currentState(CursorData const & cur, bool devel_mode) const } } + // Stats if selection is done + if (cur.selection()) { + DocIterator from, to; + from = cur.selectionBegin(); + to = cur.selectionEnd(); + buf.updateStatistics(from, to); + int const words = buf.wordCount(); + int const chars = buf.charCount(false); + int const chars_blanks = buf.charCount(true); + os << ", w:" << words << " c:" << chars << " cb:"<<chars_blanks; + } + // Custom text style InsetLayout const & layout = cur.inset().getLayout(); if (layout.lyxtype() == InsetLyXType::CHARSTYLE)
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel