bugfix authorcolors: wrong end position on multiline edit
This commit is contained in:
parent
5f7bc9fca5
commit
79325b8cca
@ -459,7 +459,12 @@ define([
|
|||||||
editor.on('change', function( cm, change ) {
|
editor.on('change', function( cm, change ) {
|
||||||
if (change.origin == "+input" || change.origin == "paste") {
|
if (change.origin == "+input" || change.origin == "paste") {
|
||||||
// add new author mark if text is added. marks from removed text are removed automatically
|
// add new author mark if text is added. marks from removed text are removed automatically
|
||||||
editor.markText({line: change.from.line, ch: change.from.ch}, {line: change.from.line + change.text.length-1, ch: change.from.ch + change.text[change.text.length-1].length}, {css: "background-color: " + authorcolor});
|
if (change.text.length > 1) {
|
||||||
|
to_ch = change.text[change.text.length-1].length;
|
||||||
|
} else {
|
||||||
|
to_ch = change.from.ch + change.text[change.text.length-1].length;
|
||||||
|
}
|
||||||
|
editor.markText({line: change.from.line, ch: change.from.ch}, {line: change.from.line + change.text.length-1, ch: to_ch}, {css: "background-color: " + authorcolor});
|
||||||
} else if (change.origin == "setValue") {
|
} else if (change.origin == "setValue") {
|
||||||
// on remote update: remove all marks, add new marks
|
// on remote update: remove all marks, add new marks
|
||||||
editor.getAllMarks().forEach(marker => marker.clear());
|
editor.getAllMarks().forEach(marker => marker.clear());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user