mirror of
https://github.com/crate-ci/typos.git
synced 2024-12-25 17:12:16 -05:00
fix: Change column number to 1-based index
This commit is contained in:
parent
4ad2f49190
commit
f2de431701
2 changed files with 8 additions and 7 deletions
|
@ -181,7 +181,8 @@ fn print_long_correction(msg: &Typo, palette: Palette) -> Result<(), std::io::Er
|
|||
let line = String::from_utf8_lossy(msg.buffer.as_ref());
|
||||
let line = line.replace('\t', " ");
|
||||
let start = String::from_utf8_lossy(&msg.buffer[0..msg.byte_offset]);
|
||||
let column = unicode_segmentation::UnicodeSegmentation::graphemes(start.as_ref(), true).count();
|
||||
let column_number =
|
||||
unicode_segmentation::UnicodeSegmentation::graphemes(start.as_ref(), true).count() + 1;
|
||||
match &msg.corrections {
|
||||
typos::Status::Valid => {}
|
||||
typos::Status::Invalid => {
|
||||
|
@ -213,7 +214,7 @@ fn print_long_correction(msg: &Typo, palette: Palette) -> Result<(), std::io::Er
|
|||
" --> {}{}{}",
|
||||
palette.info.paint(context_display(&msg.context)),
|
||||
palette.info.paint(divider),
|
||||
palette.info.paint(column)
|
||||
palette.info.paint(column_number)
|
||||
)?;
|
||||
|
||||
if let Some(Context::File(context)) = &msg.context {
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
error: `Apropriate` should be `Appropriate`
|
||||
--> -:5:2
|
||||
--> -:5:3
|
||||
|
|
||||
5 | 한 Apropriate world
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
error: `Apropriate` should be `Appropriate`
|
||||
--> -:12:2
|
||||
--> -:12:3
|
||||
|
|
||||
12 | 한 Apropriate world
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
error: `Apropriate` should be `Appropriate`
|
||||
--> -:19:2
|
||||
--> -:19:3
|
||||
|
|
||||
19 | 👁️🗨️ Apropriate world
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
error: `Apropriate` should be `Appropriate`
|
||||
--> -:26:2
|
||||
--> -:26:3
|
||||
|
|
||||
26 | 😵💫 Apropriate world
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
error: `Apropriate` should be `Appropriate`
|
||||
--> -:33:1
|
||||
--> -:33:2
|
||||
|
|
||||
33 | Apropriate world
|
||||
| ^^^^^^^^^^
|
||||
|
|
Loading…
Reference in a new issue