1use console::AnsiCodeIterator;
3/// Expand tabs like an ANSI-enabled expand(1).
4pub fn expand(line: &str, width: usize, cursor: &mut usize) -> String {
5 let mut buffer = String::with_capacity(line.len() * 2);
7 for chunk in AnsiCodeIterator::new(line) {
9 (text, true) => buffer.push_str(text),
10 (mut text, false) => {
11 while let Some(index) = text.find('\t') {
15 buffer.push_str(&text[0..index]);
19 let spaces = width - (*cursor % width);
21 buffer.push_str(&*" ".repeat(spaces));
24 text = &text[index + 1..text.len()];
27 *cursor += text.len();
28 buffer.push_str(text);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list