设置Ace编辑器的值时保留缩进

Preserve indentation when setting value of Ace editor

本文关键字:保留 缩进 Ace 编辑器 设置      更新时间:2023-09-26

如何保留.setValue()推送到Ace编辑器中的字符串的缩进?现在,当我把一个字符串推入编辑器时,所有的缩进都会丢失,并且它有一个奇怪的打字机间距:假设打字机是|如果

string to edit here with four space->    |

如果我按退格键,:

string to edit here with four space-   |

我不知道为什么会发生这种情况,请帮助

看起来Ace计算了错误的光标位置
如果您的编辑器具有非单空格字体,也可能发生这种情况
或者因为这个错误,如果你在Mac OS X 10.8 上使用Safari