kopia lustrzana https://github.com/backface/turtlestitch
slightly tweak text editing code
rodzic
31aed55227
commit
5ec7ad4f36
19
morphic.js
19
morphic.js
|
@ -1103,7 +1103,7 @@
|
||||||
|
|
||||||
/*global window, HTMLCanvasElement, FileReader, Audio, FileList*/
|
/*global window, HTMLCanvasElement, FileReader, Audio, FileList*/
|
||||||
|
|
||||||
var morphicVersion = '2016-October-10';
|
var morphicVersion = '2016-October-24';
|
||||||
var modules = {}; // keep track of additional loaded modules
|
var modules = {}; // keep track of additional loaded modules
|
||||||
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
|
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
|
||||||
|
|
||||||
|
@ -4965,7 +4965,8 @@ CursorMorph.prototype.init = function (aStringOrTextMorph) {
|
||||||
|
|
||||||
CursorMorph.prototype.initializeClipboardHandler = function () {
|
CursorMorph.prototype.initializeClipboardHandler = function () {
|
||||||
// Add hidden text box for copying and pasting
|
// Add hidden text box for copying and pasting
|
||||||
var myself = this;
|
var myself = this,
|
||||||
|
wrrld = this.target.world();
|
||||||
|
|
||||||
this.clipboardHandler = document.createElement('textarea');
|
this.clipboardHandler = document.createElement('textarea');
|
||||||
this.clipboardHandler.style.position = 'absolute';
|
this.clipboardHandler.style.position = 'absolute';
|
||||||
|
@ -4992,7 +4993,7 @@ CursorMorph.prototype.initializeClipboardHandler = function () {
|
||||||
function (event) {
|
function (event) {
|
||||||
myself.processKeyDown(event);
|
myself.processKeyDown(event);
|
||||||
if (event.shiftKey) {
|
if (event.shiftKey) {
|
||||||
myself.world().currentKey = 16;
|
wrrld.currentKey = 16;
|
||||||
}
|
}
|
||||||
this.value = myself.target.selection();
|
this.value = myself.target.selection();
|
||||||
this.select();
|
this.select();
|
||||||
|
@ -5010,7 +5011,7 @@ CursorMorph.prototype.initializeClipboardHandler = function () {
|
||||||
this.clipboardHandler.addEventListener(
|
this.clipboardHandler.addEventListener(
|
||||||
'keyup',
|
'keyup',
|
||||||
function (event) {
|
function (event) {
|
||||||
myself.world().currentKey = null;
|
wrrld.currentKey = null;
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
@ -7913,13 +7914,13 @@ StringMorph.prototype.previousWordFrom = function (aSlot) {
|
||||||
// if we are in the middle of a non-alphanumeric sequence, we'll get
|
// if we are in the middle of a non-alphanumeric sequence, we'll get
|
||||||
// right to the beginning of the previous word
|
// right to the beginning of the previous word
|
||||||
while (index > 0 && !isWordChar(this.text[index])) {
|
while (index > 0 && !isWordChar(this.text[index])) {
|
||||||
index -= 1
|
index -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// while the current character is a word one, we skip it until we
|
// while the current character is a word one, we skip it until we
|
||||||
// find the beginning of the current word
|
// find the beginning of the current word
|
||||||
while (index > 0 && isWordChar(this.text[index - 1])) {
|
while (index > 0 && isWordChar(this.text[index - 1])) {
|
||||||
index -= 1
|
index -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
|
@ -7929,11 +7930,11 @@ StringMorph.prototype.nextWordFrom = function (aSlot) {
|
||||||
var index = aSlot;
|
var index = aSlot;
|
||||||
|
|
||||||
while (index < this.endOfLine() && !isWordChar(this.text[index])) {
|
while (index < this.endOfLine() && !isWordChar(this.text[index])) {
|
||||||
index += 1
|
index += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (index < this.endOfLine() && isWordChar(this.text[index])) {
|
while (index < this.endOfLine() && isWordChar(this.text[index])) {
|
||||||
index += 1
|
index += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
|
@ -8231,7 +8232,7 @@ StringMorph.prototype.selectBetweenWordsAt = function (slot) {
|
||||||
|
|
||||||
while (this.endMark < this.text.length
|
while (this.endMark < this.text.length
|
||||||
&& !isWordChar(this.text[this.endMark])) {
|
&& !isWordChar(this.text[this.endMark])) {
|
||||||
this.endMark += 1
|
this.endMark += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.drawNew();
|
this.drawNew();
|
||||||
|
|
Ładowanie…
Reference in New Issue