},\r
\r
process: function (ev) {\r
- var inp = $(ev.currentTarget);\r
+ var inp = $(ev.currentTarget),\r
+ inp_val = inp.val();\r
\r
switch (true) {\r
- case (ev.keyCode === 13): // return\r
+ case (ev.keyCode === 13): // return\r
+ inp_val = inp_val.trim();\r
+\r
+ if (inp_val) {\r
this.processInput(inp.val());\r
\r
this.buffer.push(inp.val());\r
this.buffer_pos = this.buffer.length;\r
-\r
- inp.val('');\r
-\r
- break;\r
-\r
- case (ev.keyCode === 38): // up\r
- if (this.buffer_pos > 0) {\r
- this.buffer_pos--;\r
- inp.val(this.buffer[this.buffer_pos]);\r
- }\r
- break;\r
-\r
- case (ev.keyCode === 40): // down\r
- if (this.buffer_pos < this.buffer.length) {\r
- this.buffer_pos++;\r
- inp.val(this.buffer[this.buffer_pos]);\r
- }\r
+ }\r
+ \r
+ inp.val('');\r
+\r
+ break;\r
+\r
+ case (ev.keyCode === 38): // up\r
+ if (this.buffer_pos > 0) {\r
+ this.buffer_pos--;\r
+ inp.val(this.buffer[this.buffer_pos]);\r
+ }\r
+ break;\r
+\r
+ case (ev.keyCode === 40): // down\r
+ if (this.buffer_pos < this.buffer.length) {\r
+ this.buffer_pos++;\r
+ inp.val(this.buffer[this.buffer_pos]);\r
+ }\r
}\r
},\r
\r