Skip to content

Commit

Permalink
c-mode: respect user defined tab width in indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Hennigar committed Jan 11, 2025
1 parent fbc84fc commit 3709546
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/cmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
extern int changemode(int, int, char *);

static int cc_strip_trailp = TRUE; /* Delete Trailing space? */
static int cc_basic_indent = 8; /* Basic Indent multiple */
static int cc_cont_indent = 4; /* Continued line indent */
static int cc_colon_indent = -8; /* Label / case indent */

static int getmatch(int, int);
static int getindent(const struct line *, int *);
Expand Down Expand Up @@ -324,17 +321,17 @@ getindent(const struct line *lp, int *curi)
* we continue
*/
if (colonp) {
*curi += cc_colon_indent;
newind -= cc_colon_indent;
*curi += -curbp->b_tabw;
newind -= -curbp->b_tabw;
}

*curi -= (cbrace) * cc_basic_indent;
newind += obrace * cc_basic_indent;
*curi -= (cbrace) * curbp->b_tabw;
newind += obrace * curbp->b_tabw;

if (nparen < 0)
newind -= cc_cont_indent;
newind -= curbp->b_tabw / 2;
else if (nparen > 0)
newind += cc_cont_indent;
newind += curbp->b_tabw / 2;

*curi += nicol;

Expand Down

0 comments on commit 3709546

Please sign in to comment.