Documents: a press in a table opens its cell alone
Visual mode opened a pressed table whole, as Markdown source. A press in a table now opens only that cell, in place, as its source in a one-line field; the rest of the table stays drawn. Tab and Shift-Tab walk the cells, Up and Down move a row or leave the table, Enter and Escape write back in one undo step, and a bare pipe typed in a cell is escaped on write-back. The table drawing moves to render/table.rs and presses on a cell's padding name the cell. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
991ca7b548
commit
2594b3fd0f
14 files changed
+591
-106
No files matched your search
@@ -1,6 +1,7 @@
|
||||
mod apart;
|
||||
mod attach;
|
||||
mod block;
|
||||
mod cells;
|
||||
mod edit;
|
||||
mod finding;
|
||||
mod format;
|
||||
@@ -36,7 +37,7 @@ use super::{
|
||||
MarkdownMode,
|
||||
markdown::markdown_highlights,
|
||||
modes::joint,
|
||||
render::{OnHeading, OnLink},
|
||||
render::{CellAt, OnHeading, OnLink},
|
||||
};
|
||||
use crate::{
|
||||
editor::{CodeEditor, EditorEvent, LineNumbers},
|
||||
@@ -80,6 +81,8 @@ struct Open {
|
||||
input: Entity<TextInput>,
|
||||
/// Opened past the end, to add a block.
|
||||
append: bool,
|
||||
/// A table cell alone; its bare pipes escape.
|
||||
cell: Option<CellAt>,
|
||||
/// Watches an overlay that borrowed focus.
|
||||
lent: Option<Subscription>,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
@@ -243,6 +246,7 @@ impl MarkdownDocument {
|
||||
let written = match open.append {
|
||||
true if typed.is_empty() => String::new(),
|
||||
true => format!("{}{typed}", joint(text)),
|
||||
false if open.cell.is_some() => cells::guarded(typed),
|
||||
false => typed.to_string(),
|
||||
};
|
||||
[&text[..open.range.start], &written, &text[open.range.end..]].concat()
|
||||
|
||||
Reference in new issue
Block a user