feat: make it easier to toggle on/off paste summary in the tui (#24869)
This commit is contained in:
@@ -301,6 +301,9 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
|
|||||||
renderer.clearSelection()
|
renderer.clearSelection()
|
||||||
}
|
}
|
||||||
const [terminalTitleEnabled, setTerminalTitleEnabled] = createSignal(kv.get("terminal_title_enabled", true))
|
const [terminalTitleEnabled, setTerminalTitleEnabled] = createSignal(kv.get("terminal_title_enabled", true))
|
||||||
|
const [pasteSummaryEnabled, setPasteSummaryEnabled] = createSignal(
|
||||||
|
kv.get("paste_summary_enabled", !sync.data.config.experimental?.disable_paste_summary),
|
||||||
|
)
|
||||||
|
|
||||||
// Update terminal window title based on current route and session
|
// Update terminal window title based on current route and session
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
@@ -736,6 +739,19 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
|
|||||||
dialog.clear()
|
dialog.clear()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: pasteSummaryEnabled() ? "Disable paste summary" : "Enable paste summary",
|
||||||
|
value: "app.toggle.paste_summary",
|
||||||
|
category: "System",
|
||||||
|
onSelect: (dialog) => {
|
||||||
|
setPasteSummaryEnabled((prev) => {
|
||||||
|
const next = !prev
|
||||||
|
kv.set("paste_summary_enabled", next)
|
||||||
|
return next
|
||||||
|
})
|
||||||
|
dialog.clear()
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: kv.get("session_directory_filter_enabled", true)
|
title: kv.get("session_directory_filter_enabled", true)
|
||||||
? "Disable session directory filtering"
|
? "Disable session directory filtering"
|
||||||
|
|||||||
@@ -1209,7 +1209,7 @@ export function Prompt(props: PromptProps) {
|
|||||||
const lineCount = (pastedContent.match(/\n/g)?.length ?? 0) + 1
|
const lineCount = (pastedContent.match(/\n/g)?.length ?? 0) + 1
|
||||||
if (
|
if (
|
||||||
(lineCount >= 3 || pastedContent.length > 150) &&
|
(lineCount >= 3 || pastedContent.length > 150) &&
|
||||||
!sync.data.config.experimental?.disable_paste_summary
|
kv.get("paste_summary_enabled", !sync.data.config.experimental?.disable_paste_summary)
|
||||||
) {
|
) {
|
||||||
pasteText(pastedContent, `[Pasted ~${lineCount} lines]`)
|
pasteText(pastedContent, `[Pasted ~${lineCount} lines]`)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user