feat(nvim-tree): incorrect double click detection

This commit is contained in:
Pihkaal
2024-09-13 14:30:47 +02:00
parent 7b9c438f02
commit d1ffa224a0

View File

@@ -16,21 +16,17 @@ export const NvimTreeChild = (props: {
const handleClick = () => { const handleClick = () => {
props.onSelect(props.y); props.onSelect(props.y);
if (lastClick) { if (lastClick && Date.now() - lastClick <= 500) {
if (Date.now() - lastClick <= 500) { props.onOpen(props.child);
props.onOpen(props.child);
}
setLastClick(undefined);
} else {
setLastClick(Date.now());
} }
setLastClick(Date.now());
}; };
return ( return (
<li <li
style={{ background: props.selected ? "#504651" : "" }} style={{ background: props.selected ? "#504651" : "" }}
onMouseDown={handleClick} onClick={handleClick}
> >
{" "} {" "}
{props.inDirectory && ( {props.inDirectory && (