on master help sign in
minor: view!(..).doc is slightly more efficient than current!(..).1.id()
f659e11Blaž Hrastnik
helix-term/src/commands.rs+2−4
@@ -2196,8 +2196,7 @@ mod cmd {
2196 args: &[&str],
2196 args: &[&str],
2197 _event: PromptEvent,
2197 _event: PromptEvent,
2198 ) -> anyhow::Result<()> {
2198 ) -> anyhow::Result<()> {
2199− let (_, doc) = current!(cx.editor);
2199+ let id = view!(cx.editor).doc;
2200− let id = doc.id();
2201
2200
2202 if let Some(path) = args.get(0) {
2201 if let Some(path) = args.get(0) {
2203 cx.editor.open(path.into(), Action::VerticalSplit)?;
2202 cx.editor.open(path.into(), Action::VerticalSplit)?;
@@ -2213,8 +2212,7 @@ mod cmd {
2213 args: &[&str],
2212 args: &[&str],
2214 _event: PromptEvent,
2213 _event: PromptEvent,
2215 ) -> anyhow::Result<()> {
2214 ) -> anyhow::Result<()> {
2216− let (_, doc) = current!(cx.editor);
2215+ let id = view!(cx.editor).doc;
2217− let id = doc.id();
2218
2216
2219 if let Some(path) = args.get(0) {
2217 if let Some(path) = args.get(0) {
2220 cx.editor.open(path.into(), Action::HorizontalSplit)?;
2218 cx.editor.open(path.into(), Action::HorizontalSplit)?;