mirror of
https://github.com/RGBCube/alejandra
synced 2025-08-01 04:57:44 +00:00
Merge pull request #125 from kamadorueda/kamadorueda
fix: position update
This commit is contained in:
commit
2baec5927e
4 changed files with 4 additions and 4 deletions
|
@ -225,7 +225,7 @@ fn dedent_comment(pos: &crate::position::Position, text: &str) -> String {
|
||||||
lines[0] = "".to_string();
|
lines[0] = "".to_string();
|
||||||
} else {
|
} else {
|
||||||
lines.insert(0, format!("{0:<1$}", "", pos.column + 1));
|
lines.insert(0, format!("{0:<1$}", "", pos.column + 1));
|
||||||
lines[1] = format!("{0:<1$}{2}", "", pos.column + 1, lines[1]);
|
lines[1] = format!("{0:<1$}{2}", "", pos.column + 2, lines[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// println!("{:?}", lines);
|
// println!("{:?}", lines);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Layout {
|
pub enum Layout {
|
||||||
Tall,
|
Tall,
|
||||||
Wide,
|
Wide,
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl Position {
|
||||||
self.column = 0
|
self.column = 0
|
||||||
}
|
}
|
||||||
self.column += match chars.iter().rposition(|c| *c == '\n') {
|
self.column += match chars.iter().rposition(|c| *c == '\n') {
|
||||||
Some(pos) => chars.len() - pos,
|
Some(pos) => chars.len() - pos - 1,
|
||||||
None => chars.len(),
|
None => chars.len(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Some functions f
|
Some functions f
|
||||||
name attribute.
|
name attribute.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Add to or over
|
Add to or over
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue