You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A dictation after "(", a quote, "@" or "#" is pasted with a stray leading space #333
InsertionSeparator.withLeadingSeparator adds a space before the transcript whenever the character before the caret is not whitespace. That is right after a word or a sentence end. It is wrong after an opening bracket or quote, or after a prefix the user just typed for the dictated word, where no space belongs:
Typed before the caret
Dictated
Pasted result
Call me (
"maybe tomorrow"
Call me ( Maybe tomorrow.
She said " / She said “
…
She said " Maybe tomorrow.
ping @
a name
ping @ Maybe…
post in #
a channel
post in # Maybe…
a [
…
a [ Maybe…
price: $
an amount
price: $ Maybe…
~/
a path
~/ Maybe…
The Mac paste path (KeyInjector) and the iOS keyboard (KeyboardModel+Phase.swift) both use this function, so both platforms are affected.
Related but different: #206 (#206) and #208 (#208) were about the same-window fallback adding a space when the caret had moved. This report is about the separator rule itself, when the text before the caret is known.
Repro
On main (6739585), add to Tests/BlurtEngineTests/ and run DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer swift test --filter SeparatorOpeners:
importTesting@testableimportBlurtEngine@Suite("SeparatorOpeners")structSeparatorOpenersTests{@Test(arguments:["Call me (","She said \"","She said “","ping @","post in #","a ["])funcnoSpaceAfterAnOpener(prior:String){
#expect(InsertionSeparator.withLeadingSeparator("Maybe tomorrow.",after:prior)=="Maybe tomorrow.")}}
Expected
No separator after an opening bracket, an opening quote, or @/#: Call me (Maybe tomorrow.
Actual
Every case gets a leading space:
prior=[Call me (] pasted=[Call me ( Maybe tomorrow.]
prior=[She said "] pasted=[She said " Maybe tomorrow.]
prior=[ping @] pasted=[ping @ Maybe tomorrow.]
prior=[post in #] pasted=[post in # Maybe tomorrow.]
Suggested fix
Skip the separator when the last character of the prior text is an opener:
Treat a straight " or ' as an opener only when the character before it is whitespace or the start of the text, so a closing quote still gets its space. With the simple version above, the existing InsertionSeparator and KeyInjector suites still pass. Which prefixes count ($, /, -) is a judgment call for the maintainers. Brackets, opening quotes, @ and # are the clear cases.
Activity