mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00
Merge pull request #26486 from glepnir/fix_linebyte
fix(eval): use no_ff instead of ffdos as condition
This commit is contained in:
@@ -3907,7 +3907,7 @@ int ml_find_line_or_offset(buf_T *buf, linenr_T lnum, int *offp, bool no_ff)
|
|||||||
|| lnum < 0) {
|
|| lnum < 0) {
|
||||||
// memline is currently empty. Although if it is loaded,
|
// memline is currently empty. Although if it is loaded,
|
||||||
// it behaves like there is one empty line.
|
// it behaves like there is one empty line.
|
||||||
if (!ffdos && buf->b_ml.ml_mfp && (lnum == 1 || lnum == 2)) {
|
if (no_ff && buf->b_ml.ml_mfp && (lnum == 1 || lnum == 2)) {
|
||||||
return lnum - 1;
|
return lnum - 1;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@@ -1834,6 +1834,7 @@ describe('api/buf', function()
|
|||||||
it('works in empty buffer', function()
|
it('works in empty buffer', function()
|
||||||
eq(0, get_offset(0))
|
eq(0, get_offset(0))
|
||||||
eq(1, get_offset(1))
|
eq(1, get_offset(1))
|
||||||
|
eq(-1, funcs.line2byte('$'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works in buffer with one line inserted', function()
|
it('works in buffer with one line inserted', function()
|
||||||
|
Reference in New Issue
Block a user