on master help sign in
Simplify current!(..).1 into doc!()
1a1685aBlaž Hrastnik
helix-term/src/commands.rs+6−12
@@ -743,13 +743,7 @@ where
743 // usually mix line endings. But we should fix it eventually
743 // usually mix line endings. But we should fix it eventually
744 // anyway.
744 // anyway.
745 {
745 {
746− current!(cx.editor)
747− .1
748− .line_ending
746+ doc!(cx.editor).line_ending.as_str().chars().next().unwrap()
749− .as_str()
750− .chars()
751− .next()
752− .unwrap()
753 }
747 }
754
748
755 KeyEvent {
749 KeyEvent {
@@ -1746,7 +1740,7 @@ mod cmd {
1746
1740
1747 // If no argument, report current indent style.
1741 // If no argument, report current indent style.
1748 if args.is_empty() {
1742 if args.is_empty() {
1749− let style = current!(cx.editor).1.indent_style;
1743+ let style = doc!(cx.editor).indent_style;
1750 cx.editor.set_status(match style {
1744 cx.editor.set_status(match style {
1751 Tabs => "tabs".into(),
1745 Tabs => "tabs".into(),
1752 Spaces(1) => "1 space".into(),
1746 Spaces(1) => "1 space".into(),
@@ -1785,7 +1779,7 @@ mod cmd {
1785
1779
1786 // If no argument, report current line ending setting.
1780 // If no argument, report current line ending setting.
1787 if args.is_empty() {
1781 if args.is_empty() {
1788− let line_ending = current!(cx.editor).1.line_ending;
1782+ let line_ending = doc!(cx.editor).line_ending;
1789 cx.editor.set_status(match line_ending {
1783 cx.editor.set_status(match line_ending {
1790 Crlf => "crlf".into(),
1784 Crlf => "crlf".into(),
1791 LF => "line feed".into(),
1785 LF => "line feed".into(),
@@ -3794,7 +3788,7 @@ fn yank_joined_to_clipboard_impl(
3794}
3788}
3795
3789
3796fn yank_joined_to_clipboard(cx: &mut Context) {
3790fn yank_joined_to_clipboard(cx: &mut Context) {
3797− let line_ending = current!(cx.editor).1.line_ending;
3791+ let line_ending = doc!(cx.editor).line_ending;
3798 let _ = yank_joined_to_clipboard_impl(
3792 let _ = yank_joined_to_clipboard_impl(
3799 &mut cx.editor,
3793 &mut cx.editor,
3800 line_ending.as_str(),
3794 line_ending.as_str(),
@@ -3828,7 +3822,7 @@ fn yank_main_selection_to_clipboard(cx: &mut Context) {
3828}
3822}
3829
3823
3830fn yank_joined_to_primary_clipboard(cx: &mut Context) {
3824fn yank_joined_to_primary_clipboard(cx: &mut Context) {
3831− let line_ending = current!(cx.editor).1.line_ending;
3825+ let line_ending = doc!(cx.editor).line_ending;
3832 let _ = yank_joined_to_clipboard_impl(
3826 let _ = yank_joined_to_clipboard_impl(
3833 &mut cx.editor,
3827 &mut cx.editor,
3834 line_ending.as_str(),
3828 line_ending.as_str(),
@@ -4517,7 +4511,7 @@ fn match_brackets(cx: &mut Context) {
4517
4511
4518fn jump_forward(cx: &mut Context) {
4512fn jump_forward(cx: &mut Context) {
4519 let count = cx.count();
4513 let count = cx.count();
4520− let (view, _doc) = current!(cx.editor);
4514+ let view = view_mut!(cx.editor);
4521
4515
4522 if let Some((id, selection)) = view.jumps.forward(count) {
4516 if let Some((id, selection)) = view.jumps.forward(count) {
4523 view.doc = *id;
4517 view.doc = *id;