mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 08:28:50 +02:00
better
This commit is contained in:
parent
d5f456fa0c
commit
6ee05c1f0a
6 changed files with 102 additions and 33 deletions
|
@ -4550,7 +4550,6 @@ var Sandbox = Backbone.View.extend({
|
||||||
Main.getEvents().trigger('commandSubmittedPassive', value);
|
Main.getEvents().trigger('commandSubmittedPassive', value);
|
||||||
|
|
||||||
util.splitTextCommand(value, function(command) {
|
util.splitTextCommand(value, function(command) {
|
||||||
console.log('adding command', command);
|
|
||||||
this.commandCollection.add(new Command({
|
this.commandCollection.add(new Command({
|
||||||
rawStr: command,
|
rawStr: command,
|
||||||
parseWaterfall: this.parseWaterfall
|
parseWaterfall: this.parseWaterfall
|
||||||
|
@ -4562,7 +4561,8 @@ var Sandbox = Backbone.View.extend({
|
||||||
var commandMap = {
|
var commandMap = {
|
||||||
help: this.helpDialog,
|
help: this.helpDialog,
|
||||||
reset: this.reset,
|
reset: this.reset,
|
||||||
delay: this.delay
|
delay: this.delay,
|
||||||
|
clear: this.clear
|
||||||
};
|
};
|
||||||
var method = commandMap[command.get('method')];
|
var method = commandMap[command.get('method')];
|
||||||
if (!method) { throw new Error('no method for that wut'); }
|
if (!method) { throw new Error('no method for that wut'); }
|
||||||
|
@ -4570,6 +4570,11 @@ var Sandbox = Backbone.View.extend({
|
||||||
method.apply(this, [command, deferred]);
|
method.apply(this, [command, deferred]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clear: function(command, deferred) {
|
||||||
|
Main.getEvents().trigger('clearOldCommands');
|
||||||
|
command.finishWith(deferred);
|
||||||
|
},
|
||||||
|
|
||||||
delay: function(command, deferred) {
|
delay: function(command, deferred) {
|
||||||
var amount = parseInt(command.get('regexResults')[1], 10);
|
var amount = parseInt(command.get('regexResults')[1], 10);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
@ -12370,7 +12375,8 @@ var instantCommands = [
|
||||||
var regexMap = {
|
var regexMap = {
|
||||||
'help': /^help($|\s)|\?/,
|
'help': /^help($|\s)|\?/,
|
||||||
'reset': /^reset($|\s)/,
|
'reset': /^reset($|\s)/,
|
||||||
'delay': /^delay (\d+)$/
|
'delay': /^delay (\d+)$/,
|
||||||
|
'clear': /^clear($|\s)/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = function(str) {
|
var parse = function(str) {
|
||||||
|
@ -15096,6 +15102,7 @@ var CommandLineHistoryView = Backbone.View.extend({
|
||||||
|
|
||||||
this.collection.on('change', this.scrollDown, this);
|
this.collection.on('change', this.scrollDown, this);
|
||||||
Main.getEvents().on('commandScrollDown', this.scrollDown, this);
|
Main.getEvents().on('commandScrollDown', this.scrollDown, this);
|
||||||
|
Main.getEvents().on('clearOldCommands', this.clearOldCommands, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
addWarning: function(msg) {
|
addWarning: function(msg) {
|
||||||
|
@ -15111,20 +15118,33 @@ var CommandLineHistoryView = Backbone.View.extend({
|
||||||
this.collection.add(command);
|
this.collection.add(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clearOldCommands: function() {
|
||||||
|
// go through and get rid of every command that is "processed" or done
|
||||||
|
var toDestroy = [];
|
||||||
|
|
||||||
|
this.collection.each(function(command) {
|
||||||
|
console.log('this command', command, command.get('status'));
|
||||||
|
if (command.get('status') !== 'inqueue' &&
|
||||||
|
command.get('status') !== 'processing') {
|
||||||
|
toDestroy.push(command);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
_.each(toDestroy, function(command) {
|
||||||
|
command.destroy();
|
||||||
|
}, this);
|
||||||
|
this.scrollDown();
|
||||||
|
},
|
||||||
|
|
||||||
scrollDown: function() {
|
scrollDown: function() {
|
||||||
// if commandDisplay is ever bigger than #terminal, we need to
|
// if commandDisplay is ever bigger than #terminal, we need to
|
||||||
// add overflow-y to terminal and scroll down
|
// add overflow-y to terminal and scroll down
|
||||||
var cD = $('#commandDisplay')[0];
|
var cD = $('#commandDisplay')[0];
|
||||||
var t = $('#terminal')[0];
|
var t = $('#terminal')[0];
|
||||||
|
|
||||||
if ($(t).hasClass('scrolling')) {
|
var shouldScroll = (cD.clientHeight > t.clientHeight);
|
||||||
t.scrollTop = t.scrollHeight;
|
$(t).toggleClass('scrolling', shouldScroll);
|
||||||
return;
|
if (shouldScroll) {
|
||||||
}
|
|
||||||
if (cD.clientHeight > t.clientHeight) {
|
|
||||||
$(t).css('overflow-y', 'scroll');
|
|
||||||
$(t).css('overflow-x', 'hidden');
|
|
||||||
$(t).addClass('scrolling');
|
|
||||||
t.scrollTop = t.scrollHeight;
|
t.scrollTop = t.scrollHeight;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -15145,6 +15165,7 @@ var CommandLineHistoryView = Backbone.View.extend({
|
||||||
exports.CommandPromptView = CommandPromptView;
|
exports.CommandPromptView = CommandPromptView;
|
||||||
exports.CommandLineHistoryView = CommandLineHistoryView;
|
exports.CommandLineHistoryView = CommandLineHistoryView;
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
require.define("/src/js/dialogs/sandbox.js",function(require,module,exports,__dirname,__filename,process,global){exports.helpDialog = [{
|
require.define("/src/js/dialogs/sandbox.js",function(require,module,exports,__dirname,__filename,process,global){exports.helpDialog = [{
|
||||||
|
@ -18151,7 +18172,6 @@ var Sandbox = Backbone.View.extend({
|
||||||
Main.getEvents().trigger('commandSubmittedPassive', value);
|
Main.getEvents().trigger('commandSubmittedPassive', value);
|
||||||
|
|
||||||
util.splitTextCommand(value, function(command) {
|
util.splitTextCommand(value, function(command) {
|
||||||
console.log('adding command', command);
|
|
||||||
this.commandCollection.add(new Command({
|
this.commandCollection.add(new Command({
|
||||||
rawStr: command,
|
rawStr: command,
|
||||||
parseWaterfall: this.parseWaterfall
|
parseWaterfall: this.parseWaterfall
|
||||||
|
@ -18163,7 +18183,8 @@ var Sandbox = Backbone.View.extend({
|
||||||
var commandMap = {
|
var commandMap = {
|
||||||
help: this.helpDialog,
|
help: this.helpDialog,
|
||||||
reset: this.reset,
|
reset: this.reset,
|
||||||
delay: this.delay
|
delay: this.delay,
|
||||||
|
clear: this.clear
|
||||||
};
|
};
|
||||||
var method = commandMap[command.get('method')];
|
var method = commandMap[command.get('method')];
|
||||||
if (!method) { throw new Error('no method for that wut'); }
|
if (!method) { throw new Error('no method for that wut'); }
|
||||||
|
@ -18171,6 +18192,11 @@ var Sandbox = Backbone.View.extend({
|
||||||
method.apply(this, [command, deferred]);
|
method.apply(this, [command, deferred]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clear: function(command, deferred) {
|
||||||
|
Main.getEvents().trigger('clearOldCommands');
|
||||||
|
command.finishWith(deferred);
|
||||||
|
},
|
||||||
|
|
||||||
delay: function(command, deferred) {
|
delay: function(command, deferred) {
|
||||||
var amount = parseInt(command.get('regexResults')[1], 10);
|
var amount = parseInt(command.get('regexResults')[1], 10);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
@ -18244,7 +18270,8 @@ var instantCommands = [
|
||||||
var regexMap = {
|
var regexMap = {
|
||||||
'help': /^help($|\s)|\?/,
|
'help': /^help($|\s)|\?/,
|
||||||
'reset': /^reset($|\s)/,
|
'reset': /^reset($|\s)/,
|
||||||
'delay': /^delay (\d+)$/
|
'delay': /^delay (\d+)$/,
|
||||||
|
'clear': /^clear($|\s)/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = function(str) {
|
var parse = function(str) {
|
||||||
|
@ -19284,6 +19311,7 @@ var CommandLineHistoryView = Backbone.View.extend({
|
||||||
|
|
||||||
this.collection.on('change', this.scrollDown, this);
|
this.collection.on('change', this.scrollDown, this);
|
||||||
Main.getEvents().on('commandScrollDown', this.scrollDown, this);
|
Main.getEvents().on('commandScrollDown', this.scrollDown, this);
|
||||||
|
Main.getEvents().on('clearOldCommands', this.clearOldCommands, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
addWarning: function(msg) {
|
addWarning: function(msg) {
|
||||||
|
@ -19299,20 +19327,33 @@ var CommandLineHistoryView = Backbone.View.extend({
|
||||||
this.collection.add(command);
|
this.collection.add(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clearOldCommands: function() {
|
||||||
|
// go through and get rid of every command that is "processed" or done
|
||||||
|
var toDestroy = [];
|
||||||
|
|
||||||
|
this.collection.each(function(command) {
|
||||||
|
console.log('this command', command, command.get('status'));
|
||||||
|
if (command.get('status') !== 'inqueue' &&
|
||||||
|
command.get('status') !== 'processing') {
|
||||||
|
toDestroy.push(command);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
_.each(toDestroy, function(command) {
|
||||||
|
command.destroy();
|
||||||
|
}, this);
|
||||||
|
this.scrollDown();
|
||||||
|
},
|
||||||
|
|
||||||
scrollDown: function() {
|
scrollDown: function() {
|
||||||
// if commandDisplay is ever bigger than #terminal, we need to
|
// if commandDisplay is ever bigger than #terminal, we need to
|
||||||
// add overflow-y to terminal and scroll down
|
// add overflow-y to terminal and scroll down
|
||||||
var cD = $('#commandDisplay')[0];
|
var cD = $('#commandDisplay')[0];
|
||||||
var t = $('#terminal')[0];
|
var t = $('#terminal')[0];
|
||||||
|
|
||||||
if ($(t).hasClass('scrolling')) {
|
var shouldScroll = (cD.clientHeight > t.clientHeight);
|
||||||
t.scrollTop = t.scrollHeight;
|
$(t).toggleClass('scrolling', shouldScroll);
|
||||||
return;
|
if (shouldScroll) {
|
||||||
}
|
|
||||||
if (cD.clientHeight > t.clientHeight) {
|
|
||||||
$(t).css('overflow-y', 'scroll');
|
|
||||||
$(t).css('overflow-x', 'hidden');
|
|
||||||
$(t).addClass('scrolling');
|
|
||||||
t.scrollTop = t.scrollHeight;
|
t.scrollTop = t.scrollHeight;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -19333,6 +19374,7 @@ var CommandLineHistoryView = Backbone.View.extend({
|
||||||
exports.CommandPromptView = CommandPromptView;
|
exports.CommandPromptView = CommandPromptView;
|
||||||
exports.CommandLineHistoryView = CommandLineHistoryView;
|
exports.CommandLineHistoryView = CommandLineHistoryView;
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
require("/src/js/views/commandViews.js");
|
require("/src/js/views/commandViews.js");
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,6 @@ var Sandbox = Backbone.View.extend({
|
||||||
Main.getEvents().trigger('commandSubmittedPassive', value);
|
Main.getEvents().trigger('commandSubmittedPassive', value);
|
||||||
|
|
||||||
util.splitTextCommand(value, function(command) {
|
util.splitTextCommand(value, function(command) {
|
||||||
console.log('adding command', command);
|
|
||||||
this.commandCollection.add(new Command({
|
this.commandCollection.add(new Command({
|
||||||
rawStr: command,
|
rawStr: command,
|
||||||
parseWaterfall: this.parseWaterfall
|
parseWaterfall: this.parseWaterfall
|
||||||
|
@ -94,7 +93,8 @@ var Sandbox = Backbone.View.extend({
|
||||||
var commandMap = {
|
var commandMap = {
|
||||||
help: this.helpDialog,
|
help: this.helpDialog,
|
||||||
reset: this.reset,
|
reset: this.reset,
|
||||||
delay: this.delay
|
delay: this.delay,
|
||||||
|
clear: this.clear
|
||||||
};
|
};
|
||||||
var method = commandMap[command.get('method')];
|
var method = commandMap[command.get('method')];
|
||||||
if (!method) { throw new Error('no method for that wut'); }
|
if (!method) { throw new Error('no method for that wut'); }
|
||||||
|
@ -102,6 +102,11 @@ var Sandbox = Backbone.View.extend({
|
||||||
method.apply(this, [command, deferred]);
|
method.apply(this, [command, deferred]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clear: function(command, deferred) {
|
||||||
|
Main.getEvents().trigger('clearOldCommands');
|
||||||
|
command.finishWith(deferred);
|
||||||
|
},
|
||||||
|
|
||||||
delay: function(command, deferred) {
|
delay: function(command, deferred) {
|
||||||
var amount = parseInt(command.get('regexResults')[1], 10);
|
var amount = parseInt(command.get('regexResults')[1], 10);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
|
@ -39,7 +39,8 @@ var instantCommands = [
|
||||||
var regexMap = {
|
var regexMap = {
|
||||||
'help': /^help($|\s)|\?/,
|
'help': /^help($|\s)|\?/,
|
||||||
'reset': /^reset($|\s)/,
|
'reset': /^reset($|\s)/,
|
||||||
'delay': /^delay (\d+)$/
|
'delay': /^delay (\d+)$/,
|
||||||
|
'clear': /^clear($|\s)/
|
||||||
};
|
};
|
||||||
|
|
||||||
var parse = function(str) {
|
var parse = function(str) {
|
||||||
|
|
|
@ -310,6 +310,7 @@ var CommandLineHistoryView = Backbone.View.extend({
|
||||||
|
|
||||||
this.collection.on('change', this.scrollDown, this);
|
this.collection.on('change', this.scrollDown, this);
|
||||||
Main.getEvents().on('commandScrollDown', this.scrollDown, this);
|
Main.getEvents().on('commandScrollDown', this.scrollDown, this);
|
||||||
|
Main.getEvents().on('clearOldCommands', this.clearOldCommands, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
addWarning: function(msg) {
|
addWarning: function(msg) {
|
||||||
|
@ -325,20 +326,33 @@ var CommandLineHistoryView = Backbone.View.extend({
|
||||||
this.collection.add(command);
|
this.collection.add(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clearOldCommands: function() {
|
||||||
|
// go through and get rid of every command that is "processed" or done
|
||||||
|
var toDestroy = [];
|
||||||
|
|
||||||
|
this.collection.each(function(command) {
|
||||||
|
console.log('this command', command, command.get('status'));
|
||||||
|
if (command.get('status') !== 'inqueue' &&
|
||||||
|
command.get('status') !== 'processing') {
|
||||||
|
toDestroy.push(command);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
_.each(toDestroy, function(command) {
|
||||||
|
command.destroy();
|
||||||
|
}, this);
|
||||||
|
this.scrollDown();
|
||||||
|
},
|
||||||
|
|
||||||
scrollDown: function() {
|
scrollDown: function() {
|
||||||
// if commandDisplay is ever bigger than #terminal, we need to
|
// if commandDisplay is ever bigger than #terminal, we need to
|
||||||
// add overflow-y to terminal and scroll down
|
// add overflow-y to terminal and scroll down
|
||||||
var cD = $('#commandDisplay')[0];
|
var cD = $('#commandDisplay')[0];
|
||||||
var t = $('#terminal')[0];
|
var t = $('#terminal')[0];
|
||||||
|
|
||||||
if ($(t).hasClass('scrolling')) {
|
var shouldScroll = (cD.clientHeight > t.clientHeight);
|
||||||
t.scrollTop = t.scrollHeight;
|
$(t).toggleClass('scrolling', shouldScroll);
|
||||||
return;
|
if (shouldScroll) {
|
||||||
}
|
|
||||||
if (cD.clientHeight > t.clientHeight) {
|
|
||||||
$(t).css('overflow-y', 'scroll');
|
|
||||||
$(t).css('overflow-x', 'hidden');
|
|
||||||
$(t).addClass('scrolling');
|
|
||||||
t.scrollTop = t.scrollHeight;
|
t.scrollTop = t.scrollHeight;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -358,3 +372,4 @@ var CommandLineHistoryView = Backbone.View.extend({
|
||||||
|
|
||||||
exports.CommandPromptView = CommandPromptView;
|
exports.CommandPromptView = CommandPromptView;
|
||||||
exports.CommandLineHistoryView = CommandLineHistoryView;
|
exports.CommandLineHistoryView = CommandLineHistoryView;
|
||||||
|
|
||||||
|
|
|
@ -361,6 +361,11 @@ p.commandLine span.prompt {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#commandLineHistory #terminal.scrolling {
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
#prompt {
|
#prompt {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
1
todo.txt
1
todo.txt
|
@ -33,6 +33,7 @@ Big Bugs to fix:
|
||||||
Done things:
|
Done things:
|
||||||
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
[x] allow command history to clear finished ones
|
||||||
[x] put in some > into the rules for CSS
|
[x] put in some > into the rules for CSS
|
||||||
[x] fix bug for multiview, i think its from the die() on everyone
|
[x] fix bug for multiview, i think its from the die() on everyone
|
||||||
[x] fixed bug in command queue
|
[x] fixed bug in command queue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue