diff --git a/.gitignore b/.gitignore index 2075e1c8..59bc4656 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,5 @@ VendorLib/Breakpad/src/tools/mac/dump_syms/build DerivedData VendorLib/clang/lib/arc VendorLib/clang/lib/c++ + +.idea \ No newline at end of file diff --git a/src/js/sandbox/commands.js b/src/js/sandbox/commands.js index 3e04cf97..16c348d8 100644 --- a/src/js/sandbox/commands.js +++ b/src/js/sandbox/commands.js @@ -193,6 +193,7 @@ var getAllCommands = function() { return allCommands; }; +exports.getAllCommands = getAllCommands; exports.instantCommands = instantCommands; exports.parse = util.genParseCommand(regexMap, 'processSandboxCommand'); diff --git a/src/js/views/commandViews.js b/src/js/views/commandViews.js index b47d4bfa..cd00249d 100644 --- a/src/js/views/commandViews.js +++ b/src/js/views/commandViews.js @@ -1,4 +1,5 @@ var Backbone = require('backbone'); +const {getAllCommands} = require('../sandbox/commands'); var Main = require('../app'); var CommandLineStore = require('../stores/CommandLineStore'); @@ -49,13 +50,26 @@ var CommandPromptView = Backbone.View.extend({ }, onKeyDown: function(e) { - // If its a tab, prevent losing focus + var el = e.target; + + const shadowEl = document.querySelector('#shadow'); + const uc = el.value.replace(/ {2,}/g, ' '); + shadowEl.innerHTML = ''; + if(uc.length){ + const commands = Object.keys(getAllCommands()); + for(const c of commands){ + if(c.indexOf(uc) === 0){ + shadowEl.innerHTML = c; + break; + } + } + } + if (e.keyCode === 9) { e.preventDefault(); - // Maybe one day do tab completion or something? :O - return; + el.value = shadowEl.innerHTML; } - var el = e.target; + this.updatePrompt(el); }, diff --git a/src/style/main.css b/src/style/main.css index fed3616c..3f559adc 100644 --- a/src/style/main.css +++ b/src/style/main.css @@ -1287,3 +1287,12 @@ div.gitDemonstrationView { border-top-color: #9bcbeb; background: #9bcbeb; } + + + +#shadow{ + position: absolute; + bottom: 0px; + left: 21px; + opacity: 0.4; +} \ No newline at end of file diff --git a/src/template.index.html b/src/template.index.html index 8f35f91b..fdc01e76 100644 --- a/src/template.index.html +++ b/src/template.index.html @@ -407,6 +407,7 @@ $  

+