The characters are not getting typed where the cursor is

和自甴很熟 提交于 2021-02-17 06:27:16

问题


In my Ace editor, just after the scroll bars appear, the character are getting typed but not where the cursor is. See the picture below. What has gone wrong? The code seem to work OK in my dev environment.

I notice that the font for my dev environment is bigger than the font of my prod environment.

Dev env:

Prod env:

I don't understand that why there is a difference and if this is the cause of the issue.

After setting the fonts explicitly to courier new, the editor options are

editor options are   {selectionStyle: "line", highlightActiveLine: true, highlightSelectedWord: true, readOnly: false, copyWithEmptySelection: false, …}animatedScroll: falseautoScrollEditorIntoView: undefinedbehavioursEnabled: truecopyWithEmptySelection: falsecursorStyle: "ace"displayIndentGuides: truedragDelay: 0dragEnabled: trueenableBlockSelect: trueenableMultiselect: truefadeFoldWidgets: falsefirstLineNumber: 1fixedWidthGutter: undefinedfocusTimeout: 0foldStyle: "markbegin"fontFamily: "Courier New"fontSize: "14pt"hScrollBarAlwaysVisible: falsehasCssTransforms: undefinedhighlightActiveLine: truehighlightGutterLine: truehighlightSelectedWord: trueindentedSoftWrap: truekeyboardHandler: undefinedmaxLines: undefinedmaxPixelHeight: 0mergeUndoDeltas: trueminLines: undefinedmode: "ace/mode/html"navigateWithinSoftTabs: falsenewLineMode: "auto"overwrite: falseplaceholder: undefinedprintMargin: 80printMarginColumn: 80readOnly: falserelativeLineNumbers: undefinedscrollPastEnd: 0scrollSpeed: 2selectionStyle: "line"showFoldWidgets: trueshowGutter: trueshowInvisibles: falseshowLineNumbers: trueshowPrintMargin: truetabSize: 4theme: "ace/theme/eclipse"tooltipFollowsMouse: trueuseSoftTabs: trueuseTextareaForIME: trueuseWorker: truevScrollBarAlwaysVisible: falsewrap: "off"wrapBehavioursEnabled: true__proto__: Object

Update

It seems each line in the editor gets a class ace_gutter-cell. This class is not the same the dev and prod environment. position:absolute is missing in prod. See the images below. Am I picking differing builds of ace?

Dev:

Prod:


回答1:


This happens when you use a font that isn't monospaced; you have to use monospaced fonts with Ace.



来源:https://stackoverflow.com/questions/65603263/the-characters-are-not-getting-typed-where-the-cursor-is

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!