Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions data/src/config/scoutlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,10 @@
],
"list_line" => ["linje", "linje", "rad", "line"],
"list_syntax" => [
"Ett ord eller uttrykk per linje: ord, ord*, *ord eller re:regex. Legg til # forklaring og !1-3 for alvorlighet. Linjer som starter med # er kommentarer.",
"Ét ord eller udtryk pr. linje: ord, ord*, *ord eller re:regex. Tilføj # forklaring og !1-3 for alvorlighed. Linjer der starter med # er kommentarer.",
"Ett ord eller uttryck per rad: ord, ord*, *ord eller re:regex. Lägg till # förklaring och !1-3 för allvarlighet. Rader som börjar med # är kommentarer.",
"One word or phrase per line: word, word*, *word or re:regex. Add # meaning and !1-3 for severity. Lines starting with # are comments.",
"Ett ord eller uttrykk per linje: ord, ord*, *ord eller re:regex. Legg til «# forklaring» og «!1-3» for alvorlighet. Linjer som starter med # er kommentarer.",
"Ét ord eller udtryk pr. linje: ord, ord*, *ord eller re:regex. Tilføj «# forklaring» og «!1-3» for alvorlighed. Linjer der starter med # er kommentarer.",
"Ett ord eller uttryck per rad: ord, ord*, *ord eller re:regex. Lägg till «# förklaring» och «!1-3» för allvarlighet. Rader som börjar med # är kommentarer.",
"One word or phrase per line: word, word*, *word or re:regex. Add \"# meaning\" and \"!1-3\" for severity. Lines starting with # are comments.",
],
"list_plain" => [
"En oppføring per linje. Tomme linjer hoppes over.",
Expand Down Expand Up @@ -660,7 +660,7 @@
"keyboard_help" => [
"Klikk på en tast og trykk tastene du vil bruke.",
"Klik på en tast og tryk de taster, du vil bruge.",
"Klicka på en tangent och tryck de tangenter du vill använda.",

Check warning on line 663 in data/src/config/scoutlink.rs

View workflow job for this annotation

GitHub Actions / typos

"vill" should be "will".
"Click a key, then press the keys you want to use.",
],
"kb_help_cancel" => ["avbryter,", "afbryder,", "avbryter,", "cancels,"],
Expand Down Expand Up @@ -707,7 +707,7 @@
"kb_hotkey_word" => {
["hurtigtast", "hurtigtast", "snabbtangent", "hotkey"]
}
"kb_swap" => ["Bytt", "Byt", "Byt", "Swap"],

Check warning on line 710 in data/src/config/scoutlink.rs

View workflow job for this annotation

GitHub Actions / typos

"Byt" should be "Byte".

Check warning on line 710 in data/src/config/scoutlink.rs

View workflow job for this annotation

GitHub Actions / typos

"Byt" should be "Byte".
"kb_bare_warn" => [
"Denne tasten trykkes også når du skriver i chatten, så handlingen kjøres hver gang du skriver tegnet. Bruk Ctrl, Alt eller Super sammen med tasten.",
"Denne tast trykkes også, når du skriver i chatten, så handlingen køres hver gang, du skriver tegnet. Brug Ctrl, Alt eller Super sammen med tasten.",
Expand Down
28 changes: 28 additions & 0 deletions src/buffer/config_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ enum Code {

#[derive(Debug, Clone, Copy)]
enum ListCode {
/// Text without a colour of its own.
Plain,
Comment,
Meaning,
/// `word*` or `*word`
Expand All @@ -755,6 +757,30 @@ enum ListCode {
Invalid,
}

/// Covers the whole line: what no part claims is plain text, so it is drawn
/// in the normal text colour.
fn fill_gaps(
line: &str,
mut parts: Vec<(Range<usize>, ListCode)>,
) -> Vec<(Range<usize>, ListCode)> {
parts.sort_by_key(|(range, _)| range.start);

let mut out = Vec::new();
let mut at = 0;
for (range, code) in parts {
if range.start > at {
out.push((at..range.start, ListCode::Plain));
}
at = at.max(range.end);
out.push((range, code));
}
if at < line.len() {
out.push((at..line.len(), ListCode::Plain));
}

out
}

/// The coloured parts of one line of a word list.
fn list_line(line: &str) -> Vec<(Range<usize>, ListCode)> {
let trimmed = line.trim_start();
Expand Down Expand Up @@ -832,6 +858,7 @@ impl ConfigParser {
} else {
Vec::new()
};
let parts = fill_gaps(line, parts);

return Box::new(
parts
Expand Down Expand Up @@ -910,6 +937,7 @@ fn config_highlight(output: Code, theme: &Theme) -> Style {
Code::List(code) => {
let text = theme.styles().text;
let color = match code {
ListCode::Plain => text.primary.color,
ListCode::Comment | ListCode::Meaning => text.secondary.color,
ListCode::Affix => {
text.info.color.unwrap_or(text.primary.color)
Expand Down
13 changes: 7 additions & 6 deletions src/modal/flag_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,18 +444,19 @@ impl FlagViewer {
row![
icon::config().width(13).height(13),
text(self.t("fv_edit")).size(small),
container(text(self.t("fv_recommended")).size(small - 2.0))
.padding([1, 7])
.style(move |theme: &Theme| theme::container::chip(
theme, info
)),
]
.spacing(7)
.align_y(Alignment::Center),
)
.padding([5, 12])
.style(theme::button::action_primary)
.on_press(act(Action::Edit(kind)));
let recommended =
container(text(self.t("fv_recommended")).size(small - 2.0))
.padding([1, 7])
.style(move |theme: &Theme| {
theme::container::chip(theme, info)
});

let mut top = row![
back,
Expand All @@ -482,7 +483,7 @@ impl FlagViewer {
theme,
));
}
top = top.push(edit);
top = top.push(recommended).push(edit);

let default = self.default_severity();
let shown = filter(
Expand Down
11 changes: 6 additions & 5 deletions src/modal/scoutlink/rows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,18 @@ pub fn list_row<'a>(
row![
icon::config().width(13).height(13),
text(settings.t("fv_edit")),
container(
text(settings.t("fv_recommended")).size(theme::TEXT_SIZE - 3.0)
)
.padding([1, 7])
.style(move |theme: &Theme| theme::container::chip(theme, info)),
]
.spacing(7)
.align_y(Alignment::Center),
)
.padding([5, 12])
.style(theme::button::action_primary)
.on_press(Message::ScoutLink(Action::EditList(kind)));
let recommended = container(
text(settings.t("fv_recommended")).size(theme::TEXT_SIZE - 3.0),
)
.padding([1, 7])
.style(move |theme: &Theme| theme::container::chip(theme, info));

row![
iced::widget::column![
Expand All @@ -191,6 +191,7 @@ pub fn list_row<'a>(
]
.spacing(2)
.width(iced::Length::Fill),
recommended,
edit,
]
.spacing(10)
Expand Down
Loading