Merge pull request #1612 from marktext/fix-1607

Match keyword not only from the beginning #1607
This commit is contained in:
Ran Luo 2019-11-06 22:46:43 +08:00 committed by GitHub
commit d19d22a643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -175,12 +175,12 @@ class QuickOpenCommand {
_getInclusions = query => { _getInclusions = query => {
// NOTE: This will fail on `foo.m` because we search for `foo.m.md`. // NOTE: This will fail on `foo.m` because we search for `foo.m.md`.
if (MD_EXTENSION.test(query)) { if (MD_EXTENSION.test(query)) {
return [query] return [`*${query}`]
} }
const inclusions = ['*.markdown', '*.mdown', '*.mkdn', '*.md', '*.mkd', '*.mdwn', '*.mdtxt', '*.mdtext', '*.text', '*.txt'] const inclusions = ['*.markdown', '*.mdown', '*.mkdn', '*.md', '*.mkd', '*.mdwn', '*.mdtxt', '*.mdtext', '*.text', '*.txt']
for (let i = 0; i < inclusions.length; ++i) { for (let i = 0; i < inclusions.length; ++i) {
inclusions[i] = `${query}` + inclusions[i] inclusions[i] = `*${query}` + inclusions[i]
} }
return inclusions return inclusions
} }

View File

@ -153,6 +153,9 @@ export default {
} }
}, },
handleInput (event) { handleInput (event) {
if (event.isComposing) {
return
}
// NOTE: We're using keyup to catch "enter" key but `ctrlKey` // NOTE: We're using keyup to catch "enter" key but `ctrlKey`
// etc doesn't work here. // etc doesn't work here.
switch (event.key) { switch (event.key) {