Add visual mode, node registers, search and the jump list (stage 8c)
The rest of vim, on nodes. Visual mode takes in what lies between where it started and the cursor: on the canvas, every node the rectangle from one end's box to the other's touches; in the outline and the Note view, the nodes in between in reading order. V takes whole branches, Ctrl+click and Ctrl+drag pick with the mouse, and the operators take exactly what's selected: d, y, > and <, M, and the pickers on every node at once. Registers now hold text or nodes, so yy, dd and x keep what they take and p, P and ]p paste it, layout and links included. "+ is the system clipboard through arboard: nodes go there as Markdown in the user's format (## headings, a --- tag list, the body), and come back whole while the clipboard still holds them. clipboard = "unnamedplus" makes plain yanks use it, as in vim. . repeats the last change made with keys, with the text typed after it. / opens a Telescope-style search: fuzzy matches over titles, tags and bodies, best first, with the note of the one you're on beside them; n and N go on with it, and :find searches straight away. Each pane keeps a jump list for Ctrl-o and Ctrl-i that crosses documents and reopens closed ones. Capital marks lead into any document and, like the small ones, are kept in memory.ron. gd follows a cross-link, and :marks, :jumps and :registers list what they hold. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
abe3dc1d84
commit
7bec5bf3fc
45 files changed
+3922
-272
No files matched your search
+34
-4
@@ -21,20 +21,27 @@
|
||||
pub mod action;
|
||||
pub mod buffer;
|
||||
pub mod calls;
|
||||
mod clipboard;
|
||||
pub mod commands;
|
||||
mod configure;
|
||||
pub mod documents;
|
||||
mod files;
|
||||
mod input;
|
||||
mod jumps;
|
||||
mod marks;
|
||||
pub mod mode;
|
||||
pub mod panes;
|
||||
pub mod popup;
|
||||
pub mod registers;
|
||||
mod render;
|
||||
mod repeat;
|
||||
pub mod search;
|
||||
pub mod startup;
|
||||
mod terminal;
|
||||
pub mod text_edit;
|
||||
mod update;
|
||||
pub mod visual;
|
||||
mod yank;
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::time::Instant;
|
||||
@@ -47,7 +54,7 @@ pub use terminal::run;
|
||||
use crate::command::history::History as CommandHistory;
|
||||
use crate::config::Config;
|
||||
use crate::config::paths::Paths;
|
||||
use crate::config::settings::Settings;
|
||||
use crate::config::settings::{ClipboardUse, Settings};
|
||||
use crate::input::bindings::Context;
|
||||
use crate::input::engine::KeyEngine;
|
||||
use crate::input::keymap::Keymap;
|
||||
@@ -61,6 +68,7 @@ use crate::view::{View, ViewContext, ViewKind, ViewSettings};
|
||||
use action::Message;
|
||||
use buffer::Buffer;
|
||||
use documents::{BufferId, Documents};
|
||||
use jumps::Jumps;
|
||||
use mode::Mode;
|
||||
use panes::{PaneId, Panes};
|
||||
use registers::Registers;
|
||||
@@ -84,6 +92,14 @@ pub struct App {
|
||||
memory: Memory,
|
||||
/// The status bar's message, until the next key.
|
||||
message: Option<Message>,
|
||||
/// The last change, for `.`.
|
||||
last_change: Option<repeat::Repeat>,
|
||||
/// A text edit started by a key command, while it goes on.
|
||||
recording: Option<repeat::Recording>,
|
||||
/// `.` is making a change again: it isn't recorded again.
|
||||
repeating: bool,
|
||||
/// The last search, for `n` and `N`.
|
||||
last_search: Option<String>,
|
||||
screen: Screen,
|
||||
/// The pane a mouse drag started in: it gets the whole drag.
|
||||
dragging: Option<PaneId>,
|
||||
@@ -126,10 +142,11 @@ impl Shared {
|
||||
}
|
||||
}
|
||||
|
||||
/// A pane: one of the documents, through a view.
|
||||
/// A pane: one of the documents, through a view, and where it jumped from.
|
||||
struct Pane {
|
||||
buffer: BufferId,
|
||||
view: Box<dyn View>,
|
||||
jumps: Jumps,
|
||||
}
|
||||
|
||||
impl Pane {
|
||||
@@ -143,7 +160,14 @@ impl Pane {
|
||||
if let Some(camera) = camera {
|
||||
view.set_camera(camera);
|
||||
}
|
||||
Pane { buffer, view }
|
||||
Pane { buffer, view, jumps: Jumps::default() }
|
||||
}
|
||||
|
||||
/// The pane shows `buffer` in a new view (a canvas starting at `camera`);
|
||||
/// its jump list stays.
|
||||
fn show(&mut self, buffer: BufferId, kind: ViewKind, camera: Option<Camera>) {
|
||||
let jumps = std::mem::take(&mut self.jumps);
|
||||
*self = Pane { jumps, ..Pane::new(buffer, kind, camera) };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +187,8 @@ impl App {
|
||||
let Config { settings, keymap, theme, problems } = config;
|
||||
let config_stamps = configure::ConfigStamps::read(&paths, &settings.theme);
|
||||
let view = ViewSettings { max_node_width: settings.max_node_width, ..ViewSettings::default() };
|
||||
let mut registers = Registers::default();
|
||||
registers.unnamed_plus = settings.clipboard == ClipboardUse::UnnamedPlus;
|
||||
let (docs, first_said) = files::open_first(first, &paths);
|
||||
let first = docs.at(0);
|
||||
let mut app = App {
|
||||
@@ -173,10 +199,14 @@ impl App {
|
||||
settings,
|
||||
keymap,
|
||||
keys: KeyEngine::default(),
|
||||
registers: Registers::default(),
|
||||
registers,
|
||||
mouse: MouseReader::default(),
|
||||
memory,
|
||||
message: None,
|
||||
last_change: None,
|
||||
recording: None,
|
||||
repeating: false,
|
||||
last_search: None,
|
||||
screen: Screen::default(),
|
||||
dragging: None,
|
||||
watched: Instant::now(),
|
||||
|
||||
Reference in new issue
Block a user