Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c-mode: respect user-defined tab width for indentation #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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