]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Command history improvements.
authorChris Porter <redacted>
Fri, 17 Oct 2008 10:38:23 +0000 (11:38 +0100)
committerChris Porter <redacted>
Fri, 17 Oct 2008 10:38:23 +0000 (11:38 +0100)
js/irc/commandhistory.js
js/irc/commandparser.js

index 5577b09bc52da9d75296455e56fd87de68b05460..175ac19b6e9504ecc96815e3027d2e9d9d6420ae 100644 (file)
@@ -7,27 +7,41 @@ var CommandHistory = new Class({
     this.setOptions(options);
     
     this.data = [];
-    this.position = -1;
+    this.position = 0;
   },
-  addLine: function(line) {
-    this.data.unshift(line);
-    this.position = -1;
+  addLine: function(line, moveUp) {
+    if((this.data.length == 0) || (line != this.data[0]))
+      this.data.unshift(line);
+      
+    if(moveUp) {
+      this.position = 0;
+    } else {
+      this.position = -1;
+    }
     
     if(this.data.length > this.options.lines)
       this.data.pop();
   },
-  prevLine: function() {
-    if(this.position == 0)
+  upLine: function() {
+    if(this.data.length == 0)
       return null;
-    this.position = this.position - 1;
-    
-    return this.data[this.position];
-  },
-  nextLine: function() {
+      
     if(this.position >= this.data.length)
       return null;
+      
     this.position = this.position + 1;
     
+    return this.data[this.position];
+  },
+  downLine: function() {
+    if(this.position == -1)
+      return null;
+
+    this.position = this.position - 1;
+
+    if(this.position == -1)
+      return null;
+      
     return this.data[this.position];
   }
 });
index 1a4238f2faca0108af99e0229e3f0bb0543eb67e..46b68eebfae1a96d6216735a9ab8cfc447051ab1 100644 (file)
@@ -157,7 +157,7 @@ var CommandParser = new Class({
       "This software contains the following third party portions:",
       "- MooTools v1.2 --- Copyright (C) 2006-2008 Valerio Proietti, MIT license.",
       "",
-      "Thank you for flying QuakeNet.",
+      "Thank you for flying QuakeNet!",
       "",
     ];