[Vim-latex-devel] New Idea for vim-latex
Brought to you by:
srinathava,
tmaas
From: Srinath A. <sr...@fa...> - 2005-01-13 00:54:53
|
Hello all, Its been a long time since the list has seen any emails... I've been busy and it looks like other than the occassional, "why can I not use my alt keys" email, there have been no major bugs. Recently, I was thinking of the next cool thing which could be done in latex-suite. An idea came up while talking with a friend... I've written up a description of the idea etc... Please take a look and see if you think its interesting... I am open to ideas on how to implement this. Idea follows: Normally, we view the diff between two text files on a line by line basis. This works fine for code where most logical structure is demarcated on a line by line basis. (obfuscators notwithstanding). However, for flowing text, which latex files resemble more than code, it does not quite make sense to have differences highlighted on a line by line basis. "Units" of language can be thought to be sentences. The idea is therefore, a way to view a diff between two files in a non line by line manner. Vertically diffsplit windows are also something which work only for line by line diffs. So for example, suppose one of the files is this: ================================================== Vertically diffsplit windows are also something which work only for line by line diffs. For diffs which do not follow the constraint of end of lines, the most intuitive way to view diffs seems to be to have a single window having one version of the file which the differences basically shown interpersed in the same view. ================================================== and another is this ================================================== Vertically diffsplit windows are also something which work only for line by line diffs. For diffs which do not follow the constraint of eol's, the most intuitive way to view differences between files seems to be to have a single window having one version of the file which the differences basically shown interpersed in the same view. ================================================== Note how the change from "end of line" to "eol" makes two lines change, although logically, it was only one change. If we run a simple diff between the two files using vim's native diffsplit, then apart from the first two lines which are identical, every other line will show a diff. In actual fact, there are only a couple of changes: end of lines -> eol's diffs -> differences between files So what is needed is obviously a way to convey to the user the two actual differences. This is a two part problem: 1. Calculating a difference which is not not line by line but sentence by sentence or even word by word. I beleive that this is an easy problem. I already have written up a simple python program which prints the word by difference. So for example, for the two files above, it would generate the following output: ================================================== Vertically diffsplit windows are also something which work only for line by line diffs. For diffs which do not follow the constraint of <+end of lines+><-eol's->, the most intuitive way to view <+diffs+><-differences between files-> seems to be to have a single window having one version of the file which the differences basically shown interpersed in the same view. ================================================== 2. Find a way to convey this diference to the user in a easily graspable way. This in my opinion is the hard part. Ideally, if Vim had in-line folding, the "<+original text+>" would be folded away and we would show a little "?" in its place. The "<-new text->" would be shown with the "<-" and "->" parts folded away and the "new text" colored differently. I tried Vince Ngeri's conceal patch and couldn't get it to work quite reliably... Whenever I split another window, strange things happen to the highlighting... The concealed text reappears etc... If someone can get it to work robustly, that will be cool. If someone can think of a completely different way to present the diff without the conceal patch, that will be even cooler. (I cannot think of a way). Thanks, Srinath |