Merge pull request #50 from ueokande/fix-console-tokenizer
fix buffer commands
This commit is contained in:
		
						commit
						331b704d24
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -42,14 +42,18 @@ const winopenCommand = (url) => {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
const bufferCommand = (keywords) => {
 | 
			
		||||
  if (keywords.length === 0) {
 | 
			
		||||
    return Promise.resolve([]);
 | 
			
		||||
  }
 | 
			
		||||
  let keywordsStr = keywords.join(' ');
 | 
			
		||||
  return browser.tabs.query({
 | 
			
		||||
    active: true, currentWindow: true
 | 
			
		||||
  }).then((gotTabs) => {
 | 
			
		||||
    if (gotTabs.length > 0) {
 | 
			
		||||
      if (isNaN(keywords)) {
 | 
			
		||||
        return tabs.selectByKeyword(gotTabs[0], keywords);
 | 
			
		||||
      if (isNaN(keywordsStr)) {
 | 
			
		||||
        return tabs.selectByKeyword(gotTabs[0], keywordsStr);
 | 
			
		||||
      }
 | 
			
		||||
      let index = parseInt(keywords, 10) - 1;
 | 
			
		||||
      let index = parseInt(keywordsStr, 10) - 1;
 | 
			
		||||
      return tabs.selectAt(index);
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue