Jump to content

Snippets not expanding in NValt - if first character [Fixed 3.2.1 b763 pre-release]


Recommended Posts


Snippets work great all over macOS including NValt - except as the first input/first-line-first-characters in a note in NValt. This might seem like an edge case but my problem is that I use NValt for journaling and always insert new journal entries at the top of the journal, starting with todays date by using a snippet. This bug can be reproduced every time, and the work-around is to enter any character and then the snippet, then to remove the extra character. Please note that snippets work fine anywhere else in NValt. Thanks /Mike

Link to comment
Share on other sites

Hi @deanishe, 

Thank you for your reply and input - and you are right, it works fine if you create a new document. So I have to update the bug description, it is a repeatable bug if you try to expand the snippet in an existing text-file in the top left position of the document. So for example: in NValt create a new note, call it test; insert random text; got to top of document; insert a new line (cr); move to the top left position in the document; write snippet - it does not expand the first time


NValt 2.2.7 (125)
macOS 10.12.1 (16B2555
Alfred 3.2 Build 759

Keyword: ddate Snippet: {date}

Link to comment
Share on other sites

I have that option turned on. Makes no difference.


Indeed, I think I've figured out how to provoke the behaviour in any app. It seem that Alfred doesn't handle the DELETE key properly (not BACKSPACE).


Pressing DELETE causes Alfred to stop recognising snippet keywords until you've typed as many characters as times you pressed DELETE or enter a "separator" like SPACE, ENTER etc.


So, if you delete a selection using DELETE (as I habitually do), Alfred will not expand snippets. If you use BACKSPACE (as people with little keyboards that have no DELETE key presumably do), it works as expected.

Edited by deanishe
Link to comment
Share on other sites

1 hour ago, Mikeatalfred said:

Hi @Andrew,

As @deanishe I also have the Mid-string expansion enabled but the problem is still there. But I understand you're already addressing this.

Thanks /Mike 


Not sure this is precisely the same issue as what I found. Which keys are you pressing exactly?


It seems that Alfred also gets confused if you use arrow keys (without any modifiers) to move around in text and it stops recognising snippet keywords until you type a character/separator/BACKSPACE. I suspect you're hitting ↑ (UP arrow), and that's what's causing Alfred to get confused.


If that is the case, Using ⌘↑ (instead of just ↑) should avoid the issue. Also, hitting BACKSPACE (even if there's nothing to delete) gets Alfred working properly again.

Link to comment
Share on other sites

My normal behaviour is this: I go to the top of the file by ⌘-↑, Enter, ↑, and then enter the snippet text as the first text in my new entry. And when this doesn't work, I delete the snippet text by hitting destructive backspace and then the snippet again. And this time it works.


It is a bit tricky with modifier keys plus arrow keys since most are assigned to window management, but alt- seems unassigned and when using it the snippet expands as expected. So I'd say this aligns with what you say.



Link to comment
Share on other sites

@deanishe I'm trying to reproduce this just in TextEdit and an unable to reproduce using the delete key (older wide Apple keyboard) or arrow keys.


1. I'm typing some text, selecting all using cmd+a, pressing 'delete', then snippets are working as expected.

2. I'm typing some text, using up arrow, typing a snippet keyword and it works as expected

3. I'm trying @Mikeatalfred's cmd+up, enter, up, typing a snippet keyword and it works.


hmm :/


If you try in TextEdit, what behaviour do you see?

Link to comment
Share on other sites

@Andrew, maybe you want @deanishe to answer but this is how I reproduce the same error in TextEdit


1. I create a new note (cmd+n)

2. I insert two lines of random text

3. I press cmd+up_arrow (to go to the top left position in the note)

4. I press enter to get a new line at top

5. I press up_arrow to go to the top line

6. I write my snippet ("ddate" which should expand to {date}) and it does not expand


However, if you don't follow this exactly the snippet expands, for example if I only do 1. and 6. it works. Also, when I jumped between this post and TextEdit to write this post, it worked in some situations. 

Link to comment
Share on other sites

I can see what is happening, and it's a combination of Alfred trying to be as efficient as possible (fast rejecting certain scenarios to prevent the Alfred Text Service from using any more CPU than absolutely necessary) and a (probable) macOS bug where the fn key is being passed through as an active mod in the reproducible case above.


Essentially, when following this case, macOS is reporting that the fn key is still depressed when you type the first 'd' of 'ddate', and Alfred is rejecting this.


I've removed this particular 'efficiency' fast fail in the Alfred Text Service and it fixes this issue - I'll be doing a pre-release of 3.2.1 reasonably soon where you'll see the fix :)


Thanks for your help!




Link to comment
Share on other sites

  • Andrew changed the title to Snippets not expanding in NValt - if first character [Accepted]
  • Andrew changed the title to Snippets not expanding in NValt - if first character [Fixed 3.2.1 b763 pre-release]

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...