Re: Idea: How about logical lines?



On 5 November 2016 at 20:52, Per Dalgas Jakobsen <pdj knaldgas dk> wrote:
On 11/05/2016 05:42 AM, andré wrote:
Per Dalgas Jakobsen a écrit :
Now I'm looking for a way to let Meld ignore formatting of the code,
...
Is it a good idea to let Meld (and other diffs) find changes based on
logical lines as an alternative to physical lines? Like a
switch/preference to use logical lines instead (with options for
line-continuation and line-end).
Have I overlooked some important considerations here?

Interesting idea, but wouldn't meld have to understand the structure of the language coded ?

It seems to me that it would be difficult to code such comparisons, but I could be mistaken.  Breaking out the logical lines would be one step, but for the comparison to be useful, it would also have to locate the logical lines in the initial (physical line) file.

If one is comparing different changes to the same file, I wouldn't expect that a logical line comparison would produce vastly different results than a physical line comparison.

Well, Meld does not have to understand the code structure as such, only how a logical line is defined (for the language in question). I believe that having Meld ignoring comments by regex-filtering, the same could be done for logical lines.

While this is true, Meld *doesn't* have any kind of filtered line <=> file line mapping. This is also the reason that we've never supported filtering out line breaks in our regex filters. Fixing this would be fantastic, and I think would probably enable what you want.
 
I know that having logical lines ending with a non CR/LF character allows for multiple logical lines in one physical line, and if Melds internal diffing is based on physical lines

The diffing is based on a straight-up linebreak split of the filtered text. However, we definitely assume that a line in the filtered text corresponds directly to a line in the UI's text buffer. In cases where these don't match (and we've had a few over the years) the result is very, very broken comparisons and UI state.

cheers,
Kai


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]