This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH v1] Add reload capability

Message ID
DKIM signature
Download raw message
Patch: +22 -2
This adds a reload button, with shortcut `r`, that reloads the current
page (if any).  This simply re-fetches the content and redraws the page
(which also resets the cursor position).

 src/main.rs | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 50280a0..e398836 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -29,10 +29,11 @@ mod history;

const HELP: &str = "Welcome to Asuka Gemini browser!

  Press g to visit an URL
  Press g to visit a URL
  Press b to go to the previous URL
  Press B to show bookmarks
  Press a to add current URL to bookmarks
  Press r to reload
  Press a to bookmark the current URL
  Press q to exit

@@ -58,6 +59,7 @@ fn main() {
        .button("Back (b)", |s| go_back(s))
        .button("Go To URL (g)", |s| prompt_for_url(s))
        .button("Bookmarks (B)", |s| show_bookmarks(s))
        .button("Reload (r)", |s| reload_page(s))
        .button("Quit (q)", |s| s.quit())
@@ -72,6 +74,8 @@ fn main() {
    siv.add_global_callback('B', |s| show_bookmarks(s));
    // pressing b goes to the previous URL if any
    siv.add_global_callback('b', |s| go_back(s));
    // pressing r reloads the current URL if any
    siv.add_global_callback('r', |s| reload_page(s));

@@ -164,6 +168,22 @@ fn show_bookmarks(s: &mut Cursive) {

fn reload_page(s: &mut Cursive) {
    // Get current URL from history and revisit it without modifying history
    if let Some(url) = history::get_current_url() {
        match content::get_data(&url) {
            Ok((meta, new_content)) => {
                // handle meta header
                let response = handle_response_status(s, &url, meta, new_content);
                draw_content(s, &url, response);
            Err(msg) => {

fn visit_url(s: &mut Cursive, url: &Url) {
    // Close URL popup if any
    if s.find_id::<Dialog>("url_popup").is_some() {
Reply to thread Export thread (mbox)