From 6825891b88419665a11fcf309734fd4206e11317 Mon Sep 17 00:00:00 2001 From: chris west Date: Wed, 11 Nov 2020 16:59:38 -0800 Subject: [PATCH] toggle global encoding on ctrl-e --- src/text.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/text.rs b/src/text.rs index 24a4b52..a649337 100644 --- a/src/text.rs +++ b/src/text.rs @@ -3,7 +3,7 @@ //! to the main UI to perform. use crate::{ - config::Config, + config::SharedConfig as Config, encoding::Encoding, terminal, ui::{self, Action, Key, View, MAX_COLS, SCROLL_LINES}, @@ -13,6 +13,8 @@ use std::{borrow::Cow, fmt, str}; /// The Text View holds the raw Gopher response as well as information /// about which lines should currently be displayed on screen. pub struct Text { + /// Ref to our global config + config: Config, /// Gopher URL url: String, /// Gopher response @@ -222,6 +224,7 @@ impl Text { } else { self.encoding = Encoding::UTF8; } + self.config.write().unwrap().encoding = self.encoding; Action::Redraw }