Skip to content
Snippets Groups Projects
Commit fc7d8306 authored by mcmlxxix's avatar mcmlxxix
Browse files

fixed some command handling bugs. added pageup/pagedown to chat views...

fixed some command handling bugs. added pageup/pagedown to chat views (home/end).. scroll to end of frame when submitting a new message (or receiving a new message)
parent 02b6d57d
No related branches found
No related tags found
No related merge requests found
...@@ -190,7 +190,7 @@ function Layout(frame) { ...@@ -190,7 +190,7 @@ function Layout(frame) {
this.getcmd=function(cmd) { this.getcmd=function(cmd) {
if(!cmd) if(!cmd)
return false; return false;
switch(cmd.toUpperCase()) { switch(cmd) {
case '\x09': case '\x09':
if(properties.views.length > 1) if(properties.views.length > 1)
nextView(); nextView();
...@@ -404,8 +404,10 @@ function LayoutView(title,frame,parent) { ...@@ -404,8 +404,10 @@ function LayoutView(title,frame,parent) {
f.open(); f.open();
setContent(t,type,content); setContent(t,type,content);
properties.tabs.push(t); properties.tabs.push(t);
if(this.current) if(this.current) {
this.current.active=true; //this.current.active=true;
this.current = properties.index;
}
setTabs(); setTabs();
return t; return t;
} }
...@@ -447,7 +449,7 @@ function LayoutView(title,frame,parent) { ...@@ -447,7 +449,7 @@ function LayoutView(title,frame,parent) {
this.getcmd=function(cmd) { this.getcmd=function(cmd) {
if(!cmd) if(!cmd)
return false; return false;
switch(cmd.toUpperCase()) { switch(cmd) {
case KEY_LEFT: case KEY_LEFT:
if(properties.tabs.length > 1) { if(properties.tabs.length > 1) {
properties.tabs[properties.index].active = false; properties.tabs[properties.index].active = false;
...@@ -507,19 +509,25 @@ function LayoutView(title,frame,parent) { ...@@ -507,19 +509,25 @@ function LayoutView(title,frame,parent) {
else else
tab.chat = new JSONChat(); tab.chat = new JSONChat();
tab.getcmd = function(cmd) { tab.getcmd = function(cmd) {
switch(cmd.toUpperCase()) { switch(cmd) {
case KEY_HOME:
return this.frame.pageup();
case KEY_END:
return this.frame.pagedown();
case KEY_UP: case KEY_UP:
return this.frame.scroll(0,-1); return this.frame.scroll(0,-1);
case KEY_DOWN: case KEY_DOWN:
return this.frame.scroll(0,1); return this.frame.scroll(0,1);
default: default:
this.frame.scrollTo(1,this.frame.data_height - this.frame.height);
return this.chat.submit.call(this.chat,this.title,cmd); return this.chat.submit.call(this.chat,this.title,cmd);
} }
} }
tab.cycle = function() { tab.cycle = function() {
var chan = this.chat.channels[this.title.toUpperCase()]; var chan = this.chat.channels[this.title.toUpperCase()];
if(!chan) if(!chan || chan.messages.length == 0)
return false; return false;
this.frame.scrollTo(1,this.frame.data_height - this.frame.height);
while(chan.messages.length > 0) { while(chan.messages.length > 0) {
var msg = chan.messages.shift(); var msg = chan.messages.shift();
var str = ""; var str = "";
...@@ -531,6 +539,7 @@ function LayoutView(title,frame,parent) { ...@@ -531,6 +539,7 @@ function LayoutView(title,frame,parent) {
this.frame.putmsg(str + "\r\n"); this.frame.putmsg(str + "\r\n");
} }
} }
//tab.chat.chatView = tab.parent;
properties.chat = tab.chat; properties.chat = tab.chat;
tab.frame.lf_strict = false; tab.frame.lf_strict = false;
tab.frame.word_wrap = true; tab.frame.word_wrap = true;
...@@ -538,7 +547,7 @@ function LayoutView(title,frame,parent) { ...@@ -538,7 +547,7 @@ function LayoutView(title,frame,parent) {
break; break;
case "FRAME": case "FRAME":
tab.getcmd = function(cmd) { tab.getcmd = function(cmd) {
switch(cmd.toUpperCase()) { switch(cmd) {
case KEY_UP: case KEY_UP:
return this.frame.scroll(0,-1); return this.frame.scroll(0,-1);
case KEY_DOWN: case KEY_DOWN:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment