mirror of
https://github.com/beautifier/js-beautify.git
synced 2024-11-30 08:00:55 +00:00
Merge pull request #267 from will-v-king/master
added a deindent() function .
This commit is contained in:
commit
8fe8e64922
@ -436,6 +436,10 @@
|
||||
function indent() {
|
||||
flags.indentation_level += 1;
|
||||
}
|
||||
|
||||
function deindent() {
|
||||
flags.indentation_level -= 1;
|
||||
}
|
||||
|
||||
function set_mode(mode) {
|
||||
if (flags) {
|
||||
@ -1160,7 +1164,7 @@
|
||||
print_newline();
|
||||
if (flags.case_body || opt.jslint_happy) {
|
||||
// switch cases following one another
|
||||
flags.indentation_level--;
|
||||
deindent();
|
||||
flags.case_body = false;
|
||||
}
|
||||
print_token();
|
||||
|
@ -450,6 +450,8 @@ class Beautifier:
|
||||
def indent(self):
|
||||
self.flags.indentation_level += 1
|
||||
|
||||
def deindent(self):
|
||||
self.flags.indentation_level -= 1
|
||||
|
||||
def set_mode(self, mode):
|
||||
if self.flags:
|
||||
@ -990,7 +992,7 @@ class Beautifier:
|
||||
self.append_newline()
|
||||
if self.flags.case_body or self.opts.jslint_happy:
|
||||
self.flags.case_body = False
|
||||
self.flags.indentation_level -= 1
|
||||
self.deindent()
|
||||
self.append_token(token_text)
|
||||
self.flags.in_case = True
|
||||
self.flags.in_case_statement = True
|
||||
|
Loading…
Reference in New Issue
Block a user