Repository navigation
wrong caret position on moving left with inlined decoration #3772
|
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
var editor = monaco.editor.create(document.getElementById('container'), {
value: "function hello() {\n\talert('Hello world!');\n}",
language: 'javascript'
});
editor.getModel().deltaDecorations([], [{
range: {
startLineNumber: 1,
endLineNumber: 1,
startColumn: 1 << 30,
endColumn: 1 << 30
},
options: {
after: {
content: "Inlined text",
inlineClassNameAffectsLetterSpacing: true,
},
showIfCollapsed: true
}
}]);
Actual cursor position is : function hello() {Inlined text|
alert('Hello world!');
}Expected: function hello() {|Inlined text
alert('Hello world!');
} |
Replies: 3 comments 1 reply
|
This is the current behavior of inserted text, it creates two distinct view cursor stops (one before the inserted text and one after the inserted text). You can discover the two distinct view cursor stops by clicking with the mouse. Both view cursor stops map to the same model cursor position, therefore we have decided to skip one when moving left/right. When moving left, we stop at the second one and skip the first one. When moving right, we stop at the first one and skip the second one. IMHO we could add more API such that this can be made configurable by the creator of the inserted text. |
|
Annotations are not allowed to register JSON directly If I want to use comments in JSON without reporting errors, what should I do. If we can use "setcompileroptions" So which configuration is it |


This is the current behavior of inserted text, it creates two distinct view cursor stops (one before the inserted text and one after the inserted text). You can discover the two distinct view cursor stops by clicking with the mouse. Both view cursor stops map to the same model cursor position, therefore we have decided to skip one when moving left/right. When moving left, we stop at the second one and skip the first one. When moving right, we stop at the first one and skip the second one. IMHO we could add more API such that this can be made configurable by the creator of the inserted text.
cc Henning Dieterichs (@hediet)