Hello! Is it possible to preserve leading spaces when pasting in text? Sometimes I like to be able to paste in code. I think (but am not super sure) that this used to work.
I don’t think there’s anything built in.
I think the default behavior of 4 spaces/tab is converted to indentation is right, but I’m also open to adding an option that doesn’t convert whitespace to indentation. Any thoughts on where to put this option… any other apps do this?
Another alternative would be to use Shortcut Actions or AppleScript. It should be pretty easy to just split lines of text on pasteboard and then create rows for those. Anyway let me know how you think this feature should work, I’ll see if it makes sense to me, and will try to add.
Ah! I see, what happened was that:
- previously I pasted in some code with four spaces of indentation, so I thought that Bike preserved indentation (although it was actually creating an outline)
- this time I pasted in code with two spaces of indentation, and Bike removes the leading spaces
A workaround for me is I could convert the code I’m about to paste to four spaces of indentation before pasting into Bike. If there were a setting where I could replace 4 with 2, that’d be perfect for me, but it seems like it might be a niche feature.
Re: examples, TextEdit and Terminal don’t support configuring it, so I’m not sure where the option would live.
Another alternative would be to use Shortcut Actions or AppleScript. It should be pretty easy to just split lines of text on pasteboard and then create rows for those.
Interesting, how would this work? To paste in rows, would the AppleScript have to create Bike HTML when pasting?
No, should be a lot easier than that.
I think this pretty much does what you want. Give it a try and let me know if this is behavior you are looking for.
set listContents to get the clipboard
set delimitedList to paragraphs of listContents
tell application "Bike"
tell front document
repeat with each in delimitedList
set selectionRow to selection row
select at (make row at (after selectionRow) with properties {name:each})
end repeat
end tell
end tell
Thanks so much for getting back to me! Unfortunately I hit the following error running the AppleScript you sent:
error "Bike got an error: Can’t make missing value into type specifier." number -1700 from missing value to specifier
I am running Bike 1.12. I think I get the idea though and don’t want to take up more of your time—I’ll play around with the AppleScript. Thank you!
Can’t make missing value into type specifier." number -1700 from missing value to specifier
That only happens here if I don’t have a front document open in Bike.
Otherwise, each line of the current (textual) clipboard contents is pasted with its leading space into the frontmost of the documents that are open in Bike.