Merge pull request #565 from nightwing/pullreq

small polish
This commit is contained in:
Fabian Jakobs 2011-12-08 09:52:44 -08:00
commit a742993ffb
5 changed files with 20 additions and 14 deletions

View file

@ -146,8 +146,13 @@ var CommandManager = function(platform, commands) {
if (this.recording) {
this.macro.pop();
this.exec = this.normal_exec;
if (!this.macro.length)
this.macro = this.oldMacro;
return this.recording = false;
}
this.oldMacro = this.macro;
this.macro = [];
this.normal_exec = this.exec;
this.exec = function(command, editor, args) {
@ -158,10 +163,10 @@ var CommandManager = function(platform, commands) {
};
this.replay = function(editor) {
if (this.$inReplay)
if (this.$inReplay || !this.macro)
return;
if (!this.macro || this.recording)
if (this.recording)
return this.toggleRecording();
try {

View file

@ -85,7 +85,7 @@
.ace_editor textarea {
position: fixed;
z-index: 2000;
z-index: 0;
width: 10px;
height: 30px;
opacity: 0;

View file

@ -50,7 +50,7 @@ var TextInput = function(parentNode, host) {
text.setAttribute("x-palm-disable-auto-cap", true);
text.style.left = "-10000px";
parentNode.appendChild(text);
parentNode.insertBefore(text, parentNode.firstChild);
var PLACEHOLDER = String.fromCharCode(0);
sendText();

View file

@ -50,16 +50,17 @@ var ScrollBar = function(parent) {
this.inner = dom.createElement("div");
this.element.appendChild(this.inner);
parent.appendChild(this.element);
// in OSX lion the scrollbars appear to have no width. In this case resize
// the to show the scrollbar but still pretend that the scrollbar has a width
// of 0px
// in Firefox 6+ scrollbar is hidden if element has the same width as scrollbar
// make element a little bit wider to retain scrollbar when page is zoomed
// and insert it before other siblings to not cover them
this.width = dom.scrollbarWidth(parent.ownerDocument);
this.element.style.width = (this.width || 15) + 5 + "px";
parent.insertBefore(this.element, parent.firstChild);
event.addListener(this.element, "scroll", this.onScroll.bind(this));
};

View file

@ -257,9 +257,9 @@ var VirtualRenderer = function(container, theme) {
this.$loop.schedule(changes);
};
this.adjustWrapLimit = function(){
this.adjustWrapLimit = function() {
var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
var limit = Math.floor(availableWidth / this.characterWidth) - 1;
var limit = Math.floor(availableWidth / this.characterWidth);
return this.session.adjustWrapLimit(limit);
};
@ -333,7 +333,7 @@ var VirtualRenderer = function(container, theme) {
}
var style = this.$printMarginEl.style;
style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding * 2) + "px";
style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding) + "px";
style.visibility = this.$showPrintMargin ? "visible" : "hidden";
};
@ -362,7 +362,7 @@ var VirtualRenderer = function(container, theme) {
var bounds = this.content.getBoundingClientRect();
var offset = this.layerConfig.offset;
textarea.style.left = (bounds.left + pos.left + this.$padding) + "px";
textarea.style.left = (bounds.left + pos.left) + "px";
textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
};
@ -548,7 +548,7 @@ var VirtualRenderer = function(container, theme) {
this.$gutterLayer.element.style.marginTop = (-offset) + "px";
this.content.style.marginTop = (-offset) + "px";
this.content.style.width = longestLine + "px";
this.content.style.width = longestLine + 2 * this.$padding + "px";
this.content.style.height = minHeight + "px";
// scroller.scrollWidth was smaller than scrollLeft we needed
@ -590,11 +590,11 @@ var VirtualRenderer = function(container, theme) {
};
this.$getLongestLine = function() {
var charCount = this.session.getScreenWidth() + 1;
var charCount = this.session.getScreenWidth();
if (this.$textLayer.showInvisibles)
charCount += 1;
return Math.max(this.$size.scrollerWidth, Math.round(charCount * this.characterWidth));
return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
};
this.updateFrontMarkers = function() {
@ -715,7 +715,7 @@ var VirtualRenderer = function(container, theme) {
};
this.scrollToX = function(scrollLeft) {
if (scrollLeft <= this.$padding)
if (scrollLeft <= this.$padding + 2 * this.layerConfig.characterWidth)
scrollLeft = 0;
this.scroller.scrollLeft = scrollLeft;