From 898c6d407f5ba54bea1b37e7ac962f738bc25d8a Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 25 Mar 2025 04:03:22 +0200 Subject: [PATCH] remove extra lines --- .../window/tab/item/client/driver/gemini.rs | 53 +++++++------------ 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/src/app/browser/window/tab/item/client/driver/gemini.rs b/src/app/browser/window/tab/item/client/driver/gemini.rs index b2e436df..2f03dd58 100644 --- a/src/app/browser/window/tab/item/client/driver/gemini.rs +++ b/src/app/browser/window/tab/item/client/driver/gemini.rs @@ -216,43 +216,28 @@ fn handle( page.snap_history(); } redirects.replace(0); // reset + let mut i = page.navigation.request.info.borrow_mut(); + i + .add_event(EVENT_COMPLETED.to_string()) + .set_size(Some(input.as_bytes().len()), None) + .unset_mime() + .commit(); + page.navigation.request.update_secondary_icon(&i); match input { // https://geminiprotocol.net/docs/protocol-specification.gmi#status-10 - Input::Default(default) => { - { - let mut i = page.navigation.request.info.borrow_mut(); - i - .add_event(EVENT_COMPLETED.to_string()) - .set_size(Some(default.as_bytes().len()), None) - .unset_mime() - .commit(); - page.navigation.request.update_secondary_icon(&i) - } - page.input.set_new_response( - page.item_action.clone(), - uri, - Some(default.message().unwrap_or("Input expected")), - Some(1024), - ) - }, + Input::Default(d) => page.input.set_new_response( + page.item_action.clone(), + uri, + Some(d.message_or_default()), + Some(1024), + ), // https://geminiprotocol.net/docs/protocol-specification.gmi#status-11-sensitive-input - Input::Sensitive(sensitive) => { - { - let mut i = page.navigation.request.info.borrow_mut(); - i - .add_event(EVENT_COMPLETED.to_string()) - .set_size(Some(sensitive.as_bytes().len()), None) - .unset_mime() - .commit(); - page.navigation.request.update_secondary_icon(&i) - } - page.input.set_new_sensitive( - page.item_action.clone(), - uri, - Some(sensitive.message().unwrap_or("Sensitive input expected")), - Some(1024), - ) - } + Input::Sensitive(s) => page.input.set_new_sensitive( + page.item_action.clone(), + uri, + Some(s.message_or_default()), + Some(1024), + ) } } // https://geminiprotocol.net/docs/protocol-specification.gmi#status-20