@@ -1873,14 +1873,17 @@ pub fn indent(cx: &mut Context) {
1875pub fn unindent(cx: &mut Context) {
1875pub fn unindent(cx: &mut Context) {
1876+ let count = cx.count;
1876 let (view, doc) = cx.current();
1877 let (view, doc) = cx.current();
1877 let lines = get_lines(doc, view.id);
1878 let lines = get_lines(doc, view.id);
1878 let mut changes = Vec::with_capacity(lines.len());
1879 let mut changes = Vec::with_capacity(lines.len());
1879 let tab_width = doc.tab_width();
1880 let tab_width = doc.tab_width();
1881+ let indent_width = count * tab_width;
1881 for line_idx in lines {
1883 for line_idx in lines {
1882 let line = doc.text().line(line_idx);
1884 let line = doc.text().line(line_idx);
1883 let mut width = 0;
1885 let mut width = 0;
1885 for ch in line.chars() {
1888 for ch in line.chars() {
1886 match ch {
1889 match ch {
@@ -1889,14 +1892,17 @@ pub fn unindent(cx: &mut Context) {
1889 _ => break,
1892 _ => break,
1892− if width >= tab_width {
1897+ if width >= indent_width {
1902+ // now delete from start to first non-blank
1897− if width > 0 {
1903+ if pos > 0 {
1898 let start = doc.text().line_to_char(line_idx);
1904 let start = doc.text().line_to_char(line_idx);
1899− changes.push((start, start + width, None))
1905+ changes.push((start, start + pos, None))