aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/vis.c b/vis.c
index 8466034..e1ed0de 100644
--- a/vis.c
+++ b/vis.c
@@ -1092,8 +1092,17 @@ static void copy_indent_from_previous_line(View *view, Text *text) {
}
static void insert_newline(const Arg *arg) {
- insert(&(const Arg){ .s =
- text_newlines_crnl(vis->win->file->text) ? "\r\n" : "\n" });
+ const char *nl;
+ switch (text_newline_type(vis->win->file->text)) {
+ case TEXT_NEWLINE_CRNL:
+ nl = "\r\n";
+ break;
+ default:
+ nl = "\n";
+ break;
+ }
+
+ insert(&(const Arg){ .s = nl });
if (vis->autoindent)
copy_indent_from_previous_line(vis->win->view, vis->win->file->text);