You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
Review comments
This commit is contained in:
@@ -134,8 +134,6 @@ class TabComplete {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {DOMEvent} e
|
* @param {DOMEvent} e
|
||||||
* @return {Boolean} True if the tab complete state changed as a result of
|
|
||||||
* this event.
|
|
||||||
*/
|
*/
|
||||||
onKeyDown(ev) {
|
onKeyDown(ev) {
|
||||||
var wasInPassiveMode = this.inPassiveMode && !ev.passive;
|
var wasInPassiveMode = this.inPassiveMode && !ev.passive;
|
||||||
@@ -215,8 +213,8 @@ class TabComplete {
|
|||||||
else if (this.currentIndex < 0) {
|
else if (this.currentIndex < 0) {
|
||||||
this.currentIndex = this.matchedList.length - 1;
|
this.currentIndex = this.matchedList.length - 1;
|
||||||
}
|
}
|
||||||
var looped = (
|
var isTransitioningToOriginalText = (
|
||||||
// impossible to loop if they've never hit tab; catch forward and backward looping
|
// impossible to transition if they've never hit tab
|
||||||
!this.inPassiveMode && this.currentIndex === 0
|
!this.inPassiveMode && this.currentIndex === 0
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -229,7 +227,7 @@ class TabComplete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// visual display to the user that we looped - TODO: This should be configurable
|
// visual display to the user that we looped - TODO: This should be configurable
|
||||||
if (looped) {
|
if (isTransitioningToOriginalText) {
|
||||||
this.textArea.style["background-color"] = "#faa";
|
this.textArea.style["background-color"] = "#faa";
|
||||||
setTimeout(() => { // yay for lexical 'this'!
|
setTimeout(() => { // yay for lexical 'this'!
|
||||||
this.textArea.style["background-color"] = "";
|
this.textArea.style["background-color"] = "";
|
||||||
@@ -266,7 +264,9 @@ class TabComplete {
|
|||||||
""
|
""
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return this.originalText.replace(MATCH_REGEX, replacementText);
|
return this.originalText.replace(MATCH_REGEX, function() {
|
||||||
|
return replacementText; // function form to avoid `$` special-casing
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_calculateCompletions() {
|
_calculateCompletions() {
|
||||||
|
|||||||
Reference in New Issue
Block a user