Skip to content

Commit

Permalink
fixed various bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
altermo committed Jun 22, 2023
1 parent c0e7555 commit 547a7ba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/ultimate-autopair/configs/default/paira.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ M.fn={
in_pair=function (m,line,col)
local opab=open_pair.open_pair_ambigous_before(m.pair,line,col)
local opaa=open_pair.open_pair_ambigous_after(m.pair,line,col)
return opab and opaa,opab,(opaa or 0)
return opab and opaa,opab,(opaa or 0)+#m.pair-1
end,
in_pair_map=function (m,line)
local i=1
Expand Down
2 changes: 1 addition & 1 deletion lua/ultimate-autopair/configs/default/pairs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function M.newline_wrapper(m)
if m.pair==o.line:sub(o.col-#m.pair,o.col-1) and m.conf.newline then
local matching_pair_pos=m.fn.find_end_pair(o.line,o.col)
if matching_pair_pos then
return utils.movel(matching_pair_pos-o.col-1)..'\r<up><home>'..utils.movel(o.col-1)..'\r'
return utils.movel(matching_pair_pos-o.col-1)..'\r<up><home>'..utils.movel(o.wcol-1)..'\r'
end
if not conf.autoclose then return end
if vim.trim(utils.getline(o.linenr+1) or ''):sub(1,#m.end_pair)==m.end_pair then return end
Expand Down
2 changes: 2 additions & 0 deletions lua/ultimate-autopair/test/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ function M.test_newline()
run(':set cindent\rI{foo\r','{foo\n\t\n}')
run(':set cindent\rI{foobi\r','{\n\tfoo\n}')
run(':set cindent\rI{a\r','{\n\t\n}',{cr={autoclose=true}})
run(':setf lua\rIlocal x=[[\r','local x=[[\n\n]]')
run(':setf python\rI"""\r','"""\n\n"""')
--run(':set cindent\rI{fooa\r','{\n\t\n}',{cr={autoclose=true}})
--run(':setf lua\rIdoA\r','do\n\nend',{cr={autoclose=true},{'do','end',imap=false,ft='lua'}})
--run(':setf c\r:set cindent\rI{\r','{\n\t\n};') --TBD
Expand Down

0 comments on commit 547a7ba

Please sign in to comment.