fix completion

jh-changes
Shin'ya Ueoka 7 years ago
parent 73a4fe0bb1
commit ee9359c138
  1. 3
      src/background/index.js
  2. 9
      src/console/console.js
  3. 3
      src/console/console.scss

@ -90,7 +90,8 @@ browser.runtime.onMessage.addListener((request, sender) => {
return { return {
caption: tab.title, caption: tab.title,
content: tab.title, content: tab.title,
url: tab.url url: tab.url,
icon: tab.favIconUrl
} }
}); });
return { return {

@ -43,7 +43,7 @@ const completeNext = () => {
} }
let input = window.document.querySelector('#vimvixen-console-command-input'); let input = window.document.querySelector('#vimvixen-console-command-input');
input.value = completionOrigin + item.content; input.value = completionOrigin + ' ' + item.content;
} }
const completePrev = () => { const completePrev = () => {
@ -56,7 +56,7 @@ const completePrev = () => {
} }
let input = window.document.querySelector('#vimvixen-console-command-input'); let input = window.document.querySelector('#vimvixen-console-command-input');
input.value = completionOrigin + item.content; input.value = completionOrigin + ' ' + item.content;
} }
const handleKeydown = (e) => { const handleKeydown = (e) => {
@ -80,6 +80,9 @@ const handleKeydown = (e) => {
}; };
const handleKeyup = (e) => { const handleKeyup = (e) => {
if (e.keyCode === KeyboardEvent.DOM_VK_TAB) {
return;
}
if (e.target.value === prevValue) { if (e.target.value === prevValue) {
return; return;
} }
@ -157,7 +160,7 @@ const setCompletions = (completions) => {
window.completion = new Completion(flatten); window.completion = new Completion(flatten);
let input = window.document.querySelector('#vimvixen-console-command-input'); let input = window.document.querySelector('#vimvixen-console-command-input');
completionOrigin = input.value; completionOrigin = input.value.split(' ')[0];
} }
messages.receive(window, (message) => { messages.receive(window, (message) => {

@ -8,6 +8,7 @@ body {
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
overflow: hidden;
} }
.vimvixen-console { .vimvixen-console {
@ -38,7 +39,9 @@ body {
&-item { &-item {
padding-left: 1.5rem; padding-left: 1.5rem;
background-position: 0 center; background-position: 0 center;
background-size: contain;
background-repeat: no-repeat; background-repeat: no-repeat;
white-space: nowrap;
&-caption { &-caption {
display: inline-block; display: inline-block;