From bdd58ea5e376cacfab8642ef2504a53402f2daf1 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Tue, 17 Jun 2025 22:42:34 +0800 Subject: [PATCH] Fix typos Found via `typos --hidden --format brief` --- config/.oxrc | 4 ++-- kaolinite/src/document/mod.rs | 4 ++-- kaolinite/tests/test.rs | 2 +- plugins/ai.lua | 2 +- plugins/autoindent.lua | 2 +- plugins/themes/default16.lua | 2 +- plugins/themes/galaxy.lua | 2 +- plugins/themes/tropical.lua | 2 +- src/config/highlighting.rs | 2 +- src/config/interface.rs | 2 +- src/config/mod.rs | 2 +- src/editor/documents.rs | 2 +- src/editor/editing.rs | 2 +- src/editor/interface.rs | 8 ++++---- src/main.rs | 4 ++-- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/config/.oxrc b/config/.oxrc index 55211dc4..9e7dc274 100644 --- a/config/.oxrc +++ b/config/.oxrc @@ -543,10 +543,10 @@ syntax:set("macro", {223, 52, 249}) -- Macro names in various programming langua syntax:set("namespace", {47, 141, 252}) -- Namespaces in various programming languages syntax:set("struct", {47, 141, 252}) -- The names of structs, classes, enums in various programming languages syntax:set("operator", {113, 113, 169}) -- Operators in various programming languages e.g. +, -, * etc -syntax:set("boolean", {86, 217, 178}) -- Booleans in various programming langauges e.g. true / false +syntax:set("boolean", {86, 217, 178}) -- Booleans in various programming languages e.g. true / false syntax:set("table", {47, 141, 252}) -- Tables in various programming languages syntax:set("reference", {134, 76, 232}) -- References in various programming languages -syntax:set("tag", {40, 198, 232}) -- Tags in various markup langauges e.g. HTML

tags +syntax:set("tag", {40, 198, 232}) -- Tags in various markup languages e.g. HTML

tags syntax:set("heading", {47, 141, 252}) -- Headings in various markup languages e.g. # in markdown syntax:set("link", {223, 52, 249}) -- Links in various markup languages e.g. URLs syntax:set("key", {223, 52, 249}) -- Keys in various markup languages diff --git a/kaolinite/src/document/mod.rs b/kaolinite/src/document/mod.rs index ce73e0e7..c8e07187 100644 --- a/kaolinite/src/document/mod.rs +++ b/kaolinite/src/document/mod.rs @@ -132,7 +132,7 @@ impl Document { self.file.line_to_char(loc.y) + loc.x } - /// Function to search the document to find the next occurance of a regex + /// Function to search the document to find the next occurrence of a regex pub fn next_match(&mut self, regex: &str, inc: usize) -> Option { // Prepare let mut srch = Searcher::new(regex); @@ -161,7 +161,7 @@ impl Document { None } - /// Function to search the document to find the previous occurance of a regex + /// Function to search the document to find the previous occurrence of a regex pub fn prev_match(&mut self, regex: &str) -> Option { // Prepare let mut srch = Searcher::new(regex); diff --git a/kaolinite/tests/test.rs b/kaolinite/tests/test.rs index b099f075..27859383 100644 --- a/kaolinite/tests/test.rs +++ b/kaolinite/tests/test.rs @@ -35,7 +35,7 @@ fn regex() { assert_eq!(reg.captures("aaac").as_slice().len(), 1); let reg = regex!(r"\\{\{\{{}"); assert_eq!(reg.as_str(), "a^"); - assert_eq!(reg.captures("abd").as_slice().len(), 0); + assert_eq!(reg.captures("and").as_slice().len(), 0); } #[test] diff --git a/plugins/ai.lua b/plugins/ai.lua index 0e3c214d..2b5d9594 100644 --- a/plugins/ai.lua +++ b/plugins/ai.lua @@ -190,7 +190,7 @@ function ai:send_to_chatgpt(prompt) :gsub("([$`!])", "\\%1") local url = "https://api.openai.com/v1/chat/completions" local headers = '-H "Content-Type: application/json" -H "Authorization: Bearer ' .. self.key .. '"' - local cmd = 'curl -s ' .. headers .. ' -d "{\'model\': \'gpt-4\', \'messages\':[{\'role\':\'user\', \'content\':\'' .. prompt .. '\'}], \'temprature\':0.7}" "' .. url .. '"' + local cmd = 'curl -s ' .. headers .. ' -d "{\'model\': \'gpt-4\', \'messages\':[{\'role\':\'user\', \'content\':\'' .. prompt .. '\'}], \'temperature\':0.7}" "' .. url .. '"' local json = shell:output(cmd) -- Find the `content` field within the JSON string diff --git a/plugins/autoindent.lua b/plugins/autoindent.lua index 3ddd1645..23d541b6 100644 --- a/plugins/autoindent.lua +++ b/plugins/autoindent.lua @@ -124,7 +124,7 @@ function autoindent:get_indent(y) return #(line:match("^\t+") or "") + #(line:match("^ +") or "") / document.tab_width end --- Utilties for when moving lines around +-- Utilities for when moving lines around function autoindent:fix_indent() -- Check the indentation of the line above this one (and match the line the cursor is currently on) local indents_above = autoindent:get_indent(editor.cursor.y - 1) diff --git a/plugins/themes/default16.lua b/plugins/themes/default16.lua index 12771158..9f2a1fe1 100644 --- a/plugins/themes/default16.lua +++ b/plugins/themes/default16.lua @@ -1,5 +1,5 @@ --- Pallette -- +-- Palette -- black = 'black' darkgrey = 'darkgrey' red = 'red' diff --git a/plugins/themes/galaxy.lua b/plugins/themes/galaxy.lua index e1da9e5e..cfacc4e1 100644 --- a/plugins/themes/galaxy.lua +++ b/plugins/themes/galaxy.lua @@ -1,5 +1,5 @@ --- Pallette -- +-- Palette -- black = '#1e1e2e' grey1 = '#24273a' grey2 = '#303446' diff --git a/plugins/themes/tropical.lua b/plugins/themes/tropical.lua index a4033fa2..8c3106cc 100644 --- a/plugins/themes/tropical.lua +++ b/plugins/themes/tropical.lua @@ -1,5 +1,5 @@ --- Pallette -- +-- Palette -- black = '#232336' grey1 = '#353552' grey2 = '#484863' diff --git a/src/config/highlighting.rs b/src/config/highlighting.rs index b08cf408..31a65328 100644 --- a/src/config/highlighting.rs +++ b/src/config/highlighting.rs @@ -121,7 +121,7 @@ impl LuaUserData for SyntaxHighlighting { for rule_idx in 1..=(rules.len()?) { // Get rule let rule = rules.get::>(rule_idx)?; - // Find type of rule and attatch it to the highlighter + // Find type of rule and attach it to the highlighter match rule["kind"].as_str() { "keyword" => { highlighter.keyword(rule["name"].clone(), &rule["pattern"]); diff --git a/src/config/interface.rs b/src/config/interface.rs index 57c6e405..de992c7b 100644 --- a/src/config/interface.rs +++ b/src/config/interface.rs @@ -310,7 +310,7 @@ impl TabLine { result = result.replace(&m.text, r.to_string_lossy().as_str()); } Err(e) => { - *fb = Feedback::Error(format!("Error occured in tab line: {e:?}")); + *fb = Feedback::Error(format!("Error occurred in tab line: {e:?}")); break; } } diff --git a/src/config/mod.rs b/src/config/mod.rs index a658420b..638952ef 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -257,7 +257,7 @@ impl Config { if let Some(idx) = plugins.iter().position(|p| p.ends_with(name)) { // User wants the plug-in let path = &plugins[idx]; - // true if plug-in isn't avilable + // true if plug-in isn't available !std::path::Path::new(path).exists() } else { // User doesn't want the plug-in diff --git a/src/editor/documents.rs b/src/editor/documents.rs index 449c496c..981b6d54 100644 --- a/src/editor/documents.rs +++ b/src/editor/documents.rs @@ -337,7 +337,7 @@ impl FileLayout { /// Remove any empty atoms pub fn clean_up(&mut self) { - // Continue checking for obselete nodes until none are remaining + // Continue checking for obsolete nodes until none are remaining while let Some(empty_idx) = self.empty_atoms(vec![]) { // Delete the empty node self.remove(empty_idx.clone()); diff --git a/src/editor/editing.rs b/src/editor/editing.rs index ffcfb156..846c4cb9 100644 --- a/src/editor/editing.rs +++ b/src/editor/editing.rs @@ -22,7 +22,7 @@ impl Editor { self.try_doc_mut().unwrap().commit(); } } else if self.try_doc().unwrap().event_mgmt.history.is_empty() { - // If there is no initial commit and a plug-in changes things without commiting + // If there is no initial commit and a plug-in changes things without committing // It can cause the initial state of the document to be lost // This condition makes sure there is a copy to go back to if this is the case self.try_doc_mut().unwrap().commit(); diff --git a/src/editor/interface.rs b/src/editor/interface.rs index af9ce37c..6c346a8f 100644 --- a/src/editor/interface.rs +++ b/src/editor/interface.rs @@ -891,14 +891,14 @@ impl Editor { /// Update highlighter of a certain document pub fn update_highlighter_for(&mut self, ptr: &[usize], doc: usize) { - let percieved = self.highlighter_for(ptr.to_owned(), doc).line_ref.len(); + let perceived = self.highlighter_for(ptr.to_owned(), doc).line_ref.len(); if self.active { if let Some((ref mut fcs, _)) = self.files.get_atom_mut(ptr.to_owned()) { let actual = fcs[doc].doc.info.loaded_to; - if percieved < actual { - let diff = actual.saturating_sub(percieved); + if perceived < actual { + let diff = actual.saturating_sub(perceived); for i in 0..diff { - let line = fcs[doc].doc.lines[percieved + i].clone(); + let line = fcs[doc].doc.lines[perceived + i].clone(); fcs[doc].highlighter.append(&line); } } diff --git a/src/main.rs b/src/main.rs index 9a79aa3d..37f8daf9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -281,7 +281,7 @@ fn handle_event(editor: &AnyUserData, event: &CEvent, lua: &Lua) -> Result<()> { } } - // Handle plug-in after key press mappings (if no errors occured) + // Handle plug-in after key press mappings (if no errors occurred) if let CEvent::Key(key) = event { let key_str = key_to_string(key.modifiers, key.code); let code = run_key(&key_str); @@ -384,7 +384,7 @@ fn handle_file_opening(editor: &AnyUserData, result: Result<()>, name: &str) { ErrorKind::ReadOnlyFilesystem => fatal_error("You are on a read only file system"), ErrorKind::ResourceBusy => fatal_error(&format!("The resource '{name}' is busy")), ErrorKind::OutOfMemory => fatal_error("You are out of memory"), - kind => fatal_error(&format!("I/O error occured: {kind:?}")), + kind => fatal_error(&format!("I/O error occurred: {kind:?}")), }, _ => fatal_error(&format!("Backend error opening '{name}': {kerr:?}")), },