From ae033a1e867a722cafa49337ffbccec2e7452f6d Mon Sep 17 00:00:00 2001
From: Brian Lim <brian.lim.developer@gmail.com>
Date: Mon, 18 Jan 2016 23:57:40 -0500
Subject: [PATCH] Fix for 2844 and 2812

---
 src/static/js/ace2_inner.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js
index 5b7b48a0..8576ee33 100644
--- a/src/static/js/ace2_inner.js
+++ b/src/static/js/ace2_inner.js
@@ -5365,6 +5365,12 @@ function Ace2Inner(){
         level = Number(listType[2]);
       }
       var t = getLineListType(n);
+
+      // if already a list, deindent
+      if (allLinesAreList && level != 1) { level = level - 1;  }
+      // if already indented, then add a level of indentation to the list
+      else if (t && !allLinesAreList) { level = level + 1; }
+
       mods.push([n, allLinesAreList ? 'indent' + level : (t ? type + level : type + '1')]);
     }