如何区分重新包装的文本?

发布于 2024-12-26 05:34:49 字数 496 浏览 0 评论 0原文

编辑文档时,我总是坚持最大 80 或 150 个字符的特定行宽,具体取决于我正在编写的内容(代码、文本等)。如果我只改变一点点,整个段落就会移动,因此多行现在以不同的顺序排列,以最适合给定的线宽。我如何区分它以查看实际的变化而不是重新包装的工件?

示例,文本宽度=30: 在此处输入图像描述

实际更改相当微小:

  • 第 9 行插入:“现在我改变了一点”
  • 第 15 行插入: “在这里填写一些东西,用更多的行写出全新的东西。”
  • 第 18 行更改:s/Duis/TYPO/

如果其他软件可以完成所需的差异,我在这里使用 (g)vimdiff 的事实并不重要。

当然,软件设计为当文本到达窗口边框时自动换行,因此我也尝试在段落末尾仅使用换行符。这不好的原因是,自动差异是基于行的,对于段落中的小变化,我得到整行,这意味着整个段落作为差异更新:(。

When editing documents I always stick to a certain line width of max 80 or 150 characters, depends what I am writing (code, text, etc.). If I change only a little the whole paragraph will shift and hence multiple lines are now in different order to optimal fit for the given line width. How do I diff this to see the actual real change an not the rewrapping artifacts?

Example, textwidth=30:
enter image description here

The actual changes are rather tiny:

  • line 9 insert: "Now I change a little"
  • line 15 insert: "Fill in here something and write totally new stuff with much more lines. "
  • line 18 change: s/Duis/TYPO/

The fact that I use (g)vimdiff here is of no matter, if other software can accomplish the desired diff.

Of course software is designed to wrap automatically when text reaches window borders, so I also tried to use just line breaks in the end of a paragraph. The reason why this is not good is, that automatically diffs are line based, and for small changes in paragraphs I get the whole line, meaning then the whole paragraph as diff update :(.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

谢绝鈎搭 2025-01-02 05:34:49

GNU wdiff 进行逐字比较,不会以任何不同的方式处理空格和换行符。人们甚至可以找到它的 vim 语法文件(例如此处)。

$ cat file1
Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Aenean vel molestie
nulla. Pellentesque placerat lacus vel
eros malesuada tristique. Nulla vitae
volutpat justo. Donec est mauris,

$ cat file2
Lorem amet, consectetur adipiscing some
inserted text! elit. Aenean vel molestie
nulla. Pellentesque placerat lacus vel
eros malesuada replacement. Nulla vitae
volutpat justo. Donec est mauris,

$ wdiff file1 file2
Lorem [-ipsum dolor sit-] amet, consectetur
adipiscing {+some inserted text!+} elit. Aenean vel molestie
nulla. Pellentesque placerat lacus vel
eros malesuada [-tristique.-] {+replacement.+} Nulla vitae
volutpat justo. Donec est mauris

[- ... -] 是删除的文本,{+ ... +} 是插入的文本)。

(还有其他 diff 程序可以做类似的事情:例如 adiff,也许还有一些列于https://stackoverflow.com/questions/12625/best-diff-tool

GNU wdiff does a word-by-word diff, not treating spaces and new lines any differently. One can even find vim syntax files for it (e.g. here).

$ cat file1
Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Aenean vel molestie
nulla. Pellentesque placerat lacus vel
eros malesuada tristique. Nulla vitae
volutpat justo. Donec est mauris,

$ cat file2
Lorem amet, consectetur adipiscing some
inserted text! elit. Aenean vel molestie
nulla. Pellentesque placerat lacus vel
eros malesuada replacement. Nulla vitae
volutpat justo. Donec est mauris,

$ wdiff file1 file2
Lorem [-ipsum dolor sit-] amet, consectetur
adipiscing {+some inserted text!+} elit. Aenean vel molestie
nulla. Pellentesque placerat lacus vel
eros malesuada [-tristique.-] {+replacement.+} Nulla vitae
volutpat justo. Donec est mauris

([- ... -] is deleted text, {+ ... +} is inserted text).

(There are other diff programs that do a similar thing: e.g. adiff, and maybe some of the ones listed in https://stackoverflow.com/questions/12625/best-diff-tool)

来日方长 2025-01-02 05:34:49

我喜欢使用超越比较进行这种并排文件比较。还可以让您进行文件夹比较和位级比较,您可以右键单击以选择左侧文件进行比较,然后再单击另一个文件以选择右侧文件;或者选择两个文件并右键单击“比较”以立即将它们显示出来。

在此处输入图像描述

I like Beyond Compare for this kind of side-by-side file comparison. Also lets you do folder comparisons and bit-level comparisons, and you can right-click to select the left-hand file to compare, then another to select the right-hand one; or select two files and right-click Compare to bring them both up straight away.

enter image description here

涙—继续流 2025-01-02 05:34:49

我使用 DiffMerge,它是免费的,可以在许多平台上使用。

在此处输入图像描述

I use DiffMerge which is free and available on many platforms.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文