i think terminal is done\!

This commit is contained in:
Peter Cottle 2012-09-30 13:05:40 -07:00
parent 1130bbcb2e
commit 01b9b1132d
2 changed files with 20 additions and 4 deletions

View file

@ -75,10 +75,25 @@ var CommandPromptView = Backbone.View.extend({
var val = this.badHtmlEncode(el.value);
this.commandSpan.innerHTML = val;
// if it's full of something, we need to move the cursor
$(this.commandCursor).toggleClass('partialCommand', val.length == 0);
console.log('val.elgnth is', val.length);
//console.log(val, el.selectionStart, el.selectionEnd);
// now mutate the cursor...
this.cursorUpdate(el.value.length, el.selectionStart, el.selectionEnd);
},
cursorUpdate: function(commandLength, selectionStart, selectionEnd) {
// 10px for monospaced font...
var widthPerChar = 10;
var numCharsSelected = Math.max(1, selectionEnd - selectionStart);
var width = String(numCharsSelected * widthPerChar) + 'px';
// now for positioning
var numLeft = Math.max(commandLength - selectionStart, 0);
var left = String(-numLeft * widthPerChar) + 'px';
// one reflow? :D
$(this.commandCursor).css({
width: width,
left: left
});
},
commandSelectChange: function(delta) {

View file

@ -285,6 +285,7 @@ p.commandLine span.prompt {
-webkit-animation-duration: 1s;
-webkit-animation-iteration-count: 99999;
background: #DDD;
position: relative;
}
@-webkit-keyframes blink {