mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
selection bug fix
This commit is contained in:
parent
3621bb63f4
commit
b5dff4cf0f
1 changed files with 7 additions and 4 deletions
|
|
@ -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)}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue