Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit48cd91b

Browse files
author
Zibi Braniecki
committed
Update color support
1 parent6c5002a commit48cd91b

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

‎examples/multislice.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
externcrate annotate_snippets;
22

33
use annotate_snippets::display_list::DisplayList;
4-
use annotate_snippets::snippet::{Annotation,AnnotationType,Slice,Snippet,TitleAnnotation};
4+
use annotate_snippets::snippet::{AnnotationType,Slice,Snippet,TitleAnnotation};
55

66
fnmain(){
77
let snippet =Snippet{

‎src/format_color.rs‎

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extern crate ansi_term;
33
useself::ansi_term::Color::Fixed;
44
useself::ansi_term::Style;
55
use display_list::{DisplayAnnotationType,DisplayLine,DisplayList,DisplayMark,
6-
DisplaySnippetType};
6+
DisplaySnippetType,DisplayHeaderType};
77
use display_list_formatting::DisplayListFormatting;
88
use std::fmt;
99

@@ -109,15 +109,29 @@ impl DisplayListFormatting for Formatter {
109109
Style::new().bold().paint(format!(": {}", label))
110110
)
111111
}
112-
DisplayLine::Origin{ path, row, col} =>writeln!(
113-
f,
114-
"{}{} {}:{}:{}",
115-
" ".repeat(lineno_width),
116-
Fixed(12).bold().paint("-->"),
112+
DisplayLine::Origin{
117113
path,
118-
row,
119-
col
120-
),
114+
pos,
115+
header_type,
116+
} =>{
117+
let header_sigil =match header_type{
118+
DisplayHeaderType::Initial =>"-->",
119+
DisplayHeaderType::Continuation =>":::",
120+
};
121+
ifletSome((row, col)) = pos{
122+
writeln!(
123+
f,
124+
"{}{} {}:{}:{}",
125+
" ".repeat(lineno_width),
126+
Fixed(12).bold().paint(header_sigil),
127+
path,
128+
row,
129+
col
130+
)
131+
}else{
132+
writeln!(f,"{}{} {}"," ".repeat(lineno_width),Fixed(12).bold().paint(header_sigil), path,)
133+
}
134+
}
121135
DisplayLine::EmptySource =>{
122136
let prefix =format!("{} |"," ".repeat(lineno_width));
123137
writeln!(f,"{}",Fixed(12).bold().paint(prefix))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp