Fixed bug with selection after blank

SVN revision: 1829
This commit is contained in:
Stefan Ritt 2007-04-03 18:20:20 +00:00
parent 65fd38aa76
commit 56ce472929

View File

@ -6,7 +6,8 @@ function getSelection(text)
rng.colapse; rng.colapse;
return rng.text; return rng.text;
} else if (browser == 'Mozilla') } else if (browser == 'Mozilla')
if (text.selectionEnd > 0 && text.value.charAt(text.selectionEnd-1) == ' ') if (text.selectionEnd > 0 && text.selectionEnd != text.selectionStart &&
text.value.charAt(text.selectionEnd-1) == ' ')
return text.value.substring(text.selectionStart, text.selectionEnd-1); return text.value.substring(text.selectionStart, text.selectionEnd-1);
else else
return text.value.substring(text.selectionStart, text.selectionEnd); return text.value.substring(text.selectionStart, text.selectionEnd);
@ -31,7 +32,8 @@ function replaceSelection(doc, text, newSelection, cursorPos)
} else if (browser == 'Mozilla') { } else if (browser == 'Mozilla') {
start = text.selectionStart; start = text.selectionStart;
stop = text.selectionEnd; stop = text.selectionEnd;
if (text.selectionEnd > 0 && text.value.charAt(text.selectionEnd-1) == ' ') if (text.selectionEnd > 0 && text.selectionStart != text.selectionEnd &&
text.value.charAt(text.selectionEnd-1) == ' ')
stop--; stop--;
end = text.textLength; end = text.textLength;
endtext = text.value.substring(stop, end); endtext = text.value.substring(stop, end);
@ -69,7 +71,7 @@ function elcode1(text, tag, value, selection)
else else
str = '['+tag+'='+value+']' + selection + '[/'+tag+']'; str = '['+tag+'='+value+']' + selection + '[/'+tag+']';
if (tag == '') if (tag == '')
pos = value.length; pos = value.length;
else if (tag == 'LIST') else if (tag == 'LIST')
pos = 11; pos = 11;