A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/9b1e1fbc9f795921afd25ba38be5c79dec8b04d2 below:

use getcmdtype() to determine whether in cmdline mode · neovim/neovim@9b1e1fb · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+12

-6

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+12

-6

lines changed Original file line number Diff line number Diff line change

@@ -156,29 +156,29 @@ do

156 156

--- - 3: ends the paste (exactly once)

157 157

---@returns false if client should cancel the paste.

158 158

function vim.paste(lines, phase)

159 -

local call = vim.api.nvim_call_function

160 159

local now = vim.loop.now()

161 -

local mode = call('mode', {}):sub(1,1)

160 +

local mode = vim.api.nvim_get_mode().mode

161 +

local is_cmdline = vim.fn.getcmdtype() ~= ''

162 162

if phase < 2 then -- Reset flags.

163 163

tdots, tick, got_line1 = now, 0, false

164 -

elseif mode ~= 'c' then

164 +

elseif not is_cmdline then

165 165

vim.api.nvim_command('undojoin')

166 166

end

167 -

if mode == 'c' and not got_line1 then -- cmdline-mode: paste only 1 line.

167 +

if is_cmdline and not got_line1 then -- cmdline-mode: paste only 1 line.

168 168

got_line1 = (#lines > 1)

169 169

vim.api.nvim_set_option('paste', true) -- For nvim_input().

170 170

local line1 = lines[1]:gsub('<', '<lt>'):gsub('[\r\n\012\027]', ' ') -- Scrub.

171 171

vim.api.nvim_input(line1)

172 172

vim.api.nvim_set_option('paste', false)

173 -

elseif mode ~= 'c' then

173 +

elseif not is_cmdline then

174 174

if phase < 2 and mode:find('^[vV\22sS\19]') then

175 175

vim.api.nvim_command([[exe "normal! \<Del>"]])

176 176

vim.api.nvim_put(lines, 'c', false, true)

177 177

elseif phase < 2 and not mode:find('^[iRt]') then

178 178

vim.api.nvim_put(lines, 'c', true, true)

179 179

-- XXX: Normal-mode: workaround bad cursor-placement after first chunk.

180 180

vim.api.nvim_command('normal! a')

181 -

elseif phase < 2 and mode == 'R' then

181 +

elseif phase < 2 and mode:find('^R') then

182 182

local nchars = 0

183 183

for _, line in ipairs(lines) do

184 184

nchars = nchars + line:len()

Original file line number Diff line number Diff line change

@@ -738,6 +738,12 @@ describe('API', function()

738 738

eeffgghh

739 739

iijjkkll]])

740 740

end)

741 +

it('when searching in Visual mode', function()

742 +

feed('v/')

743 +

nvim('paste', 'aabbccdd', true, -1)

744 +

eq('aabbccdd', funcs.getcmdline())

745 +

expect('')

746 +

end)

741 747

it('crlf=false does not break lines at CR, CRLF', function()

742 748

nvim('paste', 'line 1\r\n\r\rline 2\nline 3\rline 4\r', false, -1)

743 749

expect('line 1\r\n\r\rline 2\nline 3\rline 4\r')

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4