on master help sign in
Simplify current!(..).1 into doc!()
commit1a1685acf7fe9836b235dbc73361344d9330800c authorBlaž Hrastnik <blaz@mxxn.io> dateSat 6 Nov 2021, 23:52 (5 years ago) parente80708e
1 file changed+6−12
helix-term/src/commands.rs+6−12
helix-term/src/commands.rs+6−12
@@ -743,13 +743,7 @@ where
743743 // usually mix line endings. But we should fix it eventually
744744 // anyway.
745745 {
746− current!(cx.editor)
747− .1
748− .line_ending
749− .as_str()
750− .chars()
751− .next()
752− .unwrap()
746+ doc!(cx.editor).line_ending.as_str().chars().next().unwrap()
753747 }
754748
755749 KeyEvent {
@@ -1746,7 +1740,7 @@ mod cmd {
17461740
17471741 // If no argument, report current indent style.
17481742 if args.is_empty() {
1749− let style = current!(cx.editor).1.indent_style;
1743+ let style = doc!(cx.editor).indent_style;
17501744 cx.editor.set_status(match style {
17511745 Tabs => "tabs".into(),
17521746 Spaces(1) => "1 space".into(),
@@ -1785,7 +1779,7 @@ mod cmd {
17851779
17861780 // If no argument, report current line ending setting.
17871781 if args.is_empty() {
1788− let line_ending = current!(cx.editor).1.line_ending;
1782+ let line_ending = doc!(cx.editor).line_ending;
17891783 cx.editor.set_status(match line_ending {
17901784 Crlf => "crlf".into(),
17911785 LF => "line feed".into(),
@@ -3794,7 +3788,7 @@ fn yank_joined_to_clipboard_impl(
37943788}
37953789
37963790fn 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;
37983792 let _ = yank_joined_to_clipboard_impl(
37993793 &mut cx.editor,
38003794 line_ending.as_str(),
@@ -3828,7 +3822,7 @@ fn yank_main_selection_to_clipboard(cx: &mut Context) {
38283822}
38293823
38303824fn 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;
38323826 let _ = yank_joined_to_clipboard_impl(
38333827 &mut cx.editor,
38343828 line_ending.as_str(),
@@ -4517,7 +4511,7 @@ fn match_brackets(cx: &mut Context) {
45174511
45184512fn jump_forward(cx: &mut Context) {
45194513 let count = cx.count();
4520− let (view, _doc) = current!(cx.editor);
4514+ let view = view_mut!(cx.editor);
45214515
45224516 if let Some((id, selection)) = view.jumps.forward(count) {
45234517 view.doc = *id;