From 5d6a55dd0945ea250b0fff7f01ba7b29ab2ffbac Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Fri, 5 Jun 2026 12:49:16 +0530 Subject: [PATCH] feat(renderer): StatusBar reads from editor store (word count, cursor pos) --- src/renderer/components/layout/StatusBar.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/layout/StatusBar.tsx b/src/renderer/components/layout/StatusBar.tsx index 582b253..7fa63da 100644 --- a/src/renderer/components/layout/StatusBar.tsx +++ b/src/renderer/components/layout/StatusBar.tsx @@ -1,14 +1,25 @@ +import { useEditorStore } from '@/stores/editor-store'; + +function countWords(text: string): number { + return text.trim().length === 0 ? 0 : text.trim().split(/\s+/).length; +} + export function StatusBar() { + const { buffers, activeId } = useEditorStore(); + const buf = activeId ? buffers.get(activeId) : null; + const wordCount = buf ? countWords(buf.content) : 0; + const cursor = buf?.cursor ?? { line: 1, column: 1 }; + return ( ); -} \ No newline at end of file +}