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 +}