From caf879297461ff94ef9d2a9d0e2e12406a97c722 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Fri, 25 Nov 2011 11:10:57 +0100 Subject: [PATCH] applying/removing list now preserves the indentation level --- static/js/ace2_inner.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/static/js/ace2_inner.js b/static/js/ace2_inner.js index 3da6bf80..bd313f52 100644 --- a/static/js/ace2_inner.js +++ b/static/js/ace2_inner.js @@ -5235,7 +5235,8 @@ function OUTER(gscope) var allLinesAreList = true; for (var n = firstLine; n <= lastLine; n++) { - if (!getLineListType(n)) + var listType = getLineListType(n); + if (!listType || listType.slice(0, 'bullet'.length) != 'bullet') { allLinesAreList = false; break; @@ -5245,8 +5246,16 @@ function OUTER(gscope) var mods = []; for (var n = firstLine; n <= lastLine; n++) { + var t = ''; + var level = 0; + var listType = /([a-z]+)([12345678])/.exec(getLineListType(n)); + if (listType) + { + t = listType[1]; + level = Number(listType[2]); + } var t = getLineListType(n); - mods.push([n, allLinesAreList ? '' : (t ? t : 'bullet1')]); + mods.push([n, allLinesAreList ? 'indent' + level : (t ? 'bullet' + level : 'bullet1')]); } setLineListTypes(mods); }