Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
c-mode: respect user defined tab width in indentation
Example: 1. set a custom tab width via `set-tab-width` (e.g., 4). 2. open c-mode, type of block of C code, and indent. Expected behavior: One tab character per indentation level (or spaces if no-tab-mode enabled). Actual behavior: Multiple tabs/spaces inserted to reach an indentation of 8 columns. This patch updates `getindent` to respect the user-defined tab width (`curbp->b_tabw`) when calculating indentation levels, instead of always assuming 8 columns. Previously, when the user set `set-tab-width` to 4, `c-mode` would request 8 columns of indentation, resulting in two tab characters being inserted instead of one. This caused incorrect indentation for KNF-compliant code.
- Loading branch information