[polari] tabCompletion: Don't chain for auto-completion of command
- From: Kunal Jain <kunaljain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] tabCompletion: Don't chain for auto-completion of command
- Date: Tue, 16 Feb 2016 21:03:03 +0000 (UTC)
commit 4ee97c526fb551a7debd3525adfef0300b554225
Author: Kunaal Jain <kunaalus gmail com>
Date: Tue Feb 16 22:12:49 2016 +0530
tabCompletion: Don't chain for auto-completion of command
In commit 68758ea we added support for auto-completion
of IRC commands. We should not chain completions if the current
or the previous completion was a command. Also
_previousCompletion is a misnomer, use _isChained instead.
https://bugzilla.gnome.org/show_bug.cgi?id=761304
src/tabCompletion.js | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/tabCompletion.js b/src/tabCompletion.js
index 3afb23f..eebe3e7 100644
--- a/src/tabCompletion.js
+++ b/src/tabCompletion.js
@@ -165,7 +165,7 @@ const TabCompletion = new Lang.Class({
if (this._isIRCCommand)
return row._text + ' ';
- if (this._startPos == 0 || this._previousCompletion)
+ if (this._startPos == 0 || this._isChained)
return row._text + ': ';
return row._text;
},
@@ -209,8 +209,10 @@ const TabCompletion = new Lang.Class({
if (this._startPos == 0)
this._endPos = -1;
- // In case the last completion was for IRC Command, don't chain.
- this._previousCompletion = (this._endPos == this._startPos) && !this._previousWasCommand;
+ // Chain completions if the current completion directly follows a previous one,
+ // except when one of them was for an IRC command
+ let previousCompletion = (this._endPos == this._startPos);
+ this._isChained = previousCompletion && !this._isIRCCommand && !this._previousWasCommand;
this._list.invalidate_filter();
@@ -222,7 +224,7 @@ const TabCompletion = new Lang.Class({
if (nVisibleRows == 0)
return;
- if (this._previousCompletion)
+ if (this._isChained)
this._setPreviousCompletionChained(true);
this._insertCompletion(this._getRowCompletion(visibleRows[0]));
if (visibleRows.length > 1) {
@@ -262,7 +264,7 @@ const TabCompletion = new Lang.Class({
_cancel: function() {
if (this._key.length == 0)
return;
- if (this._previousCompletion)
+ if (this._isChained)
this._setPreviousCompletionChained(false);
this._insertCompletion('');
this._stop();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]