selection bug fix

This commit is contained in:
Mathew Pareles 2025-01-08 03:04:19 -08:00
parent 3621bb63f4
commit b5dff4cf0f

View file

@ -284,8 +284,6 @@ export const SelectedFiles = (
const isThisSelectionOpened = !!(selection.selectionStr && selectionIsOpened[i]) const isThisSelectionOpened = !!(selection.selectionStr && selectionIsOpened[i])
const isThisSelectionAFile = selection.selectionStr === null const isThisSelectionAFile = selection.selectionStr === null
return ( return (
<div key={i} // container for `selectionSummary` and `selectionText` <div key={i} // container for `selectionSummary` and `selectionText`
className={`${isThisSelectionOpened ? 'w-full' : ''}`} className={`${isThisSelectionOpened ? 'w-full' : ''}`}
@ -332,7 +330,7 @@ export const SelectedFiles = (
<span <span
className='cursor-pointer hover:bg-vscode-toolbar-hover-bg rounded-md z-1' className='cursor-pointer hover:bg-vscode-toolbar-hover-bg rounded-md z-1'
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation(); // don't open/close selection
if (type !== 'staging') return; if (type !== 'staging') return;
setStaging([...selections.slice(0, i), ...selections.slice(i + 1)]) setStaging([...selections.slice(0, i), ...selections.slice(i + 1)])
setSelectionIsOpened(o => [...o.slice(0, i), ...o.slice(i + 1)]) setSelectionIsOpened(o => [...o.slice(0, i), ...o.slice(i + 1)])
@ -361,7 +359,12 @@ export const SelectedFiles = (
</div> </div>
{/* selection text */} {/* selection text */}
{isThisSelectionOpened && {isThisSelectionOpened &&
<div className='w-full px-1 rounded-sm border-vscode-editor-border'> <div
className='w-full px-1 rounded-sm border-vscode-editor-border'
onClick={(e) => {
e.stopPropagation(); // don't focus input box
}}
>
<BlockCode <BlockCode
initValue={selection.selectionStr!} initValue={selection.selectionStr!}
language={getLanguageFromFileName(selection.fileURI.path)} language={getLanguageFromFileName(selection.fileURI.path)}