Fix caching mix in directive parsing

The directive parsing code was never using its cache.  The value type
was different between the store and load operations causing it to miss
every time.  Switched to a named key to prevent future confusion and
added a unit test

closes #1366
Merge remote-tracking branch 'origin/master' into fixes-1364
Cancel incremental search on mode change

closes #1364