Skip to content

Commit

Permalink
1. Fix drag text bug.
Browse files Browse the repository at this point in the history
2. Fix cursor position bug.
  • Loading branch information
ettoolong committed Nov 16, 2015
1 parent 6c512ea commit 8820953
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 54 deletions.
28 changes: 20 additions & 8 deletions chrome/content/bbsfox.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,21 +398,16 @@ BBSFox.prototype={
var clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
if(this.prefs.deleteSpaceWhenCopy)
{
var splitter = this.os == 'WINNT' ? '\r\n' : '\n';
var strArray;
if(this.os == 'WINNT')
strArray = str.split('\r\n');
else
strArray = str.split('\n');
strArray = str.split(splitter);

str = '';
for (var i=0 ;i<strArray.length ;i++)
{
str+=this.trim_right(strArray[i]);
if(i<strArray.length-1){
if(this.os == 'WINNT')
str+='\r\n';
else
str+='\n';
str+=splitter;
}
}
}
Expand Down Expand Up @@ -1520,6 +1515,23 @@ BBSFox.prototype={

mouse_dragstart: function(event) {
this.DragText=true;

if(this.prefs.deleteSpaceWhenCopy) {
var str = event.dataTransfer.getData("text/plain");
var strArray;
var splitter = this.os == 'WINNT' ? '\r\n' : '\n';
strArray = str.split(splitter);

str = '';
for (var i=0 ;i<strArray.length ;i++)
{
str+=this.trim_right(strArray[i]);
if(i<strArray.length-1){
str+=splitter;
}
}
event.dataTransfer.setData("text/plain", str);
}
},

mouse_dragend: function(event) {
Expand Down
2 changes: 1 addition & 1 deletion chrome/content/ssh.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<div id='BBSWindow'>
<input id="t" type="text" style="border: none; width: 200px; height: 24px; position:absolute; left:-10000px; top:0px; z-index:2;resize: none;" autofocus/>
<div id='cursorDiv' class='main' style='z-index:1;'>
<div id="cursor" class="terminal_display">_</div>
<div id="cursor" class="terminal_display"></div>
</div>
<div id='main' class='main'>
</div>
Expand Down
2 changes: 1 addition & 1 deletion chrome/content/telnet.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div id='BBSWindow'>
<input id="t" type="text" style="border: none; width: 200px; height: 24px; position:absolute; left:-10000px; top:0px; z-index:2;resize: none;" autofocus/>
<div id='cursorDiv' class='main' style='z-index:1;'>
<div id="cursor" class="terminal_display">_</div>
<div id="cursor" class="terminal_display"></div>
</div>
<div id='main' class='main'>
</div>
Expand Down
50 changes: 26 additions & 24 deletions chrome/content/termview.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function TermView(colCount, rowCount) {

//this.DBDetection = false;
this.blinkShow = false;
this.cursorShow = false;
this.blinkOn = false;
this.doBlink = true;

Expand Down Expand Up @@ -106,7 +105,7 @@ function TermView(colCount, rowCount) {
//init view - end

var _this=this;
this.blinkTimeout = setTimer(true, function(){_this.onBlink();}, 500); //500
this.blinkTimeout = setTimer(true, function(){_this.onBlink();}, 1000); //500

this.highlightTimeout = null;
this.highlighter = new Highlighter(this);
Expand Down Expand Up @@ -136,18 +135,8 @@ TermView.prototype={
'#ffffff' // white
],
onBlink: function(){
this.cursorShow =! this.cursorShow;
//this.bbsCursor.style.display = this.cursorShow ? 'none' : 'block';
if(this.cursorShow)
{
this.bbsCursor.setAttribute('show', '0');
this.blinkOn=true;
this.buf.queueUpdate(true);
}
else
{
this.bbsCursor.removeAttribute('show');
}
this.blinkOn=true;
this.buf.queueUpdate(true);
},

showAlertMessageEx: function(blockByTime, showMsg, playSound, msg){
Expand Down Expand Up @@ -968,16 +957,30 @@ TermView.prototype={
this.cursorDiv.style.textAlign = this.mainDisplay.style.textAlign;
this.cursorDiv.style.width = this.mainDisplay.style.width;
this.cursorDiv.style.height = '0px';
this.cursorDiv.style.marginTop = '0px';
if(this.scaleX==1 && this.scaleY==1){
this.cursorDiv.style.top = '0px';
this.cursorDiv.style.marginTop = '0px';
} else {
this.cursorDiv.style.top = this.mainDisplay.style.marginTop;
this.cursorDiv.style.marginTop = '1px';
}
this.cursorDiv.style.transform = this.mainDisplay.style.transform;
this.bbsCursor.style.width = this.chw + 'px';
var curHeight = Math.floor(this.chh/6);
if(curHeight<2) curHeight = 2;
this.bbsCursor.style.height = curHeight + 'px';

this.updateCursorPos();
},

convertMN2XY: function (cx, cy){
var origin = [this.firstGrid.offsetLeft, this.firstGrid.offsetTop];
var realX = origin[0] + (cx) * this.chw;
var realY = origin[1] + 1 + (cy) * this.chh;
var origin = [this.firstGrid.offsetLeft, 0];
if(this.scaleX==1 && this.scaleY==1){
origin[1] = this.firstGrid.offsetTop;
}

var realX = origin[0] + (cx * this.chw);
var realY = origin[1] + (cy * this.chh);
return [realX, realY];
},

Expand All @@ -987,8 +990,8 @@ TermView.prototype={
origin = [((document.documentElement.clientWidth - (this.chw*this.buf.cols)*this.scaleX)/2), this.firstGrid.offsetTop];
else
origin = [this.firstGrid.offsetLeft, this.firstGrid.offsetTop];
var realX = origin[0] + (cx) * this.chw * this.scaleX;
var realY = origin[1] + (cy) * this.chh +1 + parseInt(this.mainDisplay.style.marginTop, 10);
var realX = origin[0] + (cx * this.chw) * this.scaleX;
var realY = origin[1] + (cy * this.chh) + 1 + parseInt(this.mainDisplay.style.marginTop, 10);
return [realX, realY];
},

Expand Down Expand Up @@ -1026,10 +1029,9 @@ TermView.prototype={
var bg = ch.getBg();

this.bbsCursor.style.left = pos[0] + 'px';
if(this.prefs.fixUnicodeDisplay)
this.bbsCursor.style.top = (pos[1]-1) + 'px';
else
this.bbsCursor.style.top = pos[1] + 'px';
var h = this.chh - parseInt(this.bbsCursor.style.height);
this.bbsCursor.style.top = pos[1] + h + 'px';

// if you want to set cursor color by now background, use this.
this.bbsCursor.setAttribute('cr', 'Iq'+bg);
this.updateInputBufferPos();
Expand Down
4 changes: 3 additions & 1 deletion chrome/locale/en-US/history.htm
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
</style>
</head>
<body>
<span class='s2'>Version 4.0.17 Updates:</span><br/>
<span class='s2'>Version 4.0.18 Updates:</span><br/>
‧Fix windows IME bug.<br/>
‧Fix drag text bug.<br/>
‧Fix cursor position bug.<br/>
‧Add highlight keyword function and setting.<br/>
‧Add UAO support.<br/>
<br/>
Expand Down
4 changes: 3 additions & 1 deletion chrome/locale/zh-TW/history.htm
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
</style>
</head>
<body>
<span class='s2'>4.0.17 版的改動:</span><br/>
<span class='s2'>4.0.18 版的改動:</span><br/>
‧修正windows下輸入法的問題。<br/>
‧修正拖曳文字的問題。<br/>
‧修正游標顯示位置錯誤的問題。<br/>
‧新增追蹤關鍵字的功能和設定。<br/>
‧加入UAO對照表。<br/>
<br/>
Expand Down
8 changes: 8 additions & 0 deletions chrome/skin/default/bbs.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ a:link,a:visited,a:active,a:hover {
text-decoration:none;
}

@keyframes blinkBgColor {
0% {opacity: 1;}
50% {opacity: 1;}
51% {opacity: 0;}
100% {opacity: 0;}
}

.terminal_display {
white-space: pre;
cursor: text;
Expand All @@ -59,6 +66,7 @@ a:link,a:visited,a:active,a:hover {
margin-top:0.1%;
-moz-user-select: none;
user-select: none;
animation: blinkBgColor 1s infinite linear;
}

img{background:white; color:black; padding:5px 5px;}
Expand Down
33 changes: 16 additions & 17 deletions chrome/skin/default/color.css
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
.BBSLine{display:inline;overflow: hidden;color:var(--bbscolor-7);white-space: pre;height: 1em;margin: 0px;padding: 0px;}
[cr="Iq0"]{color:var(--bbscolor-inv-0);}
[cr="Iq1"]{color:var(--bbscolor-inv-1);}
[cr="Iq2"]{color:var(--bbscolor-inv-2);}
[cr="Iq3"]{color:var(--bbscolor-inv-3);}
[cr="Iq4"]{color:var(--bbscolor-inv-4);}
[cr="Iq5"]{color:var(--bbscolor-inv-5);}
[cr="Iq6"]{color:var(--bbscolor-inv-6);}
[cr="Iq7"]{color:var(--bbscolor-inv-7);}
[cr="Iq8"]{color:var(--bbscolor-inv-8);}
[cr="Iq9"]{color:var(--bbscolor-inv-9);}
[cr="Iq10"]{color:var(--bbscolor-inv-10);}
[cr="Iq11"]{color:var(--bbscolor-inv-11);}
[cr="Iq12"]{color:var(--bbscolor-inv-12);}
[cr="Iq13"]{color:var(--bbscolor-inv-13);}
[cr="Iq14"]{color:var(--bbscolor-inv-14);}
[cr="Iq15"]{color:var(--bbscolor-inv-15);}
[cr*="Iq"][show="0"]{color:transparent;}
[cr="Iq0"]{background:var(--bbscolor-inv-0);}
[cr="Iq1"]{background:var(--bbscolor-inv-1);}
[cr="Iq2"]{background:var(--bbscolor-inv-2);}
[cr="Iq3"]{background:var(--bbscolor-inv-3);}
[cr="Iq4"]{background:var(--bbscolor-inv-4);}
[cr="Iq5"]{background:var(--bbscolor-inv-5);}
[cr="Iq6"]{background:var(--bbscolor-inv-6);}
[cr="Iq7"]{background:var(--bbscolor-inv-7);}
[cr="Iq8"]{background:var(--bbscolor-inv-8);}
[cr="Iq9"]{background:var(--bbscolor-inv-9);}
[cr="Iq10"]{background:var(--bbscolor-inv-10);}
[cr="Iq11"]{background:var(--bbscolor-inv-11);}
[cr="Iq12"]{background:var(--bbscolor-inv-12);}
[cr="Iq13"]{background:var(--bbscolor-inv-13);}
[cr="Iq14"]{background:var(--bbscolor-inv-14);}
[cr="Iq15"]{background:var(--bbscolor-inv-15);}
.qq{color:RGBA(0,0,0,0);}
.qq0{color:RGBA(0,0,0,0);}
.qq1{color:RGBA(0,0,0,0);background-color:var(--bbscolor-1);}
Expand Down
2 changes: 1 addition & 1 deletion install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<Description about="urn:mozilla:install-manifest">
<em:id>{86095750-AD15-46d8-BF32-C0789F7E6A32}</em:id>
<em:version>4.0.17</em:version>
<em:version>4.0.18</em:version>
<em:type>2</em:type>

<em:targetApplication><!-- Firefox -->
Expand Down

0 comments on commit 8820953

Please sign in to comment.