Bug 121992 - I'm missing information on the number of words currently used in a kate document.
Summary: I'm missing information on the number of words currently used in a kate docum...
Status: RESOLVED DUPLICATE of bug 65740
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-15 01:14 UTC by norbert.lindlbauer
Modified: 2006-09-16 20:51 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description norbert.lindlbauer 2006-02-15 01:14:04 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    SuSE RPMs

As a student I have to write essays with a given word count. While kate offers many features I really like I'm missing the number of used words at the bottom bar of kate.
Just a minor thing, but could be helpful to others too.
I know that it is available in kdevelop which is also using kate.
Couldn't that mean to share code if kate could do it?

Regards,
  Norbert
Comment 2 Anders Lund 2006-02-15 08:54:25 UTC
On Wednesday 15 February 2006 05:09, Matej Cepl wrote:
> http://wiki.kate-editor.org/index.php/Kate_Application_DCOP_Scripting


That wouldn't put it in the status bar.

There are several other pieces of information that could be nice to see in the 
statusbar, but it could easily end up very crowded too. I wonder if offering 
some options would be nice, letting the user select what to see.

-anders
Comment 3 Matej Cepl 2006-02-15 12:49:43 UTC
So, I am afraid, that we are returning to my previous effort with abusing external tools. See this thread http://thread.gmane.org/gmane.comp.kde.devel.kwrite/6888 for more info. Oh well. At least you can use something like [ -z "%selection" ] for counting words in all document / only in selection.
Comment 4 Matej Cepl 2006-02-19 02:44:09 UTC
I tried this JavaScript function:

wcCount = document.textFull().split(/[\s\n]+/).length;
document.insertLine(0,wcCount+"\n");

but obviously document.insertLine is not the best way how to report number. Any better way?
Comment 5 Anders Lund 2006-02-19 08:49:35 UTC
On Sunday 19 February 2006 02:44, Matej Cepl wrote:
> I tried this JavaScript function:
>
> wcCount = document.textFull().split(/[\s\n]+/).length;
> document.insertLine(0,wcCount+"\n");
>
> but obviously document.insertLine is not the best way how to report number.
> Any better way?



use wc(1) and external tools. Here is a simple configuration that works for 
local files:

[externaltool_Wordcount]
acname=externaltool_Wordcount
cmdname=
command=url=`echo %URL|sed -r 's,^\\w+\\:/+,/,'`\nkdialog --msgbox "Word count 
for\n%URL:\\n$(wc -lwm $url|sed -
r 's,\\s*(\\w+)\\s+(\\w+)\\s+(\\w+).*,Lines: \\1\\nWords: \\2\\nCharacters: 
\\3,')"\n
executable=wc
icon=
mimetypes=
name=Word count
save=1


If you don't like wc you can use whatever command (sed, perl) to do the 
calculations as you please.
Comment 6 Andreas Kling 2006-09-16 20:51:55 UTC

*** This bug has been marked as a duplicate of 65740 ***