diff --git a/Cargo.lock b/Cargo.lock index ba4b6f5..2619373 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -604,9 +604,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "ming-wm-lib" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79963d3f8d79e0bd7b4530b52448fbcb3be82dbf6901ffa99e870b1a28f8820e" +checksum = "de20ca223c0e37c8c05a69174ec8544f4c6f024a9d90321bf997882232510a42" [[package]] name = "miniz_oxide" diff --git a/Cargo.toml b/Cargo.toml index c7285d2..d4b76fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,5 +8,5 @@ name = "mingInternet_Koxinga_Browser" path = "src/main.rs" [dependencies] -ming-wm-lib = "0.1.3" +ming-wm-lib = "0.1.4" reqwest = { version = "0.12", features = [ "blocking" ] } diff --git a/README.md b/README.md index 136fbaa..d55ae54 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,13 @@ Hacker News frontpage: Wikipedia article: ![en.wikipedia.org/wiki/Ming_dynasty](koxinga_wiki.png) + +## Building / Installing + +After cloning the repo, + +``` +cargo build --release +chmod +x ./install #or ./local-install +./install +``` diff --git a/install b/install index 3a93474..53a7763 100644 --- a/install +++ b/install @@ -1,2 +1,3 @@ #!/bin/sh -cp ./target/release/mingInternet_Koxinga_Browser /usr/local/bin/mingInternet_Koxinga_Browser \ No newline at end of file +cp ./koxinga.md /usr/local/bin/ming_docs/window-likes/koxinga.md +cp ./target/release/mingInternet_Koxinga_Browser /usr/local/bin/mingInternet_Koxinga_Browser diff --git a/koxinga.md b/koxinga.md new file mode 100644 index 0000000..f7d3418 --- /dev/null +++ b/koxinga.md @@ -0,0 +1,9 @@ +Koxinga is a web browser supporting text and links. + +## Usage + +- `u`: URL mode, where a URL can be inputted. Hit enter/return to go to that page. +- `l`: Link mode. The page will now show numbers in front of any links. Input the number corresponding to the link to navigate to, then hit enter/return. +- `j`, `k` to scroll page. +- `0`: Go to top of page. +- `G`: Go to bottom of page. diff --git a/koxinga_hn.png b/koxinga_hn.png deleted file mode 100644 index d5e0ad0..0000000 Binary files a/koxinga_hn.png and /dev/null differ diff --git a/local-install b/local-install index 08c5d95..a4e3c39 100755 --- a/local-install +++ b/local-install @@ -1,2 +1,3 @@ #!/bin/sh -cp ./target/release/mingInternet_Koxinga_Browser ~/.local/bin/mingInternet_Koxinga_Browser \ No newline at end of file +cp ./koxinga.md ~/.local/bin/ming_docs/window-likes/koxinga.md +cp ./target/release/mingInternet_Koxinga_Browser ~/.local/bin/mingInternet_Koxinga_Browser diff --git a/src/main.rs b/src/main.rs index 27b5e16..6ecd1e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -186,7 +186,7 @@ impl WindowLike for KoxingaBrowser { for p in &self.page { let line_no = (p.1 - 2) / LINE_HEIGHT; if line_no >= self.top_line_no && line_no < self.top_line_no + max_lines_screen { - instructions.push(DrawInstructions::Text([p.0, p.1 - LINE_HEIGHT * self.top_line_no], vec!["nimbus-roman".to_string()], p.2.clone(), if p.3 { theme_info.top_text } else { theme_info.text }, theme_info.background, Some(1), Some(12))); + instructions.push(DrawInstructions::Text([p.0, p.1 - LINE_HEIGHT * self.top_line_no], vec!["nimbus-roman".to_string()], p.2.clone(), if p.3 { theme_info.top_text } else { theme_info.text }, theme_info.background, Some(1), Some(11))); } } //mode @@ -195,8 +195,13 @@ impl WindowLike for KoxingaBrowser { bottom_text += &self.url_input; } else if self.mode == Mode::Link { bottom_text += &self.link_input; + } else if self.mode == Mode::Normal && self.dimensions[0] >= 500 { + bottom_text += "u (url)"; + if self.url.is_some() { + bottom_text += ", l (link), j (down), k (up)"; + } } - instructions.push(DrawInstructions::Text([0, self.dimensions[1] - LINE_HEIGHT], vec!["nimbus-roman".to_string()], bottom_text, theme_info.text, theme_info.background, Some(1), Some(12))); + instructions.push(DrawInstructions::Text([0, self.dimensions[1] - LINE_HEIGHT], vec!["nimbus-roman".to_string()], bottom_text, theme_info.text, theme_info.background, Some(1), Some(11))); instructions } @@ -209,7 +214,7 @@ impl WindowLike for KoxingaBrowser { } fn ideal_dimensions(&self, _dimensions: Dimensions) -> Dimensions { - [410, 410] + [500, 410] } fn resizable(&self) -> bool { @@ -275,7 +280,7 @@ impl KoxingaBrowser { let mut line = String::new(); let mut start_x = x; for c in s.chars() { - if x + 14 > self.dimensions[0] { + if x + 12 > self.dimensions[0] { //full line, add draw instruction self.page.push((start_x, y, line, colour)); line = String::new(); @@ -284,7 +289,7 @@ impl KoxingaBrowser { y += LINE_HEIGHT; } line += &c.to_string(); - x += 13; + x += 12; } if line.len() > 0 { self.page.push((start_x, y, line, colour)); diff --git a/src/xml.rs b/src/xml.rs index 09fe516..ac8d34d 100644 --- a/src/xml.rs +++ b/src/xml.rs @@ -15,7 +15,7 @@ fn is_whitespace(c: char) -> bool { } fn handle_escaped(s: &str) -> String { - s.replace(" ", " ").replace("'", "'").to_string() + s.replace(" ", " ").replace("'", "'").replace(""", "\"").to_string() } #[derive(PartialEq)]