accepted 0.3.2

A text editor to be ACCEPTED.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::parenthesis;

pub fn next_indent_level(line: &str, indent_width: usize) -> usize {
    let base = line
        .chars()
        .take_while(|&c| c == ' ' || c == '\t')
        .map(|c| if c == ' ' { 1 } else { indent_width })
        .sum::<usize>()
        / indent_width;
    if parenthesis::PARENTHESIS_LEFTS
        .iter()
        .any(|&c| line.ends_with(c))
    {
        base + 1
    } else {
        base
    }
}