【发布时间】:2013-11-10 10:05:05
【问题描述】:
我经常在 WordPress 博客和网络论坛 (phpbb) 上分享代码 sn-ps。
我使用带有Productivity Power Tools 的Visual Studio 2010。
通过使用此扩展 (Ctrl+Alt+]) 的 Align Assignment 选项,我得到了很好的格式:
static void Main()
{
int firstInt = 20;
int secondInt = 50;
int thisWillBeTheThirdInt = 100;
}
但是,如果我使用 FireFox、Chrome 复制粘贴(或不带格式的复制粘贴)到网站表单,或粘贴到 Notepadd++,格式将恢复为:
static void Main()
{
int firstInt = 20;
int secondInt = 50;
int thisWillBeTheThirdInt = 100;
}
问题:如何复制代码与对齐的分配?
到目前为止没有什么效果:
- 使用 AutoHotKey 粘贴为纯文本,
- Untabify Replacement 扩展,
- 我在 VS2010 中没有 tabify/untabify options,显然是因为 Productivity Power Tools disables 那个。
使用Better Fixed Mixed tabs 确实有所帮助,因为大多数空格都被制表符替换(确实可以正确复制/粘贴)。但是,在复制粘贴时,剩余的空格仍然会导致格式混乱。
【问题讨论】:
-
在您的博客或论坛中,您需要使用等宽字体
-
@Alberto,你是对的,谢谢。事后看来,这很明显,但我没有考虑过这种选择。感谢您指出。您能否将您的评论变成答案,然后我可以将此问题标记为已解决。
标签: c# visual-studio-2010 visual-studio