]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/frontends/qui.js
fix dependency ordering for zope interface (twisted now has its own dependency checke...
[irc/quakenet/qwebirc.git] / js / ui / frontends / qui.js
index 14f32b780967f2948858a64bb7a70c7ed728ade6..c3b06e246c3a8905ed537e4bf3b3b86ee274c55e 100644 (file)
@@ -189,25 +189,30 @@ qwebirc.ui.QUI = new Class({
       new Event(e).stop();
       sendInput();
     });
-    
-    inputbox.addEvent("focus", this.resetTabComplete.bind(this));
-    inputbox.addEvent("mousedown", this.resetTabComplete.bind(this));
-    
+
+    var reset = this.resetTabComplete.bind(this);
+    inputbox.addEvent("focus", reset);
+    inputbox.addEvent("mousedown", reset);
+    inputbox.addEvent("keypress", reset);
+
     inputbox.addEvent("keydown", function(e) {
       var resultfn;
       var cvalue = inputbox.value;
-      
-      if(e.key == "up") {
+
+      if(e.alt || e.control || e.meta)
+        return;
+
+      if(e.key == "up" && !e.shift) {
         resultfn = this.commandhistory.upLine;
-      } else if(e.key == "down") {
+      } else if(e.key == "down" && !e.shift) {
         resultfn = this.commandhistory.downLine;
-      } else if(e.key == "tab" && !e.altKey && !e.ctrlKey && !e.shiftKey) {
+      } else if(e.key == "tab") {
+        this.tabComplete(inputbox, e.shift);
+
         new Event(e).stop();
-        this.tabComplete(inputbox);
+        e.preventDefault();
         return;
       } else {
-        /* ideally alt and other keys wouldn't break this */
-        this.resetTabComplete();
         return;
       }
       
@@ -218,6 +223,8 @@ qwebirc.ui.QUI = new Class({
       var result = resultfn.bind(this.commandhistory)();
       
       new Event(e).stop();
+      e.preventDefault();
+
       if(!result)
         result = "";
       this.lastcvalue = result;
@@ -448,7 +455,7 @@ qwebirc.ui.QUI.Window = new Class({
       this.scrollpos = this.getScrollParent().getScroll();
     }.bind(this));
     
-    if(type == qwebirc.ui.WINDOW_CHANNEL) {
+    if(type == qwebirc.ui.WINDOW_CHANNEL || type == qwebirc.ui.WINDOW_QUERY) {
       this.topic = new Element("div");
       this.parentObject.qjsui.applyClasses("topic", this.topic);
       this.topic.addClass("topic");
@@ -456,25 +463,35 @@ qwebirc.ui.QUI.Window = new Class({
       this.topic.set("html", " ");
       this.topic.addEvent("dblclick", this.editTopic.bind(this));
       this.parentObject.qjsui.applyClasses("topic", this.topic);
-      
+
       this.prevNick = null;
       this.nicklist = new Element("div");
       this.nicklist.addClass("nicklist");
       this.nicklist.addClass("tab-invisible");
       this.nicklist.addEvent("click", this.removePrevMenu.bind(this));
       this.parentObject.qjsui.applyClasses("right", this.nicklist);
+
+      this.updateTopic("");
     }
     
-    if(type == qwebirc.ui.WINDOW_CHANNEL)
-      this.updateTopic("");
-
     this.nicksColoured = this.parentObject.uiOptions.NICK_COLOURS;
     this.reflow();
   },
   rename: function(name) {
-    this.tab.replaceChild(document.createTextNode(name), this.tab.firstChild);
+    var newNode = document.createTextNode(name);
+    if(this.parentObject.sideTabs) {
+      this.tab.replaceChild(newNode, this.tab.childNodes[1]);
+    } else {
+      this.tab.replaceChild(newNode, this.tab.firstChild);
+    }
+
+    if(this.type == qwebirc.ui.WINDOW_QUERY)
+      this.updateTopic("");
   },
   editTopic: function() {
+    if(this.type != qwebirc.ui.WINDOW_CHANNEL)
+      return;
+
     if(!this.client.nickOnChanHasPrefix(this.client.nickname, this.name, "@")) {
 /*      var cmodes = this.client.getChannelModes(channel);
       if(cmodes.indexOf("t")) {*/
@@ -597,16 +614,23 @@ qwebirc.ui.QUI.Window = new Class({
     while(t.firstChild)
       t.removeChild(t.firstChild);
 
-    if(topic) {
-      t.topicText = topic;
-      this.parent(topic, t);
+    var suffix;
+    if(this.type == qwebirc.ui.WINDOW_CHANNEL) {
+      suffix = ": ";
     } else {
+      suffix = "";
+    }
+    qwebirc.ui.Colourise(this.name + suffix, t, null, null, this);
+
+    if(this.type == qwebirc.ui.WINDOW_CHANNEL) {
       t.topicText = topic;
-      var e = new Element("div");
-      e.set("text", "(no topic set)");
-      e.addClass("emptytopic");
-      t.appendChild(e);
+      if (topic) {
+        this.parent(topic, t);
+      } else {
+        t.appendChild(document.createTextNode("(no topic set)"));
+      }
     }
+
     this.reflow();
   },
   select: function() {