tabular icon indicating copy to clipboard operation
tabular copied to clipboard

[regression] cdac1a6 broke successive alignments of a same range in some cases

Open sim590 opened this issue 1 year ago • 1 comments

Let's say you have this starting text:

int thisVariable = callingThisFunction(thisArg, thisOtherArgument, 0);
                   callingThisFunction(noThisArgumentNowHere, nowThisArg, 0);
                   callingThisFunction(thisArg, hereIcomeWithAnotherArgument, 0);

since cdac1a6, if you use GTabularize argument_list, then you get:

int thisVariable = callingThisFunction(thisArg,               thisOtherArgument,            0);
callingThisFunction                   (noThisArgumentNowHere, nowThisArg,                   0);
callingThisFunction                   (thisArg,               hereIcomeWithAnotherArgument, 0);

instead of the proper:

int thisVariable = callingThisFunction(thisArg,               thisOtherArgument,            0);
                   callingThisFunction(noThisArgumentNowHere, nowThisArg,                   0);
                   callingThisFunction(thisArg,               hereIcomeWithAnotherArgument, 0);

which you do get on the parent of cdac1a6.

I don't know what cdac1a6 does fix really, but I have not noticed any clear advantage since I updated to cdac1a6, but I got this really annoying regression.

Since there is no mention of an issue linked to cdac1a6 supporting it, I'm wondering if it is really useful. The explanation in the commit only states that the approach to indentation has changed, but what does it fix?

For now, I will config my Vimrc to use tabular at the version prior to cdac1a6.

sim590 avatar Dec 31 '24 18:12 sim590

I'm experiencing the same issue since this commit. I typically use this plugin to realign trailing backslashes in C macros and the indentation is getting all messed up since cdac1a607c4781a6f4189a2e6184da93a5125116.

Here some code that needs realignment:

#define debug(fmt, ...) do {                 \
    if (verbose) {                           \
        fprintf(stderr, "DEBUG: %s: ", __func__);   \
        fprintf(stderr, fmt, ##__VA_ARGS__); \
    }                                        \
} while(0)

With version 84057252a01e96909cd1a9f0b1395f5d9f61be1e and the command :'<,'>Tabularize /\\$ (after selecting the lines in visual mode), I get:

#define debug(fmt, ...) do {                      \
    if (verbose) {                                \
        fprintf(stderr, "DEBUG: %s: ", __func__); \
        fprintf(stderr, fmt, ##__VA_ARGS__);      \
    }                                             \
} while(0)

With version cdac1a607c4781a6f4189a2e6184da93a5125116, I get:

#define debug(fmt, ...) do {              \
if (verbose) {                            \
fprintf(stderr, "DEBUG: %s: ", __func__); \
fprintf(stderr, fmt, ##__VA_ARGS__);      \
}                                         \
} while(0)

Fixing this regression would be great. For now, I force a specific commit in my vimrc file: Plug 'godlygeek/tabular', { 'commit': '8405725' }.

Thanks!

joel-porquet avatar Jan 28 '25 19:01 joel-porquet