diff --git a/src/bin/typos-cli/report.rs b/src/bin/typos-cli/report.rs index 87e7e75..352672a 100644 --- a/src/bin/typos-cli/report.rs +++ b/src/bin/typos-cli/report.rs @@ -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 { diff --git a/tests/cmd/stdin-failure-multiwidth.stdout b/tests/cmd/stdin-failure-multiwidth.stdout index e6cf44a..62f71cc 100644 --- a/tests/cmd/stdin-failure-multiwidth.stdout +++ b/tests/cmd/stdin-failure-multiwidth.stdout @@ -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 | ^^^^^^^^^^