Better nbsp handling: visual nbsp + selection tools now paste space instead of nbsp if it was originally a space

This commit is contained in:
Florian Mounier
2014-12-15 11:06:35 +01:00
parent 7e0e7f60d9
commit 66846b50a2
10 changed files with 21 additions and 13 deletions

View File

@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '1.5.9'
__version__ = '1.5.10'
import os

View File

@@ -38,3 +38,6 @@ $bg: #000 !default
.blur .cursor.reverse-video
background: none
.nbsp
@extend .underline
@extend .fg-color-1

View File

@@ -135,7 +135,7 @@
};
Selection.prototype.text = function() {
return this.selection.toString();
return this.selection.toString().replace(/\u00A0/g, ' ').replace(/\u2007/, ' ');
};
Selection.prototype.up = function() {

File diff suppressed because one or more lines are too long

View File

@@ -186,10 +186,10 @@ html, body {
.bg-color-1.reverse-video {
color: #cc0000 !important; }
.fg-color-1 {
.fg-color-1, .nbsp {
color: #cc0000;
text-shadow: 0 0 6px rgba(204, 0, 0, 0.5); }
.fg-color-1.reverse-video {
.fg-color-1.reverse-video, .reverse-video.nbsp {
background-color: #cc0000 !important; }
.bg-color-2 {
@@ -3058,7 +3058,7 @@ html, body {
.bold {
font-weight: bold; }
.underline {
.underline, .nbsp {
text-decoration: underline; }
.blink {
@@ -3073,3 +3073,4 @@ html, body {
.blur .cursor.reverse-video {
background: none; }

View File

@@ -526,7 +526,9 @@
out += "&gt;";
break;
default:
if (ch <= " ") {
if (ch === " ") {
out += '<span class="nbsp">\u2007</span>';
} else if (ch <= " ") {
out += "&nbsp;";
} else {
if (("\uff00" < ch && ch < "\uffef")) {

File diff suppressed because one or more lines are too long

View File

@@ -78,7 +78,7 @@ class Selection
@clear()
text: ->
@selection.toString()
@selection.toString().replace(/\u00A0/g, ' ').replace(/\u2007/, ' ')
up: ->
@go -1

View File

@@ -453,7 +453,9 @@ class Terminal
when ">"
out += "&gt;"
else
if ch <= " "
if ch == " "
out += '<span class="nbsp">\u2007</span>'
else if ch <= " "
out += "&nbsp;"
else
i++ if "\uff00" < ch < "\uffef"

View File

@@ -1,6 +1,6 @@
{
"name": "butterfly",
"version": "1.5.5",
"version": "1.5.10",
"description": "A sleek web based terminal emulator",
"repository": {
"type": "git",