Always display path in status bar.

diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c
index d7773f2..8ec6d70 100644
--- a/programs/regedit/childwnd.c
+++ b/programs/regedit/childwnd.c
@@ -83,6 +83,35 @@
     EndPaint(hWnd, &ps);
 }
 
+void OnTreeSelectionChanged(HWND hwndTV, HWND hwndLV, HTREEITEM hItem, BOOL bRefreshLV)
+{
+    LPCTSTR keyPath, rootName;
+    LPTSTR fullPath;
+    HKEY hRootKey;
+
+    keyPath = GetItemPath(hwndTV, hItem, &hRootKey);
+    if (keyPath) {
+        if (bRefreshLV)
+            RefreshListView(hwndLV, hRootKey, keyPath, NULL);
+        rootName = get_root_key_name(hRootKey);
+        fullPath = HeapAlloc(GetProcessHeap(), 0, (lstrlen(rootName) + 1 + lstrlen(keyPath) + 1) * sizeof(TCHAR));
+        if (fullPath) {
+            _stprintf(fullPath, "%s\\%s", rootName, keyPath);
+            SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)fullPath);
+            HeapFree(GetProcessHeap(), 0, fullPath);
+        }
+    }
+    else {
+        /* else the computer icon is being selected, so display computer name */
+        TCHAR text[260];
+        DWORD size;
+    
+        size = sizeof(text)/sizeof(TCHAR);
+        GetComputerName(text, &size);
+        SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text);
+    }
+}
+
 /*******************************************************************************
  *
  *  FUNCTION: _CmdWndProc(HWND, unsigned, WORD, LONG)
@@ -238,23 +267,9 @@
             switch (((LPNMHDR)lParam)->code) {
             case TVN_ITEMEXPANDING:
                 return !OnTreeExpanding(pChildWnd->hTreeWnd, (NMTREEVIEW*)lParam);
-            case TVN_SELCHANGED: {
-                    LPCTSTR keyPath, rootName;
-		    LPTSTR fullPath;
-                    HKEY hRootKey;
-
-		    keyPath = GetItemPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, &hRootKey);
-		    if (keyPath) {
-                        RefreshListView(pChildWnd->hListWnd, hRootKey, keyPath, NULL);
-			rootName = get_root_key_name(hRootKey);
-			fullPath = HeapAlloc(GetProcessHeap(), 0, (lstrlen(rootName) + 1 + lstrlen(keyPath) + 1) * sizeof(TCHAR));
-			if (fullPath) {
-			    _stprintf(fullPath, "%s\\%s", rootName, keyPath);
-			    SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)fullPath);
-			    HeapFree(GetProcessHeap(), 0, fullPath);
-			}
-		    }
-                }
+            case TVN_SELCHANGED:
+                OnTreeSelectionChanged(pChildWnd->hTreeWnd, pChildWnd->hListWnd,
+                    ((NMTREEVIEW *)lParam)->itemNew.hItem, TRUE);
                 break;
 	    case NM_SETFOCUS:
 		pChildWnd->nFocusPanel = 0;
diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c
index 7818f63..65d33f1 100644
--- a/programs/regedit/framewnd.c
+++ b/programs/regedit/framewnd.c
@@ -121,16 +121,16 @@
     if (bResize)
         SendMessage(hStatusBar, WM_SIZE, 0, 0);
     SendMessage(hStatusBar, SB_SETPARTS, 1, (LPARAM)&nParts);
+    UpdateStatusBar();
 }
 
 void UpdateStatusBar(void)
 {
-    TCHAR text[260];
-    DWORD size;
-
-    size = sizeof(text)/sizeof(TCHAR);
-    GetComputerName(text, &size);
-    SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)text);
+    /* real updating of status bar happens in the treeview selection
+     * change handler, so fake a selection change to it, but don't
+     * refresh the listview or the current selection will change */
+    OnTreeSelectionChanged(g_pChildWnd->hTreeWnd, g_pChildWnd->hListWnd,
+        TreeView_GetSelection(g_pChildWnd->hTreeWnd), FALSE);
 }
 
 static void toggle_child(HWND hWnd, UINT cmd, HWND hchild)
diff --git a/programs/regedit/main.h b/programs/regedit/main.h
index 9a6dd4e..fc68373 100644
--- a/programs/regedit/main.h
+++ b/programs/regedit/main.h
@@ -103,6 +103,7 @@
 extern HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id);
 extern BOOL RefreshTreeView(HWND hWndTV);
 extern BOOL OnTreeExpanding(HWND hWnd, NMTREEVIEW* pnmtv);
+extern void OnTreeSelectionChanged(HWND hwndTV, HWND hwndLV, HTREEITEM hItem, BOOL bRefreshLV);
 extern LPCTSTR GetItemPath(HWND hwndTV, HTREEITEM hItem, HKEY* phRootKey);
 extern BOOL DeleteNode(HWND hwndTV, HTREEITEM hItem);
 extern HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPTSTR name);