chiark / gitweb /
Delete some of my commented-out prototype code.
authorSimon Tatham <anakin@pobox.com>
Thu, 28 Dec 2023 09:01:13 +0000 (09:01 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 28 Dec 2023 09:06:16 +0000 (09:06 +0000)
The new Tui structure now replicates almost all the useful
functionality of that. The only exception is the extra loop where we
re-split each line returned from render() to the screen width, in case
it's overlong. But that can't be centralised into the current code: it
will have to live in the draw() method of ActivityState types that
need it (particularly, those rendering paragraphs), because they'll
need to know when it happened in order to count screen lines
correctly.

src/main.rs

index 3c2e5cb5138130078772645e27b853f934bcc961..402a5029b8d2d03a77cfd5e0098167c657106e91 100644 (file)
@@ -49,64 +49,7 @@ fn streaming() -> Result<(), mastodonochrome::OurError> {
 }
 */
 
-/*
-#[allow(unused)]
-fn tui(paras: Vec<Paragraph>) -> std::io::Result<()> {
-    stdout().execute(EnterAlternateScreen)?;
-    enable_raw_mode()?;
-    let mut terminal = Terminal::new(CrosstermBackend::new(stdout()))?;
-    terminal.clear()?;
-
-    loop {
-        terminal.draw(|frame| {
-                let area = frame.size();
-                let buf = frame.buffer_mut();
-                buf.reset();
-                let mut y = 0;
-                for para in &paras {
-                    for line in para.render(area.width as usize) {
-                        for line in line.split(area.width as usize) {
-                            ratatui_set_string(buf, y, 0, &line);
-                            y += 1;
-                        }
-                    }
-                }
-            })?;
-
-        match receiver.recv() {
-            Err(_) => break,
-            Ok(ev) => {
-                dbg!(&ev);
-                match ev {
-                    Event::Key(key) => {
-                        if key.kind == KeyEventKind::Press {
-                            if key.code == KeyCode::Char('q') {
-                                break;
-                            } else if key.code == KeyCode::Char('b') {
-                                stdout().write(b"\x07")?;
-                            }
-                        }
-                    },
-                    _ => (),
-                }
-            },
-        }
-    }
-    stdout().execute(LeaveAlternateScreen)?;
-    disable_raw_mode()?;
-    Ok(())
-}
-*/
-
 fn main() -> ExitCode {
-    /*
-    let mut client = Client::new().unwrap();
-    if let Some(st) = client.status_by_id("111602135142646031") {
-        let paras = parse_html(&st.content);
-        tui(paras).unwrap();
-    }
-    */
-
     match Tui::run() {
         Ok(_) => ExitCode::from(0),
         Err(e) => {