aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-09-08 05:52:09 +0000
committerBlaž Hrastnik2021-09-08 07:34:04 +0000
commit72cf86e4626c01c6ce2371c7b134ab7a7041620c (patch)
tree41a97f105e5dd5e0fb68ec2b99727e67545641b5 /helix-view/src
parent011f9aa47f2316f120da48d342430c7c5caaf107 (diff)
Regex prompts should have a history with a specifiable register
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/editor.rs6
-rw-r--r--helix-view/src/lib.rs2
-rw-r--r--helix-view/src/register_selection.rs48
3 files changed, 3 insertions, 53 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 3d2d4a87..52a0060c 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -3,7 +3,7 @@ use crate::{
graphics::{CursorKind, Rect},
theme::{self, Theme},
tree::Tree,
- Document, DocumentId, RegisterSelection, View, ViewId,
+ Document, DocumentId, View, ViewId,
};
use futures_util::future;
@@ -73,7 +73,7 @@ pub struct Editor {
pub tree: Tree,
pub documents: SlotMap<DocumentId, Document>,
pub count: Option<std::num::NonZeroUsize>,
- pub selected_register: RegisterSelection,
+ pub selected_register: Option<char>,
pub registers: Registers,
pub theme: Theme,
pub language_servers: helix_lsp::Registry,
@@ -111,7 +111,7 @@ impl Editor {
tree: Tree::new(area),
documents: SlotMap::with_key(),
count: None,
- selected_register: RegisterSelection::default(),
+ selected_register: None,
theme: themes.default(),
language_servers,
syn_loader: config_loader,
diff --git a/helix-view/src/lib.rs b/helix-view/src/lib.rs
index 9bcc0b7d..c37474d6 100644
--- a/helix-view/src/lib.rs
+++ b/helix-view/src/lib.rs
@@ -8,7 +8,6 @@ pub mod graphics;
pub mod info;
pub mod input;
pub mod keyboard;
-pub mod register_selection;
pub mod theme;
pub mod tree;
pub mod view;
@@ -20,6 +19,5 @@ slotmap::new_key_type! {
pub use document::Document;
pub use editor::Editor;
-pub use register_selection::RegisterSelection;
pub use theme::Theme;
pub use view::View;
diff --git a/helix-view/src/register_selection.rs b/helix-view/src/register_selection.rs
deleted file mode 100644
index a2b78f72..00000000
--- a/helix-view/src/register_selection.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-/// Register selection and configuration
-///
-/// This is a kind a of specialized `Option<char>` for register selection.
-/// Point is to keep whether the register selection has been explicitely
-/// set or not while being convenient by knowing the default register name.
-#[derive(Debug)]
-pub struct RegisterSelection {
- selected: char,
- default_name: char,
-}
-
-impl RegisterSelection {
- pub fn new(default_name: char) -> Self {
- Self {
- selected: default_name,
- default_name,
- }
- }
-
- pub fn select(&mut self, name: char) {
- self.selected = name;
- }
-
- pub fn take(&mut self) -> Self {
- Self {
- selected: std::mem::replace(&mut self.selected, self.default_name),
- default_name: self.default_name,
- }
- }
-
- pub fn is_default(&self) -> bool {
- self.selected == self.default_name
- }
-
- pub fn name(&self) -> char {
- self.selected
- }
-}
-
-impl Default for RegisterSelection {
- fn default() -> Self {
- let default_name = '"';
- Self {
- selected: default_name,
- default_name,
- }
- }
-}