@@ -351,8 +351,10 @@ function Headline:demote(amount, demote_child_headlines)
351
351
amount = amount or 1
352
352
demote_child_headlines = demote_child_headlines or false
353
353
vim .fn .setline (self .range .start_line , string.rep (' *' , amount ) .. self .line )
354
- for _ , content in ipairs (self .content ) do
355
- vim .fn .setline (content .range .start_line , string.rep (' ' , amount ) .. content .line )
354
+ if config .org_indent_mode == ' indent' then
355
+ for _ , content in ipairs (self .content ) do
356
+ vim .fn .setline (content .range .start_line , string.rep (' ' , amount ) .. content .line )
357
+ end
356
358
end
357
359
if demote_child_headlines then
358
360
for _ , headline in ipairs (self .headlines ) do
@@ -368,9 +370,11 @@ function Headline:promote(amount, promote_child_headlines)
368
370
return utils .echo_warning (' Cannot demote top level heading.' )
369
371
end
370
372
vim .fn .setline (self .range .start_line , self .line :sub (1 + amount ))
371
- for _ , content in ipairs (self .content ) do
372
- if vim .trim (content .line :sub (1 , amount )) == ' ' then
373
- vim .fn .setline (content .range .start_line , content .line :sub (1 + amount ))
373
+ if config .org_indent_mode == ' indent' then
374
+ for _ , content in ipairs (self .content ) do
375
+ if vim .trim (content .line :sub (1 , amount )) == ' ' then
376
+ vim .fn .setline (content .range .start_line , content .line :sub (1 + amount ))
377
+ end
374
378
end
375
379
end
376
380
if promote_child_headlines then
0 commit comments