From bdcffffe1fc1e445dc689654541d78cd9141a8fb Mon Sep 17 00:00:00 2001 From: Dhruva Sagar Date: Thu, 2 Dec 2021 00:28:56 +0530 Subject: [PATCH] Attempt to Fix #173 --- autoload/tablemode/table.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autoload/tablemode/table.vim b/autoload/tablemode/table.vim index 0e8afbe..97748dc 100644 --- a/autoload/tablemode/table.vim +++ b/autoload/tablemode/table.vim @@ -175,6 +175,12 @@ function! tablemode#table#AddBorder(line) "{{{2 endfunction function! tablemode#table#Realign(line) "{{{2 + let utree = undotree() + if utree.seq_cur != utree.seq_last + " skip during undo + return + endif + let current_fm = &foldmethod " save foldmethod to be restored setlocal foldmethod=manual " manual foldmethod while table is being aligned @@ -206,11 +212,11 @@ function! tablemode#table#Realign(line) "{{{2 let lines = tablemode#align#Align(lines) for aline in lines - call setline(aline.lnum, aline.text) + undojoin | keepjumps call setline(aline.lnum, aline.text) endfor for bline in blines - call tablemode#table#AddBorder(bline) + undojoin | keepjumps call tablemode#table#AddBorder(bline) endfor " restore foldmethod