diff options
-rw-r--r-- | src/nvim/terminal.c | 2 | ||||
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 23 | ||||
-rw-r--r-- | third-party/CMakeLists.txt | 4 |
3 files changed, 27 insertions, 2 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 8c08e98b5c..cec7fc84a5 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -240,6 +240,8 @@ Terminal *terminal_open(TerminalOptions opts) set_option_value((uint8_t *)"relativenumber", false, NULL, OPT_LOCAL); buf_set_term_title(curbuf, (char *)curbuf->b_ffname); RESET_BINDING(curwin); + // Reset cursor in current window. + curwin->w_cursor = (pos_T){ .lnum = 1, .col = 0, .coladd = 0 }; // Apply TermOpen autocmds _before_ configuring the scrollback buffer. apply_autocmds(EVENT_TERMOPEN, NULL, NULL, false, curbuf); diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index a75ec129e4..b61eef948d 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -4,6 +4,7 @@ local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim local wait = helpers.wait local eval, execute, source = helpers.eval, helpers.execute, helpers.source local eq, neq = helpers.eq, helpers.neq +local write_file = helpers.write_file if helpers.pending_win32(pending) then return end @@ -207,3 +208,25 @@ describe('terminal buffer', function() end) end) +describe('No heap-buffer-overflow when using', function() + + local testfilename = 'Xtestfile-functional-terminal-buffers_spec' + + before_each(function() + write_file(testfilename, "aaaaaaaaaaaaaaaaaaaaaaaaaaaa") + end) + + after_each(function() + os.remove(testfilename) + end) + + it('termopen(echo) #3161', function() + execute('edit ' .. testfilename) + -- Move cursor away from the beginning of the line + feed('$') + -- Let termopen() modify the buffer + execute('call termopen("echo")') + wait() + execute('bdelete!') + end) +end) diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 1810794ee9..83397a72ca 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -124,8 +124,8 @@ set(GPERF_SHA256 767112a204407e62dbc3106647cf839ed544f3cf5d0f0523aaa2508623aad63 set(WINTOOLS_URL https://github.com/neovim/deps/raw/2f9acbecf06365c10baa3c0087f34a54c9c6f949/opt/win32tools.zip) set(WINTOOLS_SHA256 8bfce7e3a365721a027ce842f2ec1cf878f1726233c215c05964aac07300798c) -set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.4/neovim-qt.zip) -set(WINGUI_SHA256 95bbc852b69b12d0ef962a8410522010b453ba70f36ea379c548558d16abc2e6) +set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.5/neovim-qt.zip) +set(WINGUI_SHA256 07e2838c713bda9221a0b8022f4c9df3f8bbe69bb0b2fbeec473a0e8f0e779fa) set(WIN32YANK_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.2/win32yank.zip) set(WIN32YANK_SHA256 78869bf68565607cda1b6a3d549e2487d59d6f0f16f9b003e123c0086f90309d) |