Skip to content

Commit

Permalink
fix(text): make getSelectedText an empty string if it's only a newline
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed Nov 28, 2024
1 parent b98cd81 commit 63effe8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ global.getSelectedText = async () => {

await sendWait(Channel.KEYBOARD_COPY)

return await global.paste()
const result = await global.paste()

if (result?.replace(/[\r\n]/g, "") === "") {
return ""
}

return result
}

/**
Expand Down

0 comments on commit 63effe8

Please sign in to comment.