@@ -329,31 +329,22 @@ void EditorApp::create_native_status_bar() {
329329 HWND hwnd = glfwGetWin32Window (window_);
330330 if (!hwnd) return ;
331331
332- // Create status bar with parts
332+ // Create status bar - let it auto-position at bottom
333333 HWND status_hwnd = CreateWindowEx (
334334 0 ,
335335 STATUSCLASSNAME ,
336336 " " ,
337337 WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP ,
338- 0 , 0 , 0 , 0 ,
338+ 0 , 0 , 0 , 0 , // Position/size - let Windows handle this
339339 hwnd,
340340 (HMENU )1 ,
341341 GetModuleHandle (NULL ),
342342 NULL
343343 );
344344 native_status_bar = (void *)status_hwnd;
345345
346- // Initialize with 6 parts
347- int parts[6 ] = {80 , 250 , 350 , 420 , 480 , -1 };
348- SendMessage (status_hwnd, SB_SETPARTS , 6 , (LPARAM )parts);
349-
350- // Set initial text
351- SendMessage (status_hwnd, SB_SETTEXT , 0 , (LPARAM )L" NORMAL" );
352- SendMessage (status_hwnd, SB_SETTEXT , 1 , (LPARAM )L" " );
353- SendMessage (status_hwnd, SB_SETTEXT , 2 , (LPARAM )L" Ln 1, Col 1" );
354- SendMessage (status_hwnd, SB_SETTEXT , 3 , (LPARAM )L" UTF-8" );
355- SendMessage (status_hwnd, SB_SETTEXT , 4 , (LPARAM )L" LF" );
356- SendMessage (status_hwnd, SB_SETTEXT , 5 , (LPARAM )L" Tab:4" );
346+ // Show the window to initialize
347+ ShowWindow (status_hwnd, SW_SHOW );
357348#endif
358349}
359350
@@ -363,10 +354,25 @@ void EditorApp::update_native_status_bar() {
363354
364355 HWND status_hwnd = (HWND )native_status_bar;
365356
357+ // Get window dimensions for dynamic sizing
358+ int width, height;
359+ glfwGetWindowSize (window_, &width, &height);
360+
361+ // Calculate part widths dynamically
362+ int p1 = 80 ; // Mode
363+ int p2 = width / 4 ; // Filename
364+ int p3 = width / 4 + 80 ; // Line/Col
365+ int p4 = width / 2 ; // Encoding
366+ int p5 = width * 3 / 4 ; // EOL
367+ // Part 6 fills the rest
368+
369+ int parts[6 ] = {p1, p2, p3, p4, p5, -1 };
370+ SendMessage (status_hwnd, SB_SETPARTS , 6 , (LPARAM )parts);
371+
366372 // Get vim mode
367373 std::string vim_mode = get_vim_mode_str ();
368- wchar_t mode_buf[32 ];
369- mbstowcs (mode_buf, vim_mode.c_str (), 32 );
374+ wchar_t mode_buf[32 ] = L" " ;
375+ mbstowcs (mode_buf, vim_mode.c_str (), 31 );
370376 SendMessage (status_hwnd, SB_SETTEXT , 0 , (LPARAM )mode_buf);
371377
372378 // Get filename
@@ -375,33 +381,40 @@ void EditorApp::update_native_status_bar() {
375381 std::string name = tab.display_name ;
376382 if (tab.dirty ) name += " *" ;
377383
378- wchar_t file_buf[256 ];
379- mbstowcs (file_buf, name.c_str (), 256 );
384+ wchar_t file_buf[256 ] = L" " ;
385+ mbstowcs (file_buf, name.c_str (), 255 );
380386 SendMessage (status_hwnd, SB_SETTEXT , 1 , (LPARAM )file_buf);
381387
382388 // Get cursor position
383389 TextEditor* ed = get_active_editor ();
384390 if (ed) {
385391 auto pos = ed->GetCursorPosition ();
386- wchar_t pos_buf[64 ];
387- swprintf (pos_buf, 64 , L" Ln %d, Col %d" , pos.mLine + 1 , pos.mColumn + 1 );
392+ wchar_t pos_buf[64 ] = L" " ;
393+ swprintf (pos_buf, 63 , L" Ln %d, Col %d" , pos.mLine + 1 , pos.mColumn + 1 );
388394 SendMessage (status_hwnd, SB_SETTEXT , 2 , (LPARAM )pos_buf);
389395 }
390396
391397 // Encoding
392- wchar_t enc_buf[32 ];
393- mbstowcs (enc_buf, tab.file_encoding .c_str (), 32 );
398+ wchar_t enc_buf[32 ] = L" " ;
399+ mbstowcs (enc_buf, tab.file_encoding .c_str (), 31 );
394400 SendMessage (status_hwnd, SB_SETTEXT , 3 , (LPARAM )enc_buf);
395401
396402 // Line ending
397- wchar_t eol_buf[16 ];
398- mbstowcs (eol_buf, tab.line_ending .c_str (), 16 );
403+ wchar_t eol_buf[16 ] = L" " ;
404+ mbstowcs (eol_buf, tab.line_ending .c_str (), 15 );
399405 SendMessage (status_hwnd, SB_SETTEXT , 4 , (LPARAM )eol_buf);
400406
401407 // Tab size
402- wchar_t tab_buf[32 ];
403- swprintf (tab_buf, 32 , L" Tab:%d" , settings_.tab_size );
408+ wchar_t tab_buf[32 ] = L" " ;
409+ swprintf (tab_buf, 31 , L" Tab:%d" , settings_.tab_size );
404410 SendMessage (status_hwnd, SB_SETTEXT , 5 , (LPARAM )tab_buf);
411+ } else {
412+ // No file - clear sections
413+ SendMessage (status_hwnd, SB_SETTEXT , 1 , (LPARAM )L" " );
414+ SendMessage (status_hwnd, SB_SETTEXT , 2 , (LPARAM )L" " );
415+ SendMessage (status_hwnd, SB_SETTEXT , 3 , (LPARAM )L" " );
416+ SendMessage (status_hwnd, SB_SETTEXT , 4 , (LPARAM )L" " );
417+ SendMessage (status_hwnd, SB_SETTEXT , 5 , (LPARAM )L" " );
405418 }
406419#endif
407420}
0 commit comments