diff --git a/apps/desktop/src-tauri/Cargo.lock b/apps/desktop/src-tauri/Cargo.lock index bc060a7..736c026 100644 --- a/apps/desktop/src-tauri/Cargo.lock +++ b/apps/desktop/src-tauri/Cargo.lock @@ -1130,8 +1130,6 @@ dependencies = [ "libc", "libgit2-sys", "log", - "openssl-probe", - "openssl-sys", "url", ] @@ -1792,9 +1790,7 @@ checksum = "c9b3acc4b91781bb0b3386669d325163746af5f6e4f73e6d2d630e09a35f3487" dependencies = [ "cc", "libc", - "libssh2-sys", "libz-sys", - "openssl-sys", "pkg-config", ] @@ -1818,20 +1814,6 @@ dependencies = [ "libc", ] -[[package]] -name = "libssh2-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220e4f05ad4a218192533b300327f5150e809b54c4ec83b5a1d91833601811b9" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", -] - [[package]] name = "libz-sys" version = "1.1.23" @@ -2286,24 +2268,6 @@ dependencies = [ "pathdiff", ] -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - -[[package]] -name = "openssl-sys" -version = "0.9.111" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" diff --git a/apps/desktop/src/components/claude-chat/chat-messages.tsx b/apps/desktop/src/components/claude-chat/chat-messages.tsx index 87ab63b..a7a8600 100644 --- a/apps/desktop/src/components/claude-chat/chat-messages.tsx +++ b/apps/desktop/src/components/claude-chat/chat-messages.tsx @@ -266,7 +266,10 @@ const UserMessage: FC<{ message: ClaudeStreamMessage }> = ({ message }) => { )} {contextLabel && bodyText &&
} - {bodyText} + ); diff --git a/apps/desktop/src/components/workspace/editor/latex-editor.tsx b/apps/desktop/src/components/workspace/editor/latex-editor.tsx index 4ab8691..399d869 100644 --- a/apps/desktop/src/components/workspace/editor/latex-editor.tsx +++ b/apps/desktop/src/components/workspace/editor/latex-editor.tsx @@ -100,6 +100,9 @@ export function LatexEditor() { const [mergeChunkInfo, setMergeChunkInfo] = useState({ total: 0, current: 0 }); const [diagnostics, setDiagnostics] = useState([]); const [selectionCoords, setSelectionCoords] = useState<{ top: number; left: number } | null>(null); + // When the selection toolbar is visible, prevent CM selection changes from clearing it. + // Only explicit dismiss/send/action should clear the toolbar. + const toolbarStickyRef = useRef(false); const parentRef = useRef(null); const { resolvedTheme } = useTheme(); @@ -335,12 +338,12 @@ export function LatexEditor() { if (update.selectionSet) { const { from, to, head } = update.state.selection.main; setCursorPosition(head); - setSelectionRange(from !== to ? { start: from, end: to } : null); // Compute toolbar position below the selection end // Skip toolbar for "select all" (Cmd+A) to avoid overlay issues const isSelectAll = from === 0 && to === update.state.doc.length; if (from !== to && !isSelectAll) { + setSelectionRange({ start: from, end: to }); const startCoords = update.view.coordsAtPos(from); const endCoords = update.view.coordsAtPos(to); if (endCoords && startCoords) { @@ -349,7 +352,12 @@ export function LatexEditor() { left: startCoords.left, // aligned to selection start }); } - } else { + toolbarStickyRef.current = true; + } else if (!toolbarStickyRef.current) { + // Only clear selection/coords if the toolbar is not being interacted with. + // Clicking the toolbar input causes CM to lose focus and collapse the selection, + // but we want to keep the toolbar visible until explicitly dismissed. + setSelectionRange(null); setSelectionCoords(null); } } @@ -647,10 +655,12 @@ export function LatexEditor() { const handleToolbarSendPrompt = useCallback( (prompt: string) => { + toolbarStickyRef.current = false; setSelectionCoords(null); + setSelectionRange(null); useClaudeChatStore.getState().sendPrompt(prompt); }, - [], + [setSelectionRange], ); const editorToolbarActions: ToolbarAction[] = useMemo(() => [ @@ -659,17 +669,21 @@ export function LatexEditor() { const handleToolbarAction = useCallback( (actionId: string) => { + toolbarStickyRef.current = false; setSelectionCoords(null); + setSelectionRange(null); if (actionId === "proofread") { useClaudeChatStore.getState().sendPrompt("Proofread and fix any errors in this text"); } }, - [], + [setSelectionRange], ); const handleToolbarDismiss = useCallback(() => { + toolbarStickyRef.current = false; setSelectionCoords(null); - }, []); + setSelectionRange(null); + }, [setSelectionRange]); // History review action handlers const handleHistoryRestore = useCallback(async () => {