From d4a7b874fcf49a227b3d3faba151873ef9050c50 Mon Sep 17 00:00:00 2001 From: mcmlxxix <> Date: Mon, 26 Mar 2012 22:50:05 +0000 Subject: [PATCH] fix line wrapping in frame.putmsg(), dont force crlf in chat window at bottom line --- exec/load/frame.js | 40 +++++++++++++++++++++------------------- exec/load/layout.js | 1 + 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/exec/load/frame.js b/exec/load/frame.js index 6a6f2da677..b6cfd92629 100644 --- a/exec/load/frame.js +++ b/exec/load/frame.js @@ -770,11 +770,8 @@ function Frame(x,y,width,height,attr,frame) { } break; default: /* Other stuff... specifically, check for right movement */ - if(ch.charCodeAt(0)>127) { + if(ch.charCodeAt(0)>127) pos.x+=ch.charCodeAt(0)-127; - if(pos.x>=this.width) - pos.x=this.width-1; - } break; } control_a = false; @@ -812,12 +809,19 @@ function Frame(x,y,width,height,attr,frame) { } this.gotoxy = function(x,y) { if(typeof x == "object" && x.x && x.y) { - position.cursor.x = x.x-1; - position.cursor.y = x.y-1; + if(validateCursor.call(this,x.x-1,x.y-1)) { + position.cursor.x = x.x-1; + position.cursor.y = x.y-1; + return true; + } + return false; + } + if(validateCursor.call(this,x-1,y-1)) { + position.cursor.x = x-1; + position.cursor.y = y-1; return true; } - position.cursor.x = x-1; - position.cursor.y = y-1; + return false; } this.getxy = function() { return { @@ -925,12 +929,18 @@ function Frame(x,y,width,height,attr,frame) { return false; return true; } + function validateCursor(x,y) { + if(x >= this.width) + return false; + if(y >= this.height) + return false; + } function putChar(ch,attr) { if(position.cursor.x >= this.width) { position.cursor.x=0; position.cursor.y++; } - while(position.cursor.y >= this.height) { + if(position.cursor.y >= this.height) { this.scroll(); position.cursor.y--; } @@ -1240,24 +1250,16 @@ function Cursor(x,y,frame) { return properties.x; }); this.__defineSetter__("x", function(x) { - if(x == undefined) + if(isNaN(x)) throw("invalid x coordinate: " + x); - else if(x < 0) - x = 0; - else if(x >= properties.frame.width) - x = properties.frame.width - 1; properties.x = x; }); this.__defineGetter__("y", function() { return properties.y; }); this.__defineSetter__("y", function(y) { - if(y == undefined) + if(isNaN(y)) throw("invalid y coordinate: " + y); - else if(y < 0) - y = 0; - else if(y > properties.frame.height) - y = properties.frame.height - 1; properties.y = y; }); diff --git a/exec/load/layout.js b/exec/load/layout.js index f3bfae23de..76e7977187 100644 --- a/exec/load/layout.js +++ b/exec/load/layout.js @@ -452,6 +452,7 @@ function LayoutView(title,frame,parent) { } } properties.chat = tab.chat; + tab.frame.lf_strict = false; break; case "GRAPHIC": //ToDo -- GitLab