diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-04-22 21:20:59 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-04-22 21:34:40 +0200 |
| commit | 287521cba09765d9d0901b79d8911a27de1af4e7 (patch) | |
| tree | 8a505debc63763bca159ba0b6c60cae02d583d9e /vis.c | |
| parent | 6d7794c0356902bc816923f4409d9d39a62db171 (diff) | |
| download | vis-287521cba09765d9d0901b79d8911a27de1af4e7.tar.gz vis-287521cba09765d9d0901b79d8911a27de1af4e7.tar.xz | |
Cleanup line ending type detection and insertion
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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); |
