File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ Config::Config() {
1212 map_[" column_limit" ] = " 80" ;
1313 map_[" indent_width" ] = " 4" ;
1414 map_[" use_tab" ] = " false" ;
15+ map_[" tab_width" ] = " 4" ;
1516 map_[" continuation_indent_width" ] = " 4" ;
1617
1718 map_[" keep_simple_block_one_line" ] = " true" ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ class Config {
2626 BIND_INT (column_limit);
2727 BIND_INT (indent_width);
2828 BIND_BOOL (use_tab);
29+ BIND_INT (tab_width);
2930 BIND_INT (continuation_indent_width);
3031
3132 BIND_BOOL (keep_simple_block_one_line);
Original file line number Diff line number Diff line change @@ -1616,10 +1616,16 @@ string FormatVisitor::indent() {
16161616
16171617string FormatVisitor::indentWithAlign () {
16181618 stringstream ss;
1619- for (int i = 0 ; i < indent_ + indentForAlign_; i++) {
1620- if (config_.use_tab ()) {
1619+ if (config_.use_tab ()) {
1620+ int indent = indent_;
1621+ int tabWidth = config_.tab_width ();
1622+ indent += indentForAlign_ / tabWidth;
1623+ if (indentForAlign_ % tabWidth) indent++;
1624+ for (int i = 0 ; i < indent; i++) {
16211625 ss << " \t " ;
1622- } else {
1626+ }
1627+ } else {
1628+ for (int i = 0 ; i < indent_ + indentForAlign_; i++) {
16231629 ss << " " ;
16241630 }
16251631 }
You can’t perform that action at this time.
0 commit comments