chiark / gitweb /
Forgot to break overlong logical lines.
authorSimon Tatham <anakin@pobox.com>
Fri, 29 Dec 2023 14:34:18 +0000 (14:34 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 29 Dec 2023 18:17:34 +0000 (18:17 +0000)
Now URLs show up in a way that you can actually paste into a browser.

src/file.rs

index ad2c8b47ab2369fb86411953d164e4437d7f25a2..1719fe3d136bf6ab438e962ce4878bfd9ffb86a5 100644 (file)
@@ -43,10 +43,14 @@ impl ActivityState for FeedFile {
             -> (Vec<ColouredString>, CursorPosition) {
         let mut lines = Vec::new();
 
-        for item in &self.items {
-            lines.extend(item.render(w).iter().map(|line| line.to_owned()));
-            if lines.len() + 1 >= h {
-                break;
+        'outer: for item in &self.items {
+            for line in item.render(w) {
+                for frag in line.split(w) {
+                    lines.push(frag.to_owned());
+                    if lines.len() + 1 >= h {
+                        break 'outer;
+                    }
+                }
             }
         }