mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
fix
This commit is contained in:
parent
acd711f93b
commit
f75dee39b3
2 changed files with 10 additions and 10 deletions
|
|
@ -132,9 +132,8 @@ const VoidCommandBar = ({ uri, editor }: { uri: URI | null, editor: ICodeEditor
|
|||
|
||||
|
||||
|
||||
if (sortedCommandBarURIs.length === 0) return null // if there are absolutely no changes
|
||||
|
||||
const navPanel = <div
|
||||
// if there are *any* changes at all
|
||||
const navPanel = sortedCommandBarURIs.length !== 0 && <div
|
||||
className={`pointer-events-auto flex items-center gap-2 p-2 ${isFocused ? 'ring-1 ring-[var(--vscode-focusBorder)]' : ''}`}
|
||||
onFocus={() => setIsFocused(true)}
|
||||
onBlur={() => setIsFocused(false)}
|
||||
|
|
@ -192,7 +191,7 @@ const VoidCommandBar = ({ uri, editor }: { uri: URI | null, editor: ICodeEditor
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
// accept/reject if current URI has changes
|
||||
const onAcceptAll = () => {
|
||||
if (!uri) return
|
||||
editCodeService.acceptOrRejectAllDiffAreas({ uri, behavior: 'accept', removeCtrlKs: false, _addToHistory: true })
|
||||
|
|
@ -238,8 +237,8 @@ const VoidCommandBar = ({ uri, editor }: { uri: URI | null, editor: ICodeEditor
|
|||
</div>
|
||||
|
||||
|
||||
return <>
|
||||
return <div className='p-2'>
|
||||
{navPanel}
|
||||
{acceptRejectButtons}
|
||||
</>
|
||||
</div>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ export class VoidCommandBarService extends Disposable implements IVoidCommandBar
|
|||
return sortedDiffIds;
|
||||
}
|
||||
|
||||
_getDiffZoneChanges(currentDiffZones: Iterable<string>, oldDiffZones: Iterable<string>) {
|
||||
_getDiffZoneChanges(oldDiffZones: Iterable<string>, currentDiffZones: Iterable<string>) {
|
||||
// Find the added or deleted diffZones by comparing diffareaids
|
||||
const addedDiffZoneIds = new Set<string>();
|
||||
const deletedDiffZoneIds = new Set<string>();
|
||||
|
|
@ -375,18 +375,19 @@ class AcceptRejectAllFloatingWidget extends Widget implements IOverlayWidget {
|
|||
// Mount command bar using mountVoidCommandBar
|
||||
this.instantiationService.invokeFunction(accessor => {
|
||||
|
||||
type Props = { uri: URI | null, editor: ICodeEditor }
|
||||
const uri = editor.getModel()?.uri || null
|
||||
const res = mountVoidCommandBar(root, accessor, { uri, editor })
|
||||
const res = mountVoidCommandBar(root, accessor, { uri, editor } satisfies Props)
|
||||
if (!res) return
|
||||
|
||||
const dispose = res.dispose
|
||||
const rerender: (o: { uri: URI | null }) => void = res.rerender
|
||||
const rerender: (o: Props) => void = res.rerender
|
||||
|
||||
this._register(toDisposable(() => dispose?.()))
|
||||
|
||||
this._register(editor.onDidChangeModel((model) => {
|
||||
const uri = model.newModelUrl
|
||||
rerender({ uri })
|
||||
rerender({ uri, editor })
|
||||
}))
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue