diff options
| author | bfredl <bjorn.linse@gmail.com> | 2026-09-24 14:31:40 +0200 |
|---|---|---|
| committer | bfredl <bjorn.linse@gmail.com> | 2026-10-02 11:43:56 +0200 |
| commit | 58ce7218ec9aa85cc090cee4654e4573f6dd8570 (patch) | |
| tree | 04157fc8d446ebf53c02d9efb7ccd68d3ade7494 /runtime/lua/vim | |
| parent | 09e4491a5351e37cea4ed83b163de315fedc2eaa (diff) | |
| download | rneovim-58ce7218ec9aa85cc090cee4654e4573f6dd8570.tar.gz rneovim-58ce7218ec9aa85cc090cee4654e4573f6dd8570.tar.bz2 rneovim-58ce7218ec9aa85cc090cee4654e4573f6dd8570.zip | |
feat(lua): in script mode -l, use raw output for print()
consider the following test_script.lua :
print 'hello\n' -- TWO new lines
print 'this is \027[31mRED FOR AN AMAZING REASON\027[0m'
print 'foo'
print '' -- newline despite empty!
print 'bar'
-- a bit later:
os.execute 'sleep 2' -- CPU goes BRR, cursor in column zero
print 'more bar'
before this PR, `nvim -l test_script.lua` had some weird behaviors
compared to `lua test_script.lua` or the now removed `nvim -ll
test_script.lua`.
- one extra '\n' at the end of a print is ignored, one would need
TWO '\n' for a single extra '\n'
- an empty print'' is supposed to print an empty line
- print'\027[31mRED' is being escaped so it does not work
- the cursor gets stuck at the end of a message, instead of after
emitting the new line, this looks like the CPU lag has something
to do with the _last_ printed message which is likely not the case.
I consider these behaviors to be unintentional (a consequence of
stragglig through the message.c meta-machine, which is optimized
for message handling in _an interative text editor_) and getting
closer to plain lua behavior would be better.
An alternative would be to restore the builtin print(), but our
implemenation still has some benefits, like try
`print(setmetatable({}, {__tostring=error})` in plain lua..
Diffstat (limited to 'runtime/lua/vim')
0 files changed, 0 insertions, 0 deletions