After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 148148 - Word count in the status bar
Word count in the status bar
Status: RESOLVED OBSOLETE
Product: gedit
Classification: Applications
Component: general
3.2.x
Other All
: Normal enhancement
: ---
Assigned To: Gedit maintainers
gedit QA volunteers
Depends on:
Blocks:
 
 
Reported: 2004-07-22 08:12 UTC by Jono Bacon
Modified: 2020-11-24 09:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Its counts the words in the current view. (11.93 KB, patch)
2004-08-24 00:43 UTC, kamalesh
rejected Details | Review
The Snapshot of the customize statusbar in view menu (60.55 KB, image/png)
2004-08-24 00:50 UTC, kamalesh
  Details

Description Jono Bacon 2004-07-22 08:12:48 UTC
I am a freelance writer (www.jonobacon.org) and I write all of my copy in GEdit.
I use the program for its simplicity, non-cluttered interface and ease of use.
The one feature I am missing though is something pretty much every writer I have
worked with wants - a dynamically updated word count in the status bar. While I
type the status bar word count would be updated. I need to check the word count
regularly when writing, and it is a pain having to update the word count in the
dialog box.

I know there are performance issues, but this would be great to be a feature
that is turned off by default and then you turn it on (maybe with a warning
about performance). I am sure my P4 2.5Ghz with 512MB RAM would be capable of
the job though. :)

I spoke Paulo on IRC about it, and he asked if I could post the IRC log when I
asked for the feature. Here it is:

<jono> are you a gedit hacker?
<paolo> yep
<jono> can I request a feature - I am a professional writer, and I am gagging
for a single, simple feature - I would just like a word count in the status bar
- I write for various magazines (www.jonobacon.org) and I really need a word
count in the status bar and no other editor has one - if you add this you will
win so many writers over
<paolo> why do you need it on the status bar? Why the current program count does
not work for you?
<paolo> You can open it and simply refresh it when you want to check the number
of words
<paolo> we could eventually make it autorefreshing every x seconds
<paolo> note that counting words in big documents can be quite expensive
<paolo> so having it in the status bar could be a performance problem
<jono> yeah but it is a pain to have to click on the menu to get the number of
words when I could just glance down - this is because I need to know the number
of words all the time
<paolo> note that the program count in gedit is modeless
<jono> I know it is a performance issue, but if you made it an option to turn
on, people would only use it if their machine could handle it - I am sure my
machine would be fine
<paolo> so you don't need to click on the menu every time
<jono> but putting it on the status bar would make my life so much easier
<jono> like I say - if you just made it an option, maybe with a warning about
performance, that would be great
<paolo> ok
<jono> seriously - every writer I speak to needs this, and this could push gedit
ahead of others
<jono> I use gedit because it is simple and uncluttered, but this is the only
thing I need
<paolo> please, post a request for enh to bugzilla.gnome.org so your request
will not be lost
<jono> sure
Comment 1 Paolo Maggi 2004-07-22 08:24:57 UTC
I think this could be implemented as an extension of the Document Statistics plugin.
What the plugin is "activated" it will have to add submenu of the View menu

View->Customize StatusBar

with the following items:

[ ] Show _words
[ ] Show _lines
[ ] Show _characters (with spaces)

If one of the items is selected a new status bar widget is added to the status bar:

[ ...                      | Ln 123, Col 123 | W 3213, L 999, Ch 3434 | INS ]

A tooltip could be shown whrn the mouse is over the new status bar.

Comments?
Comment 2 Jono Bacon 2004-07-22 08:39:18 UTC
This is exactly the way it should work. This is both intuitive and useful. IT 
is also useful having the number of characters as some publications work in 
characters as opposed to words. 
Comment 3 Archana Shah 2004-07-27 11:42:30 UTC
Should I work out a patch for this ?
Comment 4 Paolo Borelli 2004-07-27 11:56:28 UTC
Patches are always welcome :) but keep in mind that we are feature frozen for
gnome 2.8

Note also that if you have time to work on gedit there's other stuff with higher
priority. It's open source though, so you're free to work on what you prefer :)
Comment 5 kamalesh 2004-08-24 00:43:00 UTC
Created attachment 30879 [details] [review]
Its counts the words in the current view.

The Menu is also been design as said by  Paolo Maggi, checkout the patch.
Comment 6 kamalesh 2004-08-24 00:50:42 UTC
Created attachment 30880 [details]
The Snapshot of the customize statusbar in view menu
Comment 7 Paolo Maggi 2005-01-23 20:40:13 UTC
Comment on attachment 30879 [details] [review]
Its counts the words in the current view.

Sorry for the late reply.

> 
>diff -bBp /root/original/gnome2/gedit/gedit/gedit-mdi.c gedit-mdi.c 

Please, use "cvs diff -up" when submitting a patch.

As I said in my previous comment I'd like to see this feature implemented in
the "document statistics" plugin.

>  	
>+ 	gtk_text_buffer_get_start_iter(buffer,&buffer_start);
>+ 	gtk_text_buffer_get_end_iter(buffer,&buffer_end);
>+ 	
>+ 	while (!gtk_text_iter_equal (&buffer_start, &buffer_end))
>+ 	{
>+ 		if (gtk_text_iter_get_char (&buffer_start) == '\t' || gtk_text_iter_get_char (&buffer_start) == '\n')	
>+ 			word_count_space = FALSE;
>+ 		else
>+ 		{
>+ 			if (gtk_text_iter_get_char(&buffer_start) != ' ')
>+ 			{
>+ 				if (word_count_space == FALSE)
>+ 				{
>+ 					++words;
>+ 					word_count_space = TRUE;
>+ 				}
>+ 			}
>+ 			else
>+ 				word_count_space = FALSE;
>+ 		}
>+ 			gtk_text_iter_forward_char (&buffer_start);
>+ 	}

You have to use the right functions provided by GtkTextIter to find the start
and the end of a word.
Your implementation is not correct from an i18n point of view.
Comment 8 Carnë Draug 2011-05-18 03:15:00 UTC
I'd also like to request this feature. I've planning to learn Python for ages just to hack this but haven't fond the time to learn it yet.
Comment 9 Ivan Baldo 2012-05-30 00:03:39 UTC
I think that it should be simpler, just a toggle in the View menu to add extended info to the statusbar.
In my case I need specifically to see the length in characters of my current selection.
So I suggest adding the same info but for the current selection in the status bar with parenthesis when something is selected using the suggested format of Paolo for the status bar.
Thanks.
Comment 10 Sébastien Wilmet 2014-08-12 20:58:15 UTC
There is already a plugin for document statistics. It should be enough in my opinion. The statusbar already contains lots of things.

If the number of words is displayed in the statusbar, people will focus more on the statistics. People should instead focus on the contents and the quality of the document, regardless of how many words there are… In my opinion.

See for example LWN, I'm sure they totally don't care about the number of words, as soon as the articles are interesting and well written.

So I think it's not really useful to keep this 10-years-old bug.
Comment 11 Ivan Baldo 2014-08-13 00:39:50 UTC
I disagree, I still find it useful to know the number of characters of a selection while coding...
Comment 12 Paolo Borelli 2014-08-13 08:38:19 UTC
I like the idea of showing this info when selecting. reopening
Comment 13 Pacho Ramos 2015-04-16 08:44:44 UTC
I also just missed this feature. Maybe the characters count could be shown at buttom bar after the "rows/cols" count :/

Thanks a lot
Comment 14 Sébastien Wilmet 2020-11-24 09:57:22 UTC
Mass-closing of all gedit bugzilla tickets.

Special "code" to find again all those gedit bugzilla tickets that were open before the mass-closing:

2bfe1b0590a78457e1f1a6a90fb975f5878cb60064ccfe1d7db76ca0da52f0f3

By searching the above sha256sum in bugzilla, the gedit contributors can find again the tickets. We may be interested to do so when we work on a specific area of the code, to at least know the known problems and possible enhancements.

We do this mass-closing because bugzilla.gnome.org is being replaced by gitlab.gnome.org.