summary refs log tree commit diff
path: root/webclient/room/room-directive.js
diff options
context:
space:
mode:
Diffstat (limited to 'webclient/room/room-directive.js')
-rw-r--r--webclient/room/room-directive.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/webclient/room/room-directive.js b/webclient/room/room-directive.js
index 8db4cb5d9a..05382cfcd3 100644
--- a/webclient/room/room-directive.js
+++ b/webclient/room/room-directive.js
@@ -52,12 +52,21 @@ angular.module('RoomController')
                 // console.log("targetIndex: " + targetIndex + ", 
                 // text=" + text);
                                     
-                // FIXME: use the correct regexp to recognise userIDs
+                // FIXME: use the correct regexp to recognise userIDs --M
+                //
                 // XXX: I don't really know what the point of this is. You
                 // WANT to match freeform text given you want to match display
                 // names AND user IDs. Surely you just want to get the last
                 // word out of the input text and that's that?
                 // Am I missing something here? -- Kegan
+                //
+                // You're not missing anything - my point was that we should
+                // explicitly define the syntax for user IDs /somewhere/.
+                // Meanwhile as long as the delimeters are well defined, we
+                // could just pick "the last word".  But to know what the
+                // correct delimeters are, we probably do need a formal
+                // syntax for user IDs to refer to... --Matthew
+                
                 var search = /@?([a-zA-Z0-9_\-:\.]+)$/.exec(text);
 
                 if (targetIndex === 0) { // 0 is always the original text
@@ -135,6 +144,21 @@ angular.module('RoomController')
         });
     };
 }])
+.directive('commandHistory', [ function() {
+    return function (scope, element, attrs) {
+        element.bind("keydown", function (event) {
+            var keycodePressed = event.which;
+            var UP_ARROW = 38;
+            var DOWN_ARROW = 40;
+            if (keycodePressed === UP_ARROW) {
+                scope.history.goUp(event);
+            }
+            else if (keycodePressed === DOWN_ARROW) {
+                scope.history.goDown(event);
+            } 
+        });
+    }
+}])
 
 // A directive to anchor the scroller position at the bottom when the browser is resizing.
 // When the screen resizes, the bottom of the element remains the same, not the top.