Jump to content

Can't paste into Alfred Search Bar if clipboard has trailing new line?


Recommended Posts

I'd like to be able to paste the clipboard contents into the Alfred search bar

 

I've tried of course, but it doesn't work if the clipboard contents have a trailing new line.


This works in Spotlight, and other similar omnibox style searches (eg Chrome)

 

Is there anyway to enable this feature? Note I am a registered PowerPack user.

 

Thanks,

 

Brad

 

 

Link to comment

@brad parks Are you sure it isn't just that the first line of the text you're pasting is showing "above" your content and the trailing new line is causing you to only see the blank row?

 

For example, I've copied from your post the following:

"Thanks,

[newline]"

 

So in Alfred, I see the following when pasting:

Screenshot 2021-06-15 at 13.09.23.png

 

The text and the new line is there, but the word "Thanks," is not visible as I've pasted more than one line.

 

Spotlight just seems to remove the new line.

 

Can you describe what you're trying to achieve specifically?

 

Cheers,
Vero

Link to comment

I tried, and as you suggested it's there, but it doesnt really help me, I guess.

 

Why? With Spotlight and Chrome, I use the search field as a mini clipboard editor, pasting in the contents of what's on the clipboard, and massaging it before I do an Alfred search. 

 

For example, if I had "endoplasmic reticulum" on the clipboard, then I might want to paste it, then put "define" before it, which I would do in the search field.

 

I tried to use the arrow keys to navigate "up" to the text, but it wont let me, it just goes through the Search options displayed in the drop down list.

 

Is there anyway to achieve this?

Link to comment

Cool, lol... that works.... thanks!

 

Though I do think it's realistically at least a feature request, since Chrome, and Spotlight do this by default, as it's unintuitive, and if there's more than one trailing backspace, you have to delete them all, one by one..

 

e.g. the following requires multiple backspaces to get to the real text, which, when copying and pasting, can happen quite often of course


 

test











 

Link to comment
1 hour ago, brad parks said:

Though I do think it's realistically at least a feature request, since Chrome, and Spotlight do this by default, as it's unintuitive, and if there's more than one trailing backspace, you have to delete them all, one by one

 

Alfred's input box isn't only for searching. You might be using a workflow to base64-encode some text, or append text to a file, or any number of other things where it would be inappropriate for Alfred to alter your input.

 

1 hour ago, brad parks said:

then put "define" before it, which I would do in the search field

 

⌘↑ moves the cursor to the start of the input, and define, like other search features, does trim trailing whitespace before performing the search.

 

define-test.gif.72062b86c74ec9ffff0158b376504eb1.gif

 

If you must remove the whitespace, you could create a Hotkey, say ⌥⌘V, that takes the clipboard content, trims whitespace with a Transform utility, then pastes the trimmed text.

Edited by deanishe
Link to comment

Thanks again for the feedback! I do suspect that 99% of people pasting into the Alfred search field would expect it to trim trailing new lines at the least - I tried it in chrome, Spotlight and Safari, and it trims leading and trailing new lines as well.

 

This could easily be a feature that's toggled off or on in preferences somewhere, and would give the best of both worlds.

 

and for sure I could do as you suggest, and may do so, it's just to me an "out of the box" feature that was unexpected, since that's a common workflow. I just tested it in Safari as well, and it does the automatic trimming as well, fwiw.

Link to comment
21 minutes ago, brad parks said:

I tried it in chrome, Spotlight and Safari, and it trims leading and trailing new lines as well.

 

None of those are designed to accept arbitrary text input. Alfred is.

 

There are many workflows that depend on Alfred not trimming the query for correct behaviour. Is it reasonable to break a bunch of existing workflows to solve an inconvenience?

 

33 minutes ago, brad parks said:

This could easily be a feature that's toggled off or on in preferences somewhere, and would give the best of both worlds.

 

How easy it is to do isn't as important as the effects it would have.

 

There already is a "trim whitespace" toggle, but it's at the individual feature/workflow level because different features have different requirements. As you can see from the GIF, trailing whitespace makes no difference to querying the dictionary or contacts database. Every Script Filter has a toggle to tell Alfred to trim whitespace or not. A global "trim whitespace" toggle would likely break a lot of them, and adding a feature that might break stuff is a huge deal.

 

Link to comment

@brad parks It’s worth noting @deanishe’s suggestion can be even more convenient than what you’re asking for.

 

Even if the newline were stripped on paste, you’d still have to do two steps: invoke Alfred and paste.

 

With the Workflow solution, you can press a hotkey (one step) that will trim the whitespace of what you have in your clipboard and open it in Alfred’s prompt, ready for you to edit.

Link to comment
15 hours ago, brad parks said:

I do suspect that 99% of people pasting into the Alfred search field would expect it to trim trailing new lines at the least

 

By design, we don't manipulate your input; What you might think is convenient (removing trailing spaces) will likely break someone else's work flow (or their workflows too!) 

 

Spotlight is limited to search and Safari is limited to URLs, so they're very much single-purpose fields, while Alfred's input box can be used for much more.  :) 

Link to comment

thanks again for the feedback, and of course please feel free to not do anything about it 😉  ! - i just know that 99% of people, pasting something into a field like that, from experience with things like Safari, Chrome, etc, into a single line search field, would expect it to be trimmed - especially if there's no other text in the search field at that time

 

Of course Alfred could implement this as a feature, by putting a checkbox in preferences somewhere that said "Trim leading and trailing characters from input on paste into search field", which you could have disabled by default.

 

I of course will just implement as suggested above, a custom workflow to trim it before I paste - it was just unexpected is all, and it made me think twice before purchasing the power pack, as that's a very common pattern for me, and is a very common entry point for many I'm sure - copying text, and pasting it into a search box. You of course have backwards compatibility to think of, but may be costing yourself power pack users if they think this common flow is broken. The checkbox in preferences would address both cases, and could be left as "off" if there's an existing Alfred install.

Link to comment
1 hour ago, brad parks said:

i just know that 99% of people

 

So you keep saying, but how do you know that? Truthfully, isn’t it the case that you feel it?

 

1 hour ago, brad parks said:

that's a very common pattern for me, and is a very common entry point for many I'm sure

 

Respectfully, I believe you’re falling into a common pattern of projecting your preferences and believing they are more common than they are.

 

Consider that besides yourself, all three people on this thread have been monitoring this forum for a decade, and each of us reads pretty much every post. Yet, despite numerous feature requests over the years, we haven’t linked you to previous discussion on this topic. Because there are no legions of users clamouring for automatic trimming. You care about this; most people don’t. Which is fine, that’s what Workflows are for, to enable you to create your own experience. But to do that Alfred needs to be flexible, and in this situation it means not auto trimming what’s pasted into its search box.

 

1 hour ago, brad parks said:

The checkbox in preferences would address both cases, and could be left as "off" if there's an existing Alfred install.

 

We all understand your request. But it’s one that needs to be thought through because it is a very specific solution with possible undesirable ramifications. Alfred continues to evolve. Maybe a future Alfred feature which does something different can be adapted to do something close to what you ask without the consequences of the preference toggle. But the Workflow option is pretty good. And you may make it even better:

 

Have your new hotkey do what we discussed plus press ⌘a, meaning your text will be preselected. Then you use that hotkey as your primary way of calling Alfred and your trimmed clipboard contents will always be on hand. When that’s not what you want you can just start typing to overwrite it.

Link to comment

lol - please feel free to do whatever you want of course - I mention it because I feel it is a common use case - others may not have reported it, but I'm sure that not every use case gets reported - most people are too lazy to report things - I'm a full time developer, for over 30 years, so I thought I'd mention it

 

No worries! Do as you will!

 

Thanks again for the feedback,

 

Brad

Link to comment
1 hour ago, brad parks said:

I just believe it could be done so it wouldn't affect existing users, as I detailed above

 

But we already told you that your global toggle would break other users' stuff…? To be clear: that's not a suspicion, it's a fact.

Link to comment
7 hours ago, brad parks said:

Of course Alfred could implement this as a feature, by putting a checkbox in preferences somewhere that said "Trim leading and trailing characters from input on paste into search field", which you could have disabled by default.

 

8 hours ago, brad parks said:

The checkbox in preferences would address both cases, and could be left as "off" if there's an existing Alfred install.

 

The above would work - there's no reason it wouldn't - I'm sure you've introduced features over the last 10 years that have changed how an existing feature works, but used configuration to force it to, by default, behave as it already did for existing users?

Link to comment
35 minutes ago, brad parks said:

I'm sure you've introduced features over the last 10 years that have changed how an existing feature works, but used configuration to force it to, by default, behave as it already did for existing users

 

Not that I recall. Perhaps the Workflow transition from Alfred 1 to Alfred 2? Every case I remember is either a deprecation (i.e. it still works it just doesn’t get any more updates) replaced by something better or an outright change with no toggle back (though again, I’m uncertain).


But the point here is different. The toggle would be a change in one place which would break a different feature and only sometimes. That would be a recipe for bug reports.


To be clear, the argument as I’m making it is not necessarily that a toggle shouldn’t be added, but that doing just that would be insufficient. The solution should either be something difference or it needs some addition to what you’ve already mentioned to make it robust. That’s what’s at the core of our inquiries, to find what would work for you and also for the majority of Alfred users.

 

Do note that @Vero and @Andrew have the final word on what goes into Alfred; it’s their app. And they choose carefully, so we should be methodical about feature requests to get at the heart of what’s important and what has a tradeoff which isn’t worth it.

 

Finally, forgive me but I’ve been wanting to post this image for a while now. I mean absolutely nothing by it except “there’s an XKCD for everything” and this one I find particularly funny and think it fits the thread.

 

workflow.png

 

Alt text: There are probably children out there holding down spacebar to stay warm in the winter! YOUR UPDATE MURDERS CHILDREN.

Link to comment

agreed - backwards compatibility for an app that supports a pay by version model is super important, and you couldn't just implement the toggle, it'd have to consider existing users more importantly than new users, imho... I just think it could work, lol! and yes, the XKCD works for this particular scenario, haha

 

13 minutes ago, vitor said:

To be clear, the argument as I’m making it is not necessarily that a toggle shouldn’t be added, but that doing just that would be insufficient.

 

Link to comment

 

2 hours ago, brad parks said:

The above would work - there's no reason it wouldn't

 

Sure. Right up until the user finds and installs a workflow that isn't compatible with that option. And then they'll ask for support. (And likely also want to know why Alfred has a setting that breaks workflows.)

 

2 hours ago, brad parks said:

I'm sure you've introduced features over the last 10 years that have changed how an existing feature works

 

Change, yes. But never break. In the 8 or so years I've been on the forum, Andrew has consistently rejected any feature request that is not fully backwards compatible.

 

A much more viable option than altering input, imo, would be for Alfred to display line breaks differently in the input box, say as <LF> in a different colour, so the input is all on one line and always visible.

Edited by deanishe
Link to comment

 

28 minutes ago, deanishe said:

A much more viable option than altering input, imo, would be for Alfred to display line breaks differently in the input box, say as <LF> in a different colour, so the input is all on one line and always visible.

 

as you suggest, maybe the display option would be the best overall way to "fix" this for Alfred - displays differently but doesn't change the input directly.

 

All I can say is pasting clipboard text that has a trailing new line is unintuitive as is - most people wouldn't know their text had pasted there at all, and would think it was broken, imho

Link to comment

I was thinking about this a bit more, and is there any workflow that would be broken if the search field is empty, and the input text was trimmed ?

 

So the toggle option would be the following:

 

[ ] Trim pasted text, if search field is empty

 

This assumes of course that no workflow is active if the search field is empty, which may not be true, lol!

Link to comment

Alfred doesn't trim by design, and I won't be adding an option to trim pasted text by default for all of the discussed reasons. This is the first time this request has come up, so it's a highly specific use case.

 

With workflows, you have full control over how Alfred is shown, and you could create a simple workflow with a hotkey trigger connected to a Transform utility to trim, connected to a Show Alfred which will achieve exactly what you need. Let me know if you need more guidance with this.

 

Having said that, I fully agree that improvements can be made to visually indicate that the input field has hidden text when there is a trailing space. I've made an internal note to look into this in the future.

 

Cheers,

Andrew

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...