Skip to content

Commit 1e6ad4d

Browse files
authored
Fix window space bug and released (#1321)
1 parent 8e45e78 commit 1e6ad4d

File tree

6 files changed

+25
-12
lines changed

6 files changed

+25
-12
lines changed

apps/studio/electron/main/bun/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import { __dirname } from '../index';
55
import { replaceCommand } from './parse';
66

77
export const getBunExecutablePath = (): string => {
8-
const platform = process.platform;
98
const arch = process.arch === 'arm64' ? 'aarch64' : process.arch;
109
const isProduction = app.isPackaged;
11-
const binName = platform === 'win32' ? `bun.exe` : `bun-${arch}`;
10+
const binName = process.platform === 'win32' ? `bun.exe` : `bun-${arch}`;
1211

1312
const bunPath = isProduction
1413
? path.join(process.resourcesPath, 'bun', binName)
@@ -32,8 +31,8 @@ export const runBunCommand = (
3231
command: string,
3332
options: RunBunCommandOptions,
3433
): Promise<{ stdout: string; stderr: string }> => {
35-
const bunBinary = getBunExecutablePath();
36-
const commandToExecute = replaceCommand(command, bunBinary);
34+
const commandToExecute = getBunCommand(command);
35+
const shell = process.platform === 'win32' ? 'powershell.exe' : 'bash';
3736

3837
return new Promise((resolve, reject) => {
3938
exec(
@@ -44,7 +43,8 @@ export const runBunCommand = (
4443
...options.env,
4544
...process.env,
4645
},
47-
maxBuffer: 1024 * 1024 * 10, // 10MB buffer to handle larger outputs
46+
maxBuffer: 1024 * 1024 * 10,
47+
shell,
4848
},
4949
(error: Error | null, stdout: string, stderr: string) => {
5050
// Call the callbacks with the complete output

apps/studio/electron/main/bun/parse.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ export const replaceCommand = (command: string, newCommand: string): string => {
77
const finalCommand =
88
(packageManagers.includes(cmdName?.toString() || '') ? newCommand : cmdName) || '';
99

10-
// Use shell-quote's quote function to properly handle quoted arguments
10+
// For Windows, add '&' to the command to handle special characters
11+
if (process.platform === 'win32') {
12+
return (
13+
'& ' + quote([finalCommand.toString(), ...cmdArgs.map((arg) => arg?.toString() || '')])
14+
);
15+
}
1116
return quote([finalCommand.toString(), ...cmdArgs.map((arg) => arg?.toString() || '')]);
1217
};

apps/studio/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"productName": "Onlook",
33
"name": "@onlook/studio",
4-
"version": "0.1.45",
4+
"version": "0.1.46",
55
"homepage": "https://onlook.com",
66
"main": "dist-electron/main/index.js",
77
"description": "The first-ever devtool for designers",

apps/studio/src/lib/editor/engine/chat/code.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export class ChatCodeManager {
6363
}
6464

6565
this.chat.suggestions.shouldHide = false;
66+
setTimeout(() => {
67+
this.editorEngine.webviews.reloadWebviews();
68+
}, 500);
6669
sendAnalytics('apply code change');
6770
}
6871

@@ -96,6 +99,9 @@ export class ChatCodeManager {
9699
message.applied = false;
97100
this.chat.conversation.current?.updateMessage(message);
98101
this.chat.conversation.saveConversationToStorage();
102+
setTimeout(() => {
103+
this.editorEngine.webviews.reloadWebviews();
104+
}, 500);
99105
sendAnalytics('revert code change');
100106
}
101107

apps/studio/src/lib/editor/engine/webview/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,10 @@ export class WebviewManager {
182182
this.editorEngine?.ast?.mappings?.remove(id);
183183
this.editorEngine?.errors.clearErrors(id);
184184
}
185+
186+
reloadWebviews() {
187+
for (const webview of this.selected) {
188+
webview.reload();
189+
}
190+
}
185191
}

apps/studio/src/routes/editor/Toolbar/Terminal/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useProjectsManager } from '@/components/Context';
22
import { useTheme } from '@/components/ThemeProvider';
33
import type { RunManager, TerminalMessage } from '@/lib/projects/run';
4-
import { MainChannels, TerminalCommands } from '@onlook/models/constants';
4+
import { MainChannels } from '@onlook/models/constants';
55
import { RunState } from '@onlook/models/run';
66
import { cn } from '@onlook/ui/utils';
77
import { Terminal as XTerm, type ITheme } from '@xterm/xterm';
@@ -96,10 +96,6 @@ const Terminal = observer(({ hidden = false }: TerminalProps) => {
9696

9797
// Set up event listeners
9898
term.onData((data) => {
99-
if (data === TerminalCommands.CTRL_C) {
100-
runner.stop();
101-
return;
102-
}
10399
runner.handleTerminalInput(data);
104100
});
105101

0 commit comments

Comments
 (0)