未在光标所在的位置输入字符

未在光标所在的位置输入字符

本文介绍了未在光标所在的位置输入字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Ace 编辑器中,就在滚动条出现之后,字符被输入,但不是光标所在的位置.见下图.出了什么问题?代码在我的开发环境中似乎运行正常.

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.

我注意到我的 dev 环境的字体比我的 prod 环境的字体大.

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

开发环境:

产品环境:

我不明白为什么会有差异,以及这是否是问题的原因.

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

fonts显式设置为courier new后,编辑器选项为

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

更新

似乎编辑器中的每一行都有一个 ace_gutter-cell 类.此类与devprod 环境不同.prod 中缺少 position:absolute.请参阅下面的图片.我是否选择了不同的 ace 版本?

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?

开发:

产品:

推荐答案

当您使用非等宽字体时会发生这种情况;你必须在 Ace 中使用等宽字体.

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

这篇关于未在光标所在的位置输入字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 00:05