Increase code syntax diversity, use github permalinks

This commit is contained in:
2026-03-31 04:55:55 +00:00
parent 79021db57f
commit eeb48157c5
4 changed files with 2210 additions and 156 deletions

View File

@@ -2089,24 +2089,20 @@ impl App {
let chosen = self.code_drill_language_override.clone().unwrap();
// Step 2: Check if we need to download (only if not already attempted)
if self.config.code_downloads_enabled
&& !self.code_download_attempted
&& !is_language_cached(&self.config.code_download_dir, &chosen)
{
if let Some(lang) = language_by_key(&chosen) {
if !lang.repos.is_empty() {
let repo_idx = self.rng.gen_range(0..lang.repos.len());
self.code_download_queue = vec![(chosen.clone(), repo_idx)];
self.code_intro_download_total = 1;
self.code_intro_downloaded = 0;
self.code_intro_downloading = true;
self.code_intro_current_repo = lang.repos[repo_idx].key.to_string();
self.code_download_action = CodeDownloadCompleteAction::StartCodeDrill;
self.code_download_job = None;
self.code_download_attempted = true;
self.screen = AppScreen::CodeDownloadProgress;
return;
}
if self.config.code_downloads_enabled && !self.code_download_attempted {
let queue =
build_code_download_queue(&chosen, &self.config.code_download_dir);
if !queue.is_empty() {
self.code_intro_download_total = queue.len();
self.code_download_queue = queue;
self.code_intro_downloaded = 0;
self.code_intro_downloading = true;
self.code_intro_current_repo.clear();
self.code_download_action = CodeDownloadCompleteAction::StartCodeDrill;
self.code_download_job = None;
self.code_download_attempted = true;
self.screen = AppScreen::CodeDownloadProgress;
return;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -5192,8 +5192,8 @@ mod review_tests {
.expect("de should be selectable");
let output = render_settings_to_string(&app);
assert!(output.contains("German"));
assert!(!output.contains("German (preview)"));
assert!(output.contains("Deutsch"));
assert!(!output.contains("Deutsch (preview)"));
assert!(output.contains("de_qwertz"));
assert!(!output.contains("qwerty (preview)"));
}
@@ -5396,7 +5396,7 @@ mod review_tests {
assert!(output.contains("default adaptive drill will mix in keys"));
assert!(output.contains("focus only on this branch"));
assert!(output.contains("from this branch in the Skill Tree."));
assert!(output.contains("Proceed? (y/n)"));
assert!(output.contains("[y] Unlock"));
}
#[test]
@@ -5408,7 +5408,7 @@ mod review_tests {
let output = render_skill_tree_to_string_with_size(&app, 90, 24);
assert!(output.contains("focus only on this branch"));
assert!(output.contains("from this branch in the Skill Tree."));
assert!(output.contains("Proceed? (y/n)"));
assert!(output.contains("[y] Unlock"));
}
#[test]