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
fix zero length tab complete behaviour
This commit is contained in:
@@ -83,10 +83,10 @@ class TabComplete {
|
|||||||
this._notifyStateChange();
|
this._notifyStateChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
startTabCompleting() {
|
startTabCompleting(passive) {
|
||||||
this.completing = true;
|
this.completing = true;
|
||||||
this.currentIndex = 0;
|
this.currentIndex = 0;
|
||||||
this._calculateCompletions();
|
this._calculateCompletions(passive);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,7 +137,7 @@ class TabComplete {
|
|||||||
this.inPassiveMode = passive;
|
this.inPassiveMode = passive;
|
||||||
|
|
||||||
if (!this.completing) {
|
if (!this.completing) {
|
||||||
this.startTabCompleting();
|
this.startTabCompleting(passive);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shiftKey) {
|
if (shiftKey) {
|
||||||
@@ -270,7 +270,7 @@ class TabComplete {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_calculateCompletions() {
|
_calculateCompletions(passive) {
|
||||||
this.originalText = this.textArea.value; // cache starting text
|
this.originalText = this.textArea.value; // cache starting text
|
||||||
|
|
||||||
// grab the partial word from the text which we'll be tab-completing
|
// grab the partial word from the text which we'll be tab-completing
|
||||||
@@ -283,6 +283,11 @@ class TabComplete {
|
|||||||
var [ , boundaryGroup, partialGroup] = res;
|
var [ , boundaryGroup, partialGroup] = res;
|
||||||
this.isFirstWord = partialGroup.length === this.originalText.length;
|
this.isFirstWord = partialGroup.length === this.originalText.length;
|
||||||
|
|
||||||
|
if (partialGroup.length === 0 && passive) {
|
||||||
|
this.stopTabCompleting();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.matchedList = [
|
this.matchedList = [
|
||||||
new Entry(partialGroup) // first entry is always the original partial
|
new Entry(partialGroup) // first entry is always the original partial
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user