[Feature Request] Preserving multiple assignment operations on separate lines

View: New views
1 Messages — Rating Filter:   Alert me  

[Feature Request] Preserving multiple assignment operations on separate lines

by jvroutak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I'm using indent 2.2.9 on Windows platform.

I tried to search for solutions to the mentioned problem from the mailing list, man pages and the internet with no luck.

The problem is that we have C source code with formatting like this:

  wnd->txd   = Query(mos->som ,_TX);
  host->rxd  =
  ptu->rxd   =
  wnd->rxd   =
  inp->rxd   =
  heat->rxd  =
  rain->rxd  =
  txd->rxd   = Query(mos->som ,_RX);
  rxd->rain  =
  host->rain = Query(mos->som ,_RN);

The assignment operations line up nicely and the code is easy to read. What happens when we put this through indent:

    wnd->txd = Query(mos->som, _TX);
  host->rxd =
    ptu->rxd = wnd->rxd = inp->rxd = heat->rxd = rain->rxd = txd->rxd = Query(mos->som, _RX);
  rxd->rain = host->rain = Query(mos->som, _RN);

One hack around this is to add comments after each line like this:

 rxd->ht = Query(mos->som, _HT);
  host->txd =                   //
    rain->txd =                 //
    rxd->txd =                  //
    inp->txd =                  //
    heat->txd =                 //
    ptu->txd =                  //
    wnd->txd = Query(mos->som, _TX);

But then the lines or assignment signs are no longer lined up, and I'd have to add the comments after each line, so it's not an optimal solution.

Any ideas, or am I out of luck?

-Juho Routakorpi
LightInTheBox - Buy quality products at wholesale price!