diff --git a/wordcount.py b/wordcount.py
index 3c9d566..4053dbc 100644
--- a/wordcount.py
+++ b/wordcount.py
@@ -11,6 +11,9 @@ def get_text(doc):
except Exception:
return ""
+ def format_with_thousands_separator(number):
+ return f"{number:,}"
+
class WordcountPlugin(GObject.Object, Gedit.WindowActivatable):
__gtype_name__ = "WordcountPlugin"
window = GObject.property(type=Gedit.Window)
@@ -75,6 +78,10 @@ class WordcountPlugin(GObject.Object, Gedit.WindowActivatable):
text = get_text(doc)
word_count = len(WORD_RE.findall(text))
char_count = len(text)
- self._label.set_text(f"words: {word_count} | chars: {char_count}")
+ formatted_words = format_with_thousands_separator(word_count)
+ formatted_chars = format_with_thousands_separator(char_count)
+
+ self._label.set_text(f"words: {formatted_words} | chars: {formatted_chars}")
except Exception as e:
self._label.set_text(f"error: {e}")
+