Skip to content

Commit

Permalink
package 22.09.23
Browse files Browse the repository at this point in the history
  • Loading branch information
akoreman committed Sep 22, 2023
1 parent 480d8ed commit 7872c8a
Show file tree
Hide file tree
Showing 20 changed files with 161 additions and 53 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.28.0](https://github.com/ajaxorg/ace/compare/v1.27.0...v1.28.0) (2023-09-22)


### Features

* Keep focus on same item in completion popup when slow completer delivers results. ([#5322](https://github.com/ajaxorg/ace/issues/5322)) ([0983134](https://github.com/ajaxorg/ace/commit/09831343ccd450326cffb4b0f26ce3a8b830c7fb))

## [1.27.0](https://github.com/ajaxorg/ace/compare/v1.26.0...v1.27.0) (2023-09-19)


Expand Down
2 changes: 2 additions & 0 deletions ace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,8 @@ export namespace Ace {
exactMatch?: boolean;
inlineEnabled?: boolean;
parentNode?: HTMLElement;
setSelectOnHover?: Boolean;
stickySelectionDelay?: Number;
emptyMessage?(prefix: String): String;
getPopup(): AcePopup;
showPopup(editor: Editor, options: CompletionOptions): void;
Expand Down
21 changes: 19 additions & 2 deletions demo/kitchen-sink/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5654,6 +5654,7 @@ var Autocomplete = /** @class */ (function () {
this.keyboardHandler.bindKeys(this.commands);
this.parentNode = null;
this.setSelectOnHover = false;
this.stickySelectionDelay = 500;
this.blurListener = this.blurListener.bind(this);
this.changeListener = this.changeListener.bind(this);
this.mousedownListener = this.mousedownListener.bind(this);
Expand All @@ -5663,6 +5664,9 @@ var Autocomplete = /** @class */ (function () {
this.updateCompletions(true);
}.bind(this));
this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
this.stickySelectionTimer = lang.delayedCall(function () {
this.stickySelection = true;
}.bind(this), this.stickySelectionDelay);
}
Autocomplete.prototype.$init = function () {
this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
Expand All @@ -5671,7 +5675,7 @@ var Autocomplete = /** @class */ (function () {
e.stop();
}.bind(this));
this.popup.focus = this.editor.focus.bind(this.editor);
this.popup.on("show", this.$onPopupChange.bind(this));
this.popup.on("show", this.$onPopupShow.bind(this));
this.popup.on("hide", this.$onHidePopup.bind(this));
this.popup.on("select", this.$onPopupChange.bind(this));
this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
Expand All @@ -5691,6 +5695,8 @@ var Autocomplete = /** @class */ (function () {
this.inlineRenderer.hide();
}
this.hideDocTooltip();
this.stickySelectionTimer.cancel();
this.stickySelection = false;
};
Autocomplete.prototype.$onPopupChange = function (hide) {
if (this.inlineRenderer && this.inlineEnabled) {
Expand All @@ -5703,6 +5709,12 @@ var Autocomplete = /** @class */ (function () {
}
this.tooltipTimer.call(null, null);
};
Autocomplete.prototype.$onPopupShow = function (hide) {
this.$onPopupChange(hide);
this.stickySelection = false;
if (this.stickySelectionDelay >= 0)
this.stickySelectionTimer.schedule(this.stickySelectionDelay);
};
Autocomplete.prototype.observeLayoutChanges = function () {
if (this.$elements || !this.editor)
return;
Expand Down Expand Up @@ -5766,6 +5778,7 @@ var Autocomplete = /** @class */ (function () {
this.$initInline();
this.popup.autoSelect = this.autoSelect;
this.popup.setSelectOnHover(this.setSelectOnHover);
var previousSelectedItem = this.popup.data[this.popup.getRow()];
this.popup.setData(this.completions.filtered, this.completions.filterText);
if (this.editor.textInput.setAriaOptions) {
this.editor.textInput.setAriaOptions({
Expand All @@ -5774,7 +5787,11 @@ var Autocomplete = /** @class */ (function () {
});
}
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
this.popup.setRow(this.autoSelect ? 0 : -1);
var newRow = this.popup.data.indexOf(previousSelectedItem);
if (newRow && this.stickySelection)
this.popup.setRow(this.autoSelect ? newRow : -1);
else
this.popup.setRow(this.autoSelect ? 0 : -1);
if (!keepPopupPosition) {
this.popup.setTheme(editor.getTheme());
this.popup.setFontSize(editor.getFontSize());
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ace-builds",
"main": "./src-noconflict/ace.js",
"typings": "ace.d.ts",
"version": "1.27.0",
"version": "1.28.0",
"description": "Ace (Ajax.org Cloud9 Editor)",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
2 changes: 1 addition & 1 deletion src-min-noconflict/ace.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min-noconflict/ext-inline_autocomplete.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min-noconflict/ext-language_tools.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min-noconflict/ext-prompt.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min/ace.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min/ext-inline_autocomplete.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min/ext-language_tools.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-min/ext-prompt.js

Large diffs are not rendered by default.

20 changes: 5 additions & 15 deletions src-noconflict/ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ var reportErrorIfPathIsNotConfigured = function () {
reportErrorIfPathIsNotConfigured = function () { };
}
};
exports.version = "1.27.0";
exports.version = "1.28.0";

});

Expand Down Expand Up @@ -3211,23 +3211,13 @@ var HoverTooltip = /** @class */ (function (_super) {
element.appendChild(domNode);
element.style.display = "block";
var position = renderer.textToScreenCoordinates(range.start.row, range.start.column);
var cursorPos = editor.getCursorPosition();
var labelHeight = element.clientHeight;
var rect = renderer.scroller.getBoundingClientRect();
var isTopdown = true;
if (this.row > cursorPos.row) {
isTopdown = true;
var isAbove = true;
if (position.pageY - labelHeight < 0) {
isAbove = false;
}
else if (this.row < cursorPos.row) {
isTopdown = false;
}
if (position.pageY - labelHeight + renderer.lineHeight < rect.top) {
isTopdown = true;
}
else if (position.pageY + labelHeight > rect.bottom) {
isTopdown = false;
}
if (!isTopdown) {
if (isAbove) {
position.pageY -= labelHeight;
}
else {
Expand Down
21 changes: 19 additions & 2 deletions src-noconflict/ext-inline_autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,7 @@ var Autocomplete = /** @class */ (function () {
this.keyboardHandler.bindKeys(this.commands);
this.parentNode = null;
this.setSelectOnHover = false;
this.stickySelectionDelay = 500;
this.blurListener = this.blurListener.bind(this);
this.changeListener = this.changeListener.bind(this);
this.mousedownListener = this.mousedownListener.bind(this);
Expand All @@ -1451,6 +1452,9 @@ var Autocomplete = /** @class */ (function () {
this.updateCompletions(true);
}.bind(this));
this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
this.stickySelectionTimer = lang.delayedCall(function () {
this.stickySelection = true;
}.bind(this), this.stickySelectionDelay);
}
Autocomplete.prototype.$init = function () {
this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
Expand All @@ -1459,7 +1463,7 @@ var Autocomplete = /** @class */ (function () {
e.stop();
}.bind(this));
this.popup.focus = this.editor.focus.bind(this.editor);
this.popup.on("show", this.$onPopupChange.bind(this));
this.popup.on("show", this.$onPopupShow.bind(this));
this.popup.on("hide", this.$onHidePopup.bind(this));
this.popup.on("select", this.$onPopupChange.bind(this));
this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
Expand All @@ -1479,6 +1483,8 @@ var Autocomplete = /** @class */ (function () {
this.inlineRenderer.hide();
}
this.hideDocTooltip();
this.stickySelectionTimer.cancel();
this.stickySelection = false;
};
Autocomplete.prototype.$onPopupChange = function (hide) {
if (this.inlineRenderer && this.inlineEnabled) {
Expand All @@ -1491,6 +1497,12 @@ var Autocomplete = /** @class */ (function () {
}
this.tooltipTimer.call(null, null);
};
Autocomplete.prototype.$onPopupShow = function (hide) {
this.$onPopupChange(hide);
this.stickySelection = false;
if (this.stickySelectionDelay >= 0)
this.stickySelectionTimer.schedule(this.stickySelectionDelay);
};
Autocomplete.prototype.observeLayoutChanges = function () {
if (this.$elements || !this.editor)
return;
Expand Down Expand Up @@ -1554,6 +1566,7 @@ var Autocomplete = /** @class */ (function () {
this.$initInline();
this.popup.autoSelect = this.autoSelect;
this.popup.setSelectOnHover(this.setSelectOnHover);
var previousSelectedItem = this.popup.data[this.popup.getRow()];
this.popup.setData(this.completions.filtered, this.completions.filterText);
if (this.editor.textInput.setAriaOptions) {
this.editor.textInput.setAriaOptions({
Expand All @@ -1562,7 +1575,11 @@ var Autocomplete = /** @class */ (function () {
});
}
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
this.popup.setRow(this.autoSelect ? 0 : -1);
var newRow = this.popup.data.indexOf(previousSelectedItem);
if (newRow && this.stickySelection)
this.popup.setRow(this.autoSelect ? newRow : -1);
else
this.popup.setRow(this.autoSelect ? 0 : -1);
if (!keepPopupPosition) {
this.popup.setTheme(editor.getTheme());
this.popup.setFontSize(editor.getFontSize());
Expand Down
21 changes: 19 additions & 2 deletions src-noconflict/ext-language_tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,7 @@ var Autocomplete = /** @class */ (function () {
this.keyboardHandler.bindKeys(this.commands);
this.parentNode = null;
this.setSelectOnHover = false;
this.stickySelectionDelay = 500;
this.blurListener = this.blurListener.bind(this);
this.changeListener = this.changeListener.bind(this);
this.mousedownListener = this.mousedownListener.bind(this);
Expand All @@ -1451,6 +1452,9 @@ var Autocomplete = /** @class */ (function () {
this.updateCompletions(true);
}.bind(this));
this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
this.stickySelectionTimer = lang.delayedCall(function () {
this.stickySelection = true;
}.bind(this), this.stickySelectionDelay);
}
Autocomplete.prototype.$init = function () {
this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
Expand All @@ -1459,7 +1463,7 @@ var Autocomplete = /** @class */ (function () {
e.stop();
}.bind(this));
this.popup.focus = this.editor.focus.bind(this.editor);
this.popup.on("show", this.$onPopupChange.bind(this));
this.popup.on("show", this.$onPopupShow.bind(this));
this.popup.on("hide", this.$onHidePopup.bind(this));
this.popup.on("select", this.$onPopupChange.bind(this));
this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
Expand All @@ -1479,6 +1483,8 @@ var Autocomplete = /** @class */ (function () {
this.inlineRenderer.hide();
}
this.hideDocTooltip();
this.stickySelectionTimer.cancel();
this.stickySelection = false;
};
Autocomplete.prototype.$onPopupChange = function (hide) {
if (this.inlineRenderer && this.inlineEnabled) {
Expand All @@ -1491,6 +1497,12 @@ var Autocomplete = /** @class */ (function () {
}
this.tooltipTimer.call(null, null);
};
Autocomplete.prototype.$onPopupShow = function (hide) {
this.$onPopupChange(hide);
this.stickySelection = false;
if (this.stickySelectionDelay >= 0)
this.stickySelectionTimer.schedule(this.stickySelectionDelay);
};
Autocomplete.prototype.observeLayoutChanges = function () {
if (this.$elements || !this.editor)
return;
Expand Down Expand Up @@ -1554,6 +1566,7 @@ var Autocomplete = /** @class */ (function () {
this.$initInline();
this.popup.autoSelect = this.autoSelect;
this.popup.setSelectOnHover(this.setSelectOnHover);
var previousSelectedItem = this.popup.data[this.popup.getRow()];
this.popup.setData(this.completions.filtered, this.completions.filterText);
if (this.editor.textInput.setAriaOptions) {
this.editor.textInput.setAriaOptions({
Expand All @@ -1562,7 +1575,11 @@ var Autocomplete = /** @class */ (function () {
});
}
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
this.popup.setRow(this.autoSelect ? 0 : -1);
var newRow = this.popup.data.indexOf(previousSelectedItem);
if (newRow && this.stickySelection)
this.popup.setRow(this.autoSelect ? newRow : -1);
else
this.popup.setRow(this.autoSelect ? 0 : -1);
if (!keepPopupPosition) {
this.popup.setTheme(editor.getTheme());
this.popup.setFontSize(editor.getFontSize());
Expand Down
21 changes: 19 additions & 2 deletions src-noconflict/ext-prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,7 @@ var Autocomplete = /** @class */ (function () {
this.keyboardHandler.bindKeys(this.commands);
this.parentNode = null;
this.setSelectOnHover = false;
this.stickySelectionDelay = 500;
this.blurListener = this.blurListener.bind(this);
this.changeListener = this.changeListener.bind(this);
this.mousedownListener = this.mousedownListener.bind(this);
Expand All @@ -1451,6 +1452,9 @@ var Autocomplete = /** @class */ (function () {
this.updateCompletions(true);
}.bind(this));
this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50);
this.stickySelectionTimer = lang.delayedCall(function () {
this.stickySelection = true;
}.bind(this), this.stickySelectionDelay);
}
Autocomplete.prototype.$init = function () {
this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
Expand All @@ -1459,7 +1463,7 @@ var Autocomplete = /** @class */ (function () {
e.stop();
}.bind(this));
this.popup.focus = this.editor.focus.bind(this.editor);
this.popup.on("show", this.$onPopupChange.bind(this));
this.popup.on("show", this.$onPopupShow.bind(this));
this.popup.on("hide", this.$onHidePopup.bind(this));
this.popup.on("select", this.$onPopupChange.bind(this));
this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
Expand All @@ -1479,6 +1483,8 @@ var Autocomplete = /** @class */ (function () {
this.inlineRenderer.hide();
}
this.hideDocTooltip();
this.stickySelectionTimer.cancel();
this.stickySelection = false;
};
Autocomplete.prototype.$onPopupChange = function (hide) {
if (this.inlineRenderer && this.inlineEnabled) {
Expand All @@ -1491,6 +1497,12 @@ var Autocomplete = /** @class */ (function () {
}
this.tooltipTimer.call(null, null);
};
Autocomplete.prototype.$onPopupShow = function (hide) {
this.$onPopupChange(hide);
this.stickySelection = false;
if (this.stickySelectionDelay >= 0)
this.stickySelectionTimer.schedule(this.stickySelectionDelay);
};
Autocomplete.prototype.observeLayoutChanges = function () {
if (this.$elements || !this.editor)
return;
Expand Down Expand Up @@ -1554,6 +1566,7 @@ var Autocomplete = /** @class */ (function () {
this.$initInline();
this.popup.autoSelect = this.autoSelect;
this.popup.setSelectOnHover(this.setSelectOnHover);
var previousSelectedItem = this.popup.data[this.popup.getRow()];
this.popup.setData(this.completions.filtered, this.completions.filterText);
if (this.editor.textInput.setAriaOptions) {
this.editor.textInput.setAriaOptions({
Expand All @@ -1562,7 +1575,11 @@ var Autocomplete = /** @class */ (function () {
});
}
editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
this.popup.setRow(this.autoSelect ? 0 : -1);
var newRow = this.popup.data.indexOf(previousSelectedItem);
if (newRow && this.stickySelection)
this.popup.setRow(this.autoSelect ? newRow : -1);
else
this.popup.setRow(this.autoSelect ? 0 : -1);
if (!keepPopupPosition) {
this.popup.setTheme(editor.getTheme());
this.popup.setFontSize(editor.getFontSize());
Expand Down
20 changes: 5 additions & 15 deletions src/ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ var reportErrorIfPathIsNotConfigured = function () {
reportErrorIfPathIsNotConfigured = function () { };
}
};
exports.version = "1.27.0";
exports.version = "1.28.0";

});

Expand Down Expand Up @@ -3211,23 +3211,13 @@ var HoverTooltip = /** @class */ (function (_super) {
element.appendChild(domNode);
element.style.display = "block";
var position = renderer.textToScreenCoordinates(range.start.row, range.start.column);
var cursorPos = editor.getCursorPosition();
var labelHeight = element.clientHeight;
var rect = renderer.scroller.getBoundingClientRect();
var isTopdown = true;
if (this.row > cursorPos.row) {
isTopdown = true;
var isAbove = true;
if (position.pageY - labelHeight < 0) {
isAbove = false;
}
else if (this.row < cursorPos.row) {
isTopdown = false;
}
if (position.pageY - labelHeight + renderer.lineHeight < rect.top) {
isTopdown = true;
}
else if (position.pageY + labelHeight > rect.bottom) {
isTopdown = false;
}
if (!isTopdown) {
if (isAbove) {
position.pageY -= labelHeight;
}
else {
Expand Down

0 comments on commit 7872c8a

Please sign in to comment.