Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"productName": "Wave",
"description": "Open-Source AI-Native Terminal Built for Seamless Workflows",
"license": "Apache-2.0",
"version": "0.14.5",
"version": "0.14.6",
"homepage": "https://waveterm.dev",
"build": {
"appId": "dev.commandline.waveterm"
Expand Down
8 changes: 8 additions & 0 deletions pkg/wcore/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,13 @@ func BootstrapStarterLayout(ctx context.Context) error {
return fmt.Errorf("error applying starter layout: %w", err)
}

// Apply the workspace's default connection/cwd to the freshly created blocks.
// Re-fetch the tab since ApplyPortableLayout updates BlockIds in the database only.
starterTab, err := wstore.DBGet[*waveobj.Tab](ctx, tabId)
if err != nil {
return fmt.Errorf("error reloading starter tab: %w", err)
}
applyWorkspaceDefaultsToBlocks(ctx, workspace.OID, starterTab)

return nil
}
15 changes: 13 additions & 2 deletions pkg/wcore/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ func CreateTab(ctx context.Context, workspaceId string, tabName string, activate
if err != nil {
return tab.OID, fmt.Errorf("error applying new tab layout: %w", err)
}
// ApplyPortableLayout creates the blocks and updates the tab's BlockIds in the
// database, but the in-memory `tab` variable is not refreshed. Re-fetch the tab so
// that applyWorkspaceDefaultsToBlocks iterates over the actual created blocks.
tab, err = wstore.DBGet[*waveobj.Tab](ctx, tab.OID)
if err != nil {
return tab.OID, fmt.Errorf("error reloading tab: %w", err)
}
applyWorkspaceDefaultsToBlocks(ctx, workspaceId, tab)
tabBg := getTabBackground()
if tabBg != "" {
Expand Down Expand Up @@ -340,13 +347,17 @@ func applyWorkspaceDefaultsToBlocks(ctx context.Context, workspaceId string, tab
updated = true
}
}
if ws.DefaultCwd != "" && isTerm {
// Only apply the workspace default cwd when the block's effective connection
// matches the workspace default connection. A block already on a different
// connection must keep its own cwd (or the remote home directory).
blockConn, _ := meta[waveobj.MetaKey_Connection].(string)
if ws.DefaultCwd != "" && isTerm && blockConn == ws.DefaultConnName {
if _, exists := meta[waveobj.MetaKey_CmdCwd]; !exists {
meta[waveobj.MetaKey_CmdCwd] = ws.DefaultCwd
updated = true
}
}
if ws.DefaultCwd != "" && isFileBrowser {
if ws.DefaultCwd != "" && isFileBrowser && blockConn == ws.DefaultConnName {
meta[waveobj.MetaKey_File] = ""
meta[waveobj.MetaKey_FileCwd] = ws.DefaultCwd
updated = true
Expand Down
Loading