Mercurial > vim
annotate src/testdir/test_fixeol.vim @ 32865:8665cf0eab86 v9.0.1742
patch 9.0.1742: wrong curswant when clicking on second cell of double-width char
Commit: https://github.com/vim/vim/commit/9994160bfe74501886bbbf5631aec8ea2ae05991
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat Aug 19 13:08:50 2023 +0200
patch 9.0.1742: wrong curswant when clicking on second cell of double-width char
Problem: Wrong curswant when clicking and the second cell of a
double-width char.
Solution: Don't copy virtcol of the first char to the second one.
closes: #12842
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 19 Aug 2023 13:15:05 +0200 |
parents | 92b1338023ee |
children |
rev | line source |
---|---|
30962 | 1 " Tests for 'fixeol', 'eof' and 'eol' |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
12851
diff
changeset
|
2 |
12851
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 func Test_fixeol() |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " first write two test files – with and without trailing EOL |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 " use Unix fileformat for consistency |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 set ff=unix |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 enew! |
30962 | 8 call setline('.', 'with eol or eof') |
12851
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 w! XXEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 enew! |
30962 | 11 set noeof noeol nofixeol |
12 call setline('.', 'without eol or eof') | |
12851
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 w! XXNoEol |
30962 | 14 set eol eof fixeol |
12851
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 bwipe XXEol XXNoEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 " try editing files with 'fixeol' disabled |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 e! XXEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 normal ostays eol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 set nofixeol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 w! XXTestEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 e! XXNoEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 normal ostays without |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 set nofixeol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 w! XXTestNoEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 bwipe! XXEol XXNoEol XXTestEol XXTestNoEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 set fixeol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 " Append "END" to each file so that we can see what the last written char |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 " was. |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 normal ggdGaEND |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 w >>XXEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 w >>XXNoEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 w >>XXTestEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 w >>XXTestNoEol |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 |
30968 | 37 call assert_equal(['with eol or eof', 'END'], readfile('XXEol')) |
38 call assert_equal(['without eol or eofEND'], readfile('XXNoEol')) | |
39 call assert_equal(['with eol or eof', 'stays eol', 'END'], readfile('XXTestEol')) | |
40 call assert_equal(['without eol or eof', 'stays withoutEND'], | |
12851
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 \ readfile('XXTestNoEol')) |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 call delete('XXEol') |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 call delete('XXNoEol') |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 call delete('XXTestEol') |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 call delete('XXTestNoEol') |
30962 | 47 set ff& fixeol& eof& eol& |
12851
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 enew! |
90aaa974594e
patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
12851
diff
changeset
|
50 |
30982
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
51 func Test_eof() |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
52 let data = 0z68656c6c6f.0d0a.776f726c64 " "hello\r\nworld" |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
53 |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
54 " 1. Eol, Eof |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
55 " read |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
56 call writefile(data + 0z0d0a.1a, 'XXEolEof') |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
57 e! XXEolEof |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
58 call assert_equal(['hello', 'world'], getline(1, 2)) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
59 call assert_equal([1, 1], [&eol, &eof]) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
60 " write |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
61 set fixeol |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
62 w! |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
63 call assert_equal(data + 0z0d0a, readblob('XXEolEof')) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
64 set nofixeol |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
65 w! |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
66 call assert_equal(data + 0z0d0a.1a, readblob('XXEolEof')) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
67 |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
68 " 2. NoEol, Eof |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
69 " read |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
70 call writefile(data + 0z1a, 'XXNoEolEof') |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
71 e! XXNoEolEof |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
72 call assert_equal(['hello', 'world'], getline(1, 2)) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
73 call assert_equal([0, 1], [&eol, &eof]) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
74 " write |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
75 set fixeol |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
76 w! |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
77 call assert_equal(data + 0z0d0a, readblob('XXNoEolEof')) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
78 set nofixeol |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
79 w! |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
80 call assert_equal(data + 0z1a, readblob('XXNoEolEof')) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
81 |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
82 " 3. Eol, NoEof |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
83 " read |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
84 call writefile(data + 0z0d0a, 'XXEolNoEof') |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
85 e! XXEolNoEof |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
86 call assert_equal(['hello', 'world'], getline(1, 2)) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
87 call assert_equal([1, 0], [&eol, &eof]) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
88 " write |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
89 set fixeol |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
90 w! |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
91 call assert_equal(data + 0z0d0a, readblob('XXEolNoEof')) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
92 set nofixeol |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
93 w! |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
94 call assert_equal(data + 0z0d0a, readblob('XXEolNoEof')) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
95 |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
96 " 4. NoEol, NoEof |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
97 " read |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
98 call writefile(data, 'XXNoEolNoEof') |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
99 e! XXNoEolNoEof |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
100 call assert_equal(['hello', 'world'], getline(1, 2)) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
101 call assert_equal([0, 0], [&eol, &eof]) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
102 " write |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
103 set fixeol |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
104 w! |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
105 call assert_equal(data + 0z0d0a, readblob('XXNoEolNoEof')) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
106 set nofixeol |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
107 w! |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
108 call assert_equal(data, readblob('XXNoEolNoEof')) |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
109 |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
110 call delete('XXEolEof') |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
111 call delete('XXNoEolEof') |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
112 call delete('XXEolNoEof') |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
113 call delete('XXNoEolNoEof') |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
114 set ff& fixeol& eof& eol& |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
115 enew! |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
116 endfunc |
92b1338023ee
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong place
Bram Moolenaar <Bram@vim.org>
parents:
30968
diff
changeset
|
117 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
12851
diff
changeset
|
118 " vim: shiftwidth=2 sts=2 expandtab |