diff options
| author | Gal Zahavi <[email protected]> | 2025-08-05 14:55:54 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-05 21:55:54 +0000 |
| commit | aacae1de43a202e35ea88ed3ae5829586711f06f (patch) | |
| tree | 621c7452f9995818720f224f0a9e9b76579782b7 /packages/core/src/utils/editor.ts | |
| parent | 8d993156e74b3b57edfd120547beb7ba052b0053 (diff) | |
fix(core): prevent UI shift after vim edit (#5315)
Diffstat (limited to 'packages/core/src/utils/editor.ts')
| -rw-r--r-- | packages/core/src/utils/editor.ts | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/packages/core/src/utils/editor.ts b/packages/core/src/utils/editor.ts index 704d1cbb..f22297df 100644 --- a/packages/core/src/utils/editor.ts +++ b/packages/core/src/utils/editor.ts @@ -164,6 +164,7 @@ export async function openDiff( oldPath: string, newPath: string, editor: EditorType, + onEditorClose: () => void, ): Promise<void> { const diffCommand = getDiffCommand(oldPath, newPath, editor); if (!diffCommand) { @@ -206,10 +207,16 @@ export async function openDiff( process.platform === 'win32' ? `${diffCommand.command} ${diffCommand.args.join(' ')}` : `${diffCommand.command} ${diffCommand.args.map((arg) => `"${arg}"`).join(' ')}`; - execSync(command, { - stdio: 'inherit', - encoding: 'utf8', - }); + try { + execSync(command, { + stdio: 'inherit', + encoding: 'utf8', + }); + } catch (e) { + console.error('Error in onEditorClose callback:', e); + } finally { + onEditorClose(); + } break; } |
