Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Dropdown trigger does not work for first "word" #25

Closed
repagh opened this issue Mar 5, 2016 · 2 comments
Closed

Dropdown trigger does not work for first "word" #25

repagh opened this issue Mar 5, 2016 · 2 comments

Comments

@repagh
Copy link

repagh commented Mar 5, 2016

I am trying to use smart-area to fill in some pre-existing words in a logic equation. This works, but only if the word I am typing in is not in the first location.

At line 371 in smart-area.js I find:

var searchable = text.substr(0, position),
                            match, found = false, lastPosition = 0;
while ((match = element.trigger.exec(searchable)) !== null){
                            if(match.index === lastPosition){
                                break;
                            }
                            lastPosition = match.index;
                            if(match.index + match[0].length === position){
                                found = true;
                                break;
                            }
                        }

When the trigger matches on the first word, lastPosition is 0, and processing stops. I am trying the initialization lastPosition = -1, and this works, but I don't know if this breaks anything else.

Another thing I noted is that searchable is not changed in the while loop, so the while test result never changes, were you intending something else for this, like finding all matches until arriving at the cursor position?

@ghost
Copy link

ghost commented Mar 11, 2016

this is already resolved but pending to publish. author will publish it as soon as he get chance. see it #24

@aurbano
Copy link
Owner

aurbano commented Mar 19, 2016

@repagh thanks for reporting the issue, as @krishnal mentioned, the last version should fix this issue.

@aurbano aurbano closed this as completed Mar 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants