Logo Search packages:      
Sourcecode: uncrustify version File versions

void reindent_line ( chunk_t pc,
int  column 
)

Changes the initial indent for a line to the given column

Parameters:
pc The chunk at the start of the line
column The desired column

Definition at line 139 of file indent.cpp.

References chunk_t::column, chunk_t::len, chunk_t::nl_count, chunk_t::orig_col, chunk_t::orig_line, chunk_t::parent_type, chunk_t::str, and chunk_t::type.

{
   int col_delta;
   int min_col;

   LOG_FMT(LINDLINE, "%s: %d] col %d on %.*s [%s] => %d\n",
           __func__, pc->orig_line, pc->column, pc->len, pc->str,
           get_token_name(pc->type), column);

   if (column == pc->column)
   {
      return;
   }
   col_delta  = column - pc->column;
   pc->column = column;
   min_col    = pc->column;

   do
   {
      min_col += pc->len;
      pc       = chunk_get_next(pc);
      if (pc != NULL)
      {
         if (chunk_is_comment(pc) && (pc->parent_type != CT_COMMENT_EMBED))
         {
            pc->column = pc->orig_col;
            if (pc->column < min_col)
            {
               pc->column = min_col + 1;
            }
            LOG_FMT(LINDLINE, "%s: set comment on line %d to col %d (orig %d)\n",
                    __func__, pc->orig_line, pc->column, pc->orig_col);
         }
         else
         {
            pc->column += col_delta;
            if (pc->column < min_col)
            {
               pc->column = min_col;
            }
         }
      }
   } while ((pc != NULL) && (pc->nl_count == 0));
}


Generated by  Doxygen 1.6.0   Back to index