-- Leo's gemini proxy

-- Connecting to typed-hole.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

commit 6e23af3e3c226bff7475a41566dcd34dc5e3d458

Author: Julien Blanchard <julien@sideburns.eu>

Date: Sun May 10 16:38:30 2020 +0200


Wrap lines


diff --git a/Cargo.lock b/Cargo.lock

index d426246..6807c00 100644

--- a/Cargo.lock

+++ b/Cargo.lock

@@ -30,17 +30,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"


[[package]]

name = "asuka"

-version = "0.7.1"

+version = "0.8.0"

dependencies = [

- "cursive 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",

- "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",

- "json 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",

- "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",

- "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",

- "open 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",

- "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",

- "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",

- "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",

+ "cursive",

+ "dirs",

+ "json",

+ "lazy_static",

+ "native-tls",

+ "open",

+ "openssl",

+ "openssl-sys",

+ "regex",

+ "tempfile",

+ "textwrap",

+ "url",

]


[[package]]

@@ -813,6 +816,15 @@ dependencies = [

]


[[package]]

+name = "textwrap"

+version = "0.11.0"

+source = "registry+https://github.com/rust-lang/crates.io-index"

+checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"

+dependencies = [

+ "unicode-width",

+]

+

+[[package]]

name = "thread_local"

version = "0.3.6"

source = "registry+https://github.com/rust-lang/crates.io-index"

diff --git a/Cargo.toml b/Cargo.toml

index 2a3a6fa..8f678e8 100644

--- a/Cargo.toml

+++ b/Cargo.toml

@@ -1,11 +1,11 @@

[package]

name = "asuka"

-version = "0.7.1"

-authors = ["Julien Blanchard <julien@sideburns.eu>"]

+version = "0.8.0"

+authors = ["Julien Blanchard <julien@typed-hole.org>"]

edition = "2018"


[dependencies]

-cursive = "*"

+cursive = "0.13"

native-tls = "*"

url = "*"

regex = "*"

@@ -14,3 +14,4 @@ open = "*"

json = "*"

tempfile = "*"

dirs = "*"

+textwrap="*"

diff --git a/src/history.rs.rej b/src/history.rs.rej

deleted file mode 100644

index 623cf6a..0000000

--- a/src/history.rs.rej

+++ /dev/null

@@ -1,10 +0,0 @@

-diff a/src/history.rs b/src/history.rs (rejected hunks)

-@@ -2,7 +2,7 @@ use url::Url;

- use std::sync::Mutex;

-

- lazy_static! {

-- static ref HISTORY: Mutex<Vec<Url>> = Mutex::new(vec![]);

-+ static ref HISTORY: Mutex<BTreeSet<Url>> = Mutex::new(vec![]);

- }

-

- pub fn init() {

diff --git a/src/main.rs b/src/main.rs

index fcea5f8..a639836 100644

--- a/src/main.rs

+++ b/src/main.rs

@@ -249,6 +249,7 @@ fn draw_content(s: &mut Cursive, url: &Url, content: Option<Vec<u8>>) {

// set title and clear old content

set_title(s, url.as_str());

main_view.clear();

+ let screen_size = s.screen_size();


let content_str = String::from_utf8_lossy(&data).to_string();


@@ -312,7 +313,18 @@ fn draw_content(s: &mut Cursive, url: &Url, content: Option<Vec<u8>>) {

}

Link::Unknown(_, _) => (),

},

- Err(_) => main_view.add_item(str::replace(line, "\t", " "), String::from("0")),

+ Err(_) => {

+ let line = str::replace(line, "\t", " ");

+ let max_size = screen_size.x - 10;

+ if line.len() > max_size {

+ let lines = textwrap::fill(&line, max_size);

+ for l in lines.lines() {

+ main_view.add_item(l, String::from("0"));

+ };

+ } else {

+ main_view.add_item(line, String::from("0"));

+ }

+ }

}

}

}



---

Served by Pollux Gemini Server.

-- Response ended

-- Page fetched on Sun May 19 09:12:44 2024