patch 9.2.0110: No support for terminal synchronization mode

Commit: 
https://github.com/vim/vim/commit/7ba60f17c22ef81680f25f8c3225b4edb55ddd7c
Author: Foxe Chen <[email protected]>
Date:   Wed Mar 4 20:52:25 2026 +0000

    patch 9.2.0110: No support for terminal synchronization mode
    
    Problem:  No support for terminal synchronization mode
    Solution: Add DEC 2026 support using the 'termsync' option
              (Foxe Chen).
    
    related: #11718
    closes:  #19541
    
    Signed-off-by: Foxe Chen <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 327494d68..c7e010d59 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 9.2.  Last change: 2026 Mar 02
+*options.txt*  For Vim version 9.2.  Last change: 2026 Mar 04
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -9096,6 +9096,24 @@ A jump table for the options with a short description 
can be found at |Q_op|.
 <
        NOTE: This option is reset when 'compatible' is set.
 
+                                               *'termsync'* *'tsy'*
+'termsync' 'tsy'       boolean (default off)
+                       global
+       If the host terminal supports it, buffer all screen updates made
+       during a redraw cycle so that each screen is displayed in the terminal
+       all at once.  This can prevent tearing or flickering when the terminal
+       updates faster than Vim can redraw.  If the host terminal does not
+       support it or if Vim is running graphically, then this option does
+       nothing.
+
+       The specification can be found at:
+       
https://github.com/contour-terminal/vt-extensions/blob/master/synchronized-output.md
+
+       Vim may set this option automatically at startup time when Vim is
+       compiled with the |+termresponse| feature, by querying the terminal
+       for DEC mode 2026 support.  The terminal codes used are |t_BS| and
+       |t_ES|.
+
                                                *'termwinkey'* *'twk'*
 'termwinkey' 'twk'     string  (default "")
                        local to window
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index e7b2068b0..fd2775764 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -1,4 +1,4 @@
-*quickref.txt* For Vim version 9.2.  Last change: 2026 Mar 02
+*quickref.txt* For Vim version 9.2.  Last change: 2026 Mar 04
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -963,6 +963,7 @@ Short explanation of each option:           *option-list*
 'termbidi'       'tbidi'   terminal takes care of bi-directionality
 'termencoding'   'tenc'    character encoding used by the terminal
 'termguicolors'          'tgc'     use GUI colors for the terminal
+'termsync'       'tsy'     enable terminal sync mode for redraw
 'termwinkey'     'twk'     key that precedes a Vim command in a terminal
 'termwinscroll'   'twsl'    max number of scrollback lines in a terminal window
 'termwinsize'    'tws'     size of a terminal window
diff --git a/runtime/doc/tags b/runtime/doc/tags
index a881c0acf..a000eacbd 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -1071,6 +1071,7 @@ $quote    eval.txt        /*$quote*
 't_AU' term.txt        /*'t_AU'*
 't_BD' term.txt        /*'t_BD'*
 't_BE' term.txt        /*'t_BE'*
+'t_BS' term.txt        /*'t_BS'*
 't_CF' term.txt        /*'t_CF'*
 't_CS' term.txt        /*'t_CS'*
 't_CV' term.txt        /*'t_CV'*
@@ -1081,6 +1082,7 @@ $quote    eval.txt        /*$quote*
 't_Ds' term.txt        /*'t_Ds'*
 't_EC' term.txt        /*'t_EC'*
 't_EI' term.txt        /*'t_EI'*
+'t_ES' term.txt        /*'t_ES'*
 't_F1' term.txt        /*'t_F1'*
 't_F2' term.txt        /*'t_F2'*
 't_F3' term.txt        /*'t_F3'*
@@ -1235,6 +1237,7 @@ $quote    eval.txt        /*$quote*
 'termbidi'     options.txt     /*'termbidi'*
 'termencoding' options.txt     /*'termencoding'*
 'termguicolors'        options.txt     /*'termguicolors'*
+'termsync'     options.txt     /*'termsync'*
 'termwinkey'   options.txt     /*'termwinkey'*
 'termwinscroll'        options.txt     /*'termwinscroll'*
 'termwinsize'  options.txt     /*'termwinsize'*
@@ -1270,6 +1273,7 @@ $quote    eval.txt        /*$quote*
 'tsl'  options.txt     /*'tsl'*
 'tsr'  options.txt     /*'tsr'*
 'tsrfu'        options.txt     /*'tsrfu'*
+'tsy'  options.txt     /*'tsy'*
 'ttimeout'     options.txt     /*'ttimeout'*
 'ttimeoutlen'  options.txt     /*'ttimeoutlen'*
 'ttm'  options.txt     /*'ttm'*
@@ -10654,6 +10658,7 @@ t_AL    term.txt        /*t_AL*
 t_AU   term.txt        /*t_AU*
 t_BD   term.txt        /*t_BD*
 t_BE   term.txt        /*t_BE*
+t_BS   term.txt        /*t_BS*
 t_CF   term.txt        /*t_CF*
 t_CS   term.txt        /*t_CS*
 t_CTRL-W_.     terminal.txt    /*t_CTRL-W_.*
@@ -10673,6 +10678,7 @@ t_DL    term.txt        /*t_DL*
 t_Ds   term.txt        /*t_Ds*
 t_EC   term.txt        /*t_EC*
 t_EI   term.txt        /*t_EI*
+t_ES   term.txt        /*t_ES*
 t_F1   term.txt        /*t_F1*
 t_F2   term.txt        /*t_F2*
 t_F3   term.txt        /*t_F3*
diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt
index 826f015fa..7d7466f1d 100644
--- a/runtime/doc/term.txt
+++ b/runtime/doc/term.txt
@@ -1,4 +1,4 @@
-*term.txt*     For Vim version 9.2.  Last change: 2026 Feb 14
+*term.txt*     For Vim version 9.2.  Last change: 2026 Mar 04
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -510,6 +510,10 @@ Added by Vim (there are no standard codes for these):
                |xterm-focus-event|
        t_fd    disable focus-event tracking                    *t_fd* *'t_fd'*
                |xterm-focus-event|
+       t_BS    begin synchronized update                       *t_BS* *'t_BS'*
+               see 'termsync'
+       t_ES    end synchronized update                         *t_ES* *'t_ES'*
+               see 'termsync'
 
 Some codes have a start, middle and end part.  The start and end are defined
 by the termcap option, the middle part is text.
@@ -528,6 +532,11 @@ t_SH must take one argument:
 t_RS is sent only if the response to t_RV has been received.  It is not used
 on Mac OS when Terminal.app could be recognized from the termresponse.
 
+The t_BS and t_ES are not stored in the termcap, but are instead set to the
+following default values on startup:
+       t_BS            " [?2026h"
+       t_ES            " [?2026l"
+
                                                        *mouse-reporting*
 Many terminals can report mouse clicks and some can report mouse movement and
 dragging.  Vim needs to know what codes are being used for this.
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index 120c1960d..db13c27f9 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -52613,6 +52613,9 @@ Options: ~
 
 'statuslineopt'                Extra options for the 'statusline', e.g. use the
                        "maxheight" suboption to use several lines.
+'t_BS'                 Begin synchronized update.
+'t_ES'                 End synchronized update.
+'termsync'             Enable support for terminal DEC 2026 sync mode.
 'winhighlight'         Window-local highlight group mappings.
 
 ==============================================================================
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 705195d0e..7d30f010b 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
 " These commands create the option window.
 "
 " Maintainer:  The Vim Project <https://github.com/vim/vim>
-" Last Change: 2026 Mar 02
+" Last Change: 2026 Mar 04
 " Former Maintainer:   Bram Moolenaar <[email protected]>
 
 " If there already is an option window, jump to that one.
@@ -385,6 +385,8 @@ call <SID>AddOption("window", gettext("number of lines to 
scroll for CTRL-F and
 call append("$", "     set window=" . &window)
 call <SID>AddOption("lazyredraw", gettext("don't redraw while executing 
macros"))
 call <SID>BinOptionG("lz", &lz)
+call <SID>AddOption("termsync", gettext("enable terminal sync mode"))
+call <SID>BinOptionG("tsy", &tsy)
 if has("reltime")
   call <SID>AddOption("redrawtime", gettext("timeout for 'hlsearch' and :match 
highlighting in msec"))
   call append("$", "   set rdt=" . &rdt)
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index a81f82bd5..5caee0534 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -2,7 +2,7 @@
 " Language:       Vim script
 " Maintainer:     Hirohito Higashi <h.east.727 ATMARK gmail.com>
 "         Doug Kearns <[email protected]>
-" Last Change:    2026 Mar 02
+" Last Change:    2026 Mar 04
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -70,26 +70,26 @@ syn keyword vimOption contained efm errorformat ek esckeys 
ei eventignore eiw ev
 syn keyword vimOption contained hi history hk hkmap hkp hkmapp hls hlsearch 
icon iconstring ic ignorecase imaf imactivatefunc imak imactivatekey imc 
imcmdline imd imdisable imi iminsert ims imsearch imsf imstatusfunc imst 
imstyle inc include inex includeexpr is incsearch inde indentexpr indk 
indentkeys inf infercase im insertmode isf isfname isi isident isk iskeyword 
isp isprint js joinspaces jop jumpoptions key kmp keymap km keymodel kpc 
keyprotocol kp keywordprg lmap langmap lm langmenu lnr langnoremap lrm 
langremap ls laststatus lz lazyredraw lhi lhistory lbr linebreak lines lsp 
linespace lisp lop lispoptions lw lispwords list lcs listchars lpl loadplugins 
luadll magic mef makeef menc makeencoding mp makeprg mps matchpairs mat 
matchtime mco maxcombine mfd maxfuncdepth skipwhite 
nextgroup=vimSetEqual,vimSetMod
 syn keyword vimOption contained mmd maxmapdepth mm maxmem mmp maxmempattern 
mmt maxmemtot msc maxsearchcount mis menuitems mopt messagesopt msm mkspellmem 
ml modeline mle modelineexpr mls modelines ma modifiable mod modified more 
mouse mousef mousefocus mh mousehide mousem mousemodel mousemev mousemoveevent 
mouses mouseshape mouset mousetime mzq mzquantum mzschemedll mzschemegcdll nf 
nrformats nu number nuw numberwidth ofu omnifunc odev opendevice opfunc 
operatorfunc ost osctimeoutlen pp packpath para paragraphs paste pt pastetoggle 
pex patchexpr pm patchmode pa path perldll pi preserveindent pvh previewheight 
pvp previewpopup pvw previewwindow pdev printdevice penc printencoding pexpr 
printexpr pfn printfont pheader printheader pmbcs printmbcharset pmbfn 
printmbfont skipwhite nextgroup=vimSetEqual,vimSetMod
 syn keyword vimOption contained popt printoptions prompt pb pumborder ph 
pumheight pmw pummaxwidth pw pumwidth pythondll pythonhome pythonthreedll 
pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape ro readonly 
rdt redrawtime re regexpengine rnu relativenumber remap rop renderoptions 
report rs restorescreen ri revins rl rightleft rlc rightleftcmd rubydll ru 
ruler ruf rulerformat rtp runtimepath scr scroll scb scrollbind scf scrollfocus 
sj scrolljump so scrolloff sbo scrollopt sect sections secure sel selection slm 
selectmode ssop sessionoptions sh shell shcf shellcmdflag sp shellpipe shq 
shellquote srr shellredir ssl shellslash stmp shelltemp st shelltype sxe 
shellxescape sxq shellxquote sr shiftround sw shiftwidth shm shortmess sn 
shortname sbr showbreak skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained sc showcmd sloc showcmdloc sft showfulltag sm 
showmatch smd showmode stal showtabline stpl showtabpanel ss sidescroll siso 
sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms 
smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl 
spelllang spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr 
splitright sol startofline stl statusline stlo statuslineopt su suffixes sua 
suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax 
tcl tabclose tal tabline tpm tabpagemax tpl tabpanel tplo tabpanelopt ts 
tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag 
tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc 
termguicolors twk termwinkey skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained twsl termwinscroll tws termwinsize twt 
termwintype terse ta textauto tx textmode tw textwidth tsr thesaurus tsrfu 
thesaurusfunc top tildeop to timeout tm timeoutlen title titlelen titleold 
titlestring tb toolbar tbis toolbariconsize ttimeout ttm ttimeoutlen tbi 
ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype udir undodir udf 
undofile ul undolevels ur undoreload uc updatecount ut updatetime vsts 
varsofttabstop vts vartabstop vbs verbose vfile verbosefile vdir viewdir vop 
viewoptions vi viminfo vif viminfofile ve virtualedit vb visualbell warn wiv 
weirdinvert ww whichwrap wc wildchar wcm wildcharm wig wildignore wic 
wildignorecase wmnu wildmenu wim wildmode wop wildoptions wak winaltkeys wcr 
wincolor wi window wfb winfixbuf skipwhite nextgroup=vimSetEqual,vimSetMod
-syn keyword vimOption contained wfh winfixheight wfw winfixwidth wh winheight 
whl winhighlight wmh winminheight wmw winminwidth winptydll wiw winwidth wse 
wlseat wst wlsteal wtm wltimeoutlen wrap wm wrapmargin ws wrapscan write wa 
writeany wb writebackup wd writedelay xtermcodes skipwhite 
nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained sc showcmd sloc showcmdloc sft showfulltag sm 
showmatch smd showmode stal showtabline stpl showtabpanel ss sidescroll siso 
sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms 
smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl 
spelllang spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr 
splitright sol startofline stl statusline stlo statuslineopt su suffixes sua 
suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax 
tcl tabclose tal tabline tpm tabpagemax tpl tabpanel tplo tabpanelopt ts 
tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag 
tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc 
termguicolors tsy termsync skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained twk termwinkey twsl termwinscroll tws 
termwinsize twt termwintype terse ta textauto tx textmode tw textwidth tsr 
thesaurus tsrfu thesaurusfunc top tildeop to timeout tm timeoutlen title 
titlelen titleold titlestring tb toolbar tbis toolbariconsize ttimeout ttm 
ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype 
udir undodir udf undofile ul undolevels ur undoreload uc updatecount ut 
updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile verbosefile 
vdir viewdir vop viewoptions vi viminfo vif viminfofile ve virtualedit vb 
visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm wildcharm wig 
wildignore wic wildignorecase wmnu wildmenu wim wildmode wop wildoptions wak 
winaltkeys wcr wincolor wi window skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained wfb winfixbuf wfh winfixheight wfw winfixwidth 
wh winheight whl winhighlight wmh winminheight wmw winminwidth winptydll wiw 
winwidth wse wlseat wst wlsteal wtm wltimeoutlen wrap wm wrapmargin ws wrapscan 
write wa writeany wb writebackup wd writedelay xtermcodes skipwhite 
nextgroup=vimSetEqual,vimSetMod
 
 " vimOptions: These are the turn-off setting variants {{{2
 " GEN_SYN_VIM: vimOption turn-off, START_STR='syn keyword vimOption 
contained', END_STR=''
 syn keyword vimOption contained noari noallowrevins noarab noarabic noarshape 
noarabicshape noacd noautochdir noac noautocomplete noai noautoindent noar 
noautoread noasd noautoshelldir noaw noautowrite noawa noautowriteall nobk 
nobackup nobeval noballooneval nobevalterm noballoonevalterm nobin nobinary 
nobomb nobri nobreakindent nobl nobuflisted nocdh nocdhome nocin nocindent nocp 
nocompatible nocf noconfirm noci nocopyindent nocsre nocscoperelative nocst 
nocscopetag nocsverb nocscopeverbose nocrb nocursorbind nocuc nocursorcolumn 
nocul nocursorline nodeco nodelcombine nodiff nodg nodigraph noed 
noedcompatible noemo noemoji noeof noendoffile noeol noendofline noea 
noequalalways noeb noerrorbells noek noesckeys noet noexpandtab noex noexrc 
nofic nofileignorecase
 syn keyword vimOption contained nofixeol nofixendofline nofen nofoldenable 
nofs nofsync nogd nogdefault noguipty nohid nohidden nohk nohkmap nohkp 
nohkmapp nohls nohlsearch noicon noic noignorecase noimc noimcmdline noimd 
noimdisable nois noincsearch noinf noinfercase noim noinsertmode nojs 
nojoinspaces nolnr nolangnoremap nolrm nolangremap nolz nolazyredraw nolbr 
nolinebreak nolisp nolist nolpl noloadplugins nomagic noml nomodeline nomle 
nomodelineexpr noma nomodifiable nomod nomodified nomore nomousef nomousefocus 
nomh nomousehide nomousemev nomousemoveevent nonu nonumber noodev noopendevice 
nopaste nopi nopreserveindent nopvw nopreviewwindow noprompt noro noreadonly 
nornu norelativenumber noremap nors norestorescreen nori norevins norl 
norightleft noru noruler
-syn keyword vimOption contained noscb noscrollbind noscf noscrollfocus 
nosecure nossl noshellslash nostmp noshelltemp nosr noshiftround nosn 
noshortname nosc noshowcmd nosft noshowfulltag nosm noshowmatch nosmd 
noshowmode noscs nosmartcase nosi nosmartindent nosta nosmarttab nosms 
nosmoothscroll nospell nosb nosplitbelow nospr nosplitright nosol nostartofline 
noswf noswapfile notbs notagbsearch notr notagrelative notgst notagstack 
notbidi notermbidi notgc notermguicolors noterse nota notextauto notx 
notextmode notop notildeop noto notimeout notitle nottimeout notbi nottybuiltin 
notf nottyfast noudf noundofile novb novisualbell nowarn nowiv noweirdinvert 
nowic nowildignorecase nowmnu nowildmenu nowfb nowinfixbuf nowfh nowinfixheight 
nowfw nowinfixwidth nowst nowlsteal
-syn keyword vimOption contained nowrap nows nowrapscan nowrite nowa nowriteany 
nowb nowritebackup noxtermcodes
+syn keyword vimOption contained noscb noscrollbind noscf noscrollfocus 
nosecure nossl noshellslash nostmp noshelltemp nosr noshiftround nosn 
noshortname nosc noshowcmd nosft noshowfulltag nosm noshowmatch nosmd 
noshowmode noscs nosmartcase nosi nosmartindent nosta nosmarttab nosms 
nosmoothscroll nospell nosb nosplitbelow nospr nosplitright nosol nostartofline 
noswf noswapfile notbs notagbsearch notr notagrelative notgst notagstack 
notbidi notermbidi notgc notermguicolors notsy notermsync noterse nota 
notextauto notx notextmode notop notildeop noto notimeout notitle nottimeout 
notbi nottybuiltin notf nottyfast noudf noundofile novb novisualbell nowarn 
nowiv noweirdinvert nowic nowildignorecase nowmnu nowildmenu nowfb nowinfixbuf 
nowfh nowinfixheight nowfw nowinfixwidth
+syn keyword vimOption contained nowst nowlsteal nowrap nows nowrapscan nowrite 
nowa nowriteany nowb nowritebackup noxtermcodes
 
 " vimOptions: These are the invertible variants {{{2
 " GEN_SYN_VIM: vimOption invertible, START_STR='syn keyword vimOption 
contained', END_STR=''
 syn keyword vimOption contained invari invallowrevins invarab invarabic 
invarshape invarabicshape invacd invautochdir invac invautocomplete invai 
invautoindent invar invautoread invasd invautoshelldir invaw invautowrite 
invawa invautowriteall invbk invbackup invbeval invballooneval invbevalterm 
invballoonevalterm invbin invbinary invbomb invbri invbreakindent invbl 
invbuflisted invcdh invcdhome invcin invcindent invcp invcompatible invcf 
invconfirm invci invcopyindent invcsre invcscoperelative invcst invcscopetag 
invcsverb invcscopeverbose invcrb invcursorbind invcuc invcursorcolumn invcul 
invcursorline invdeco invdelcombine invdiff invdg invdigraph inved 
invedcompatible invemo invemoji inveof invendoffile inveol invendofline invea 
invequalalways inveb inverrorbells
 syn keyword vimOption contained invek invesckeys invet invexpandtab invex 
invexrc invfic invfileignorecase invfixeol invfixendofline invfen invfoldenable 
invfs invfsync invgd invgdefault invguipty invhid invhidden invhk invhkmap 
invhkp invhkmapp invhls invhlsearch invicon invic invignorecase invimc 
invimcmdline invimd invimdisable invis invincsearch invinf invinfercase invim 
invinsertmode invjs invjoinspaces invlnr invlangnoremap invlrm invlangremap 
invlz invlazyredraw invlbr invlinebreak invlisp invlist invlpl invloadplugins 
invmagic invml invmodeline invmle invmodelineexpr invma invmodifiable invmod 
invmodified invmore invmousef invmousefocus invmh invmousehide invmousemev 
invmousemoveevent invnu invnumber invodev invopendevice invpaste invpi 
invpreserveindent
-syn keyword vimOption contained invpvw invpreviewwindow invprompt invro 
invreadonly invrnu invrelativenumber invremap invrs invrestorescreen invri 
invrevins invrl invrightleft invru invruler invscb invscrollbind invscf 
invscrollfocus invsecure invssl invshellslash invstmp invshelltemp invsr 
invshiftround invsn invshortname invsc invshowcmd invsft invshowfulltag invsm 
invshowmatch invsmd invshowmode invscs invsmartcase invsi invsmartindent invsta 
invsmarttab invsms invsmoothscroll invspell invsb invsplitbelow invspr 
invsplitright invsol invstartofline invswf invswapfile invtbs invtagbsearch 
invtr invtagrelative invtgst invtagstack invtbidi invtermbidi invtgc 
invtermguicolors invterse invta invtextauto invtx invtextmode invtop invtildeop 
invto invtimeout invtitle
-syn keyword vimOption contained invttimeout invtbi invttybuiltin invtf 
invttyfast invudf invundofile invvb invvisualbell invwarn invwiv invweirdinvert 
invwic invwildignorecase invwmnu invwildmenu invwfb invwinfixbuf invwfh 
invwinfixheight invwfw invwinfixwidth invwst invwlsteal invwrap invws 
invwrapscan invwrite invwa invwriteany invwb invwritebackup invxtermcodes
+syn keyword vimOption contained invpvw invpreviewwindow invprompt invro 
invreadonly invrnu invrelativenumber invremap invrs invrestorescreen invri 
invrevins invrl invrightleft invru invruler invscb invscrollbind invscf 
invscrollfocus invsecure invssl invshellslash invstmp invshelltemp invsr 
invshiftround invsn invshortname invsc invshowcmd invsft invshowfulltag invsm 
invshowmatch invsmd invshowmode invscs invsmartcase invsi invsmartindent invsta 
invsmarttab invsms invsmoothscroll invspell invsb invsplitbelow invspr 
invsplitright invsol invstartofline invswf invswapfile invtbs invtagbsearch 
invtr invtagrelative invtgst invtagstack invtbidi invtermbidi invtgc 
invtermguicolors invtsy invtermsync invterse invta invtextauto invtx 
invtextmode invtop invtildeop invto invtimeout
+syn keyword vimOption contained invtitle invttimeout invtbi invttybuiltin 
invtf invttyfast invudf invundofile invvb invvisualbell invwarn invwiv 
invweirdinvert invwic invwildignorecase invwmnu invwildmenu invwfb invwinfixbuf 
invwfh invwinfixheight invwfw invwinfixwidth invwst invwlsteal invwrap invws 
invwrapscan invwrite invwa invwriteany invwb invwritebackup invxtermcodes
 " termcap codes (which can also be set) {{{2
 " GEN_SYN_VIM: vimOption term output code, START_STR='syn keyword vimOption 
contained', END_STR='skipwhite nextgroup=vimSetEqual,vimSetMod'
-syn keyword vimOption contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD t_cd 
t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds t_Ds 
t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr t_ms 
t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf t_SH 
t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue t_us 
t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f t_8b 
t_8u t_xo skipwhite nextgroup=vimSetEqual,vimSetMod
+syn keyword vimOption contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD t_cd 
t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds t_Ds 
t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr t_ms 
t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf t_SH 
t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue t_us 
t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f t_8b 
t_8u t_xo t_BS t_ES skipwhite nextgroup=vimSetEqual,vimSetMod
 " term key codes
 syn keyword vimOption contained        t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 
t_F9 t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 
t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_KE t_KF t_KG t_kh t_KH t_kI 
t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ku
 syn match   vimOption contained        "t_%1"
@@ -110,10 +110,10 @@ syn keyword vimOptionVarName contained hi history hk 
hkmap hkp hkmapp hls hlsear
 syn keyword vimOptionVarName contained mfd maxfuncdepth mmd maxmapdepth mm 
maxmem mmp maxmempattern mmt maxmemtot msc maxsearchcount mis menuitems mopt 
messagesopt msm mkspellmem ml modeline mle modelineexpr mls modelines ma 
modifiable mod modified more mouse mousef mousefocus mh mousehide mousem 
mousemodel mousemev mousemoveevent mouses mouseshape mouset mousetime mzq 
mzquantum mzschemedll mzschemegcdll nf nrformats nu number nuw numberwidth ofu 
omnifunc odev opendevice opfunc operatorfunc ost osctimeoutlen pp packpath para 
paragraphs paste pt pastetoggle pex patchexpr pm patchmode pa path perldll pi 
preserveindent pvh previewheight pvp previewpopup pvw previewwindow pdev 
printdevice penc printencoding pexpr printexpr pfn printfont pheader 
printheader pmbcs printmbcharset
 syn keyword vimOptionVarName contained pmbfn printmbfont popt printoptions 
prompt pb pumborder ph pumheight pmw pummaxwidth pw pumwidth pythondll 
pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc 
qe quoteescape ro readonly rdt redrawtime re regexpengine rnu relativenumber 
remap rop renderoptions report rs restorescreen ri revins rl rightleft rlc 
rightleftcmd rubydll ru ruler ruf rulerformat rtp runtimepath scr scroll scb 
scrollbind scf scrollfocus sj scrolljump so scrolloff sbo scrollopt sect 
sections secure sel selection slm selectmode ssop sessionoptions sh shell shcf 
shellcmdflag sp shellpipe shq shellquote srr shellredir ssl shellslash stmp 
shelltemp st shelltype sxe shellxescape sxq shellxquote sr shiftround sw 
shiftwidth shm shortmess
 syn keyword vimOptionVarName contained sn shortname sbr showbreak sc showcmd 
sloc showcmdloc sft showfulltag sm showmatch smd showmode stal showtabline stpl 
showtabpanel ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si 
smartindent sta smarttab sms smoothscroll sts softtabstop spell spc 
spellcapcheck spf spellfile spl spelllang spo spelloptions sps spellsuggest sb 
splitbelow spk splitkeep spr splitright sol startofline stl statusline stlo 
statuslineopt su suffixes sua suffixesadd swf swapfile sws swapsync swb 
switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax tpl 
tabpanel tplo tabpanelopt ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl 
taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc 
termencoding
-syn keyword vimOptionVarName contained tgc termguicolors twk termwinkey twsl 
termwinscroll tws termwinsize twt termwintype terse ta textauto tx textmode tw 
textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to timeout tm 
timeoutlen title titlelen titleold titlestring tb toolbar tbis toolbariconsize 
ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll 
tty ttytype udir undodir udf undofile ul undolevels ur undoreload uc 
updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile 
verbosefile vdir viewdir vop viewoptions vi viminfo vif viminfofile ve 
virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm 
wildcharm wig wildignore wic wildignorecase wmnu wildmenu wim wildmode wop 
wildoptions wak winaltkeys
-syn keyword vimOptionVarName contained wcr wincolor wi window wfb winfixbuf 
wfh winfixheight wfw winfixwidth wh winheight whl winhighlight wmh winminheight 
wmw winminwidth winptydll wiw winwidth wse wlseat wst wlsteal wtm wltimeoutlen 
wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay 
xtermcodes
+syn keyword vimOptionVarName contained tgc termguicolors tsy termsync twk 
termwinkey twsl termwinscroll tws termwinsize twt termwintype terse ta textauto 
tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to 
timeout tm timeoutlen title titlelen titleold titlestring tb toolbar tbis 
toolbariconsize ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym 
ttymouse tsl ttyscroll tty ttytype udir undodir udf undofile ul undolevels ur 
undoreload uc updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs 
verbose vfile verbosefile vdir viewdir vop viewoptions vi viminfo vif 
viminfofile ve virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc 
wildchar wcm wildcharm wig wildignore wic wildignorecase wmnu wildmenu wim 
wildmode wop wildoptions
+syn keyword vimOptionVarName contained wak winaltkeys wcr wincolor wi window 
wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight whl winhighlight 
wmh winminheight wmw winminwidth winptydll wiw winwidth wse wlseat wst wlsteal 
wtm wltimeoutlen wrap wm wrapmargin ws wrapscan write wa writeany wb 
writebackup wd writedelay xtermcodes
 " GEN_SYN_VIM: vimOption term output code variable, START_STR='syn keyword 
vimOptionVarName contained', END_STR=''
-syn keyword vimOptionVarName contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD 
t_cd t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds 
t_Ds t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr 
t_ms t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf 
t_SH t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue 
t_us t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f 
t_8b t_8u t_xo
+syn keyword vimOptionVarName contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD 
t_cd t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds 
t_Ds t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr 
t_ms t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf 
t_SH t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue 
t_us t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f 
t_8b t_8u t_xo t_BS t_ES
 syn keyword vimOptionVarName contained t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 
t_F9 t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 
t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_KE t_KF t_KG t_kh t_KH t_kI 
t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ku
 syn match   vimOptionVarName contained "t_%1"
 syn match   vimOptionVarName contained "t_#2"
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 8c985394a..92fd9a62c 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -160,6 +160,8 @@ update_screen(int type_arg)
     }
     updating_screen = TRUE;
 
+    term_set_sync_output(TERM_SYNC_OUTPUT_ENABLE);
+
 #ifdef FEAT_PROP_POPUP
     // Update popup_mask if needed.  This may set w_redraw_top and w_redraw_bot
     // in some windows.
@@ -434,6 +436,8 @@ update_screen(int type_arg)
     redraw_listener_cleanup();
 #endif
 
+    term_set_sync_output(TERM_SYNC_OUTPUT_DISABLE);
+
     return OK;
 }
 
diff --git a/src/getchar.c b/src/getchar.c
index eaa766795..e825498c5 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1725,6 +1725,9 @@ using_script(void)
     void
 before_blocking(void)
 {
+    // Tell terminal to flush screen contents before blocking
+    term_set_sync_output(TERM_SYNC_OUTPUT_FLUSH);
+
     updatescript(0);
 #ifdef FEAT_EVAL
     if (may_garbage_collect)
diff --git a/src/gui.c b/src/gui.c
index a805c1423..698c7c2b3 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -148,8 +148,11 @@ gui_start(char_u *arg UNUSED)
     }
 #ifdef HAVE_CLIPMETHOD
     else
+    {
        // Reset clipmethod to CLIPMETHOD_NONE
        choose_clipmethod();
+       term_set_sync_output(TERM_SYNC_OUTPUT_OFF);
+    }
 #endif
 
 #if defined(FEAT_SOCKETSERVER) && defined(FEAT_GUI_GTK)
diff --git a/src/main.c b/src/main.c
index c31b14d0c..ec046f3b2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -892,6 +892,8 @@ vim_main2(void)
     may_req_termresponse();
 
     may_req_bg_color();
+
+    may_req_sync_output();
 # endif
 
     // start in insert mode
@@ -1855,6 +1857,8 @@ getout(int exitval)
     free_cmd_argsW();
 #endif
 
+    term_set_sync_output(TERM_SYNC_OUTPUT_OFF);
+
     mch_exit(exitval);
 }
 
diff --git a/src/option.c b/src/option.c
index 8de0d9c68..a56dfa3ae 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4409,6 +4409,14 @@ did_set_termguicolors(optset_T *args UNUSED)
 }
 #endif
 
+    char *
+did_set_termsync(optset_T *args UNUSED)
+{
+    if (!p_tsy)
+       term_set_sync_output(TERM_SYNC_OUTPUT_OFF);
+    return NULL;
+}
+
 #if defined(FEAT_TERMINAL)
 /*
  * Process the updated 'termwinscroll' option value.
diff --git a/src/option.h b/src/option.h
index fddc3905c..5f656f9b1 100644
--- a/src/option.h
+++ b/src/option.h
@@ -1035,6 +1035,7 @@ EXTERN char_u     *p_tenc;        // 'termencoding'
 #ifdef FEAT_TERMGUICOLORS
 EXTERN int     p_tgc;          // 'termguicolors'
 #endif
+EXTERN int     p_tsy;          // 'termsync'
 #ifdef FEAT_TERMINAL
 EXTERN long    p_twsl;         // 'termwinscroll'
 #endif
diff --git a/src/optiondefs.h b/src/optiondefs.h
index 2a2b1c0da..6ab34ff9e 100644
--- a/src/optiondefs.h
+++ b/src/optiondefs.h
@@ -2661,6 +2661,9 @@ static struct vimoption options[] =
                            {(char_u *)FALSE, (char_u *)FALSE}
 #endif
                            SCTX_INIT},
+    {"termsync", "tsy",            P_BOOL|P_VI_DEF,
+                           (char_u *)&p_tsy, PV_NONE, did_set_termsync, NULL,
+                           {(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
     {"termwinkey", "twk",   P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF,
 #ifdef FEAT_TERMINAL
                            (char_u *)VAR_WIN, PV_TWK, did_set_termwinkey, NULL,
@@ -3161,6 +3164,8 @@ static struct vimoption options[] =
     p_term("t_8b", T_8B)
     p_term("t_8u", T_8U)
     p_term("t_xo", T_XON)
+    p_term("t_BS", T_BSU)
+    p_term("t_ES", T_ESU)
 
 // terminal key codes are not in here
 
diff --git a/src/optionstr.c b/src/optionstr.c
index 7fb8bf548..a34d86a01 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -4456,6 +4456,9 @@ did_set_term_option(optset_T *args)
            out_str(T_BE);
     }
 
+    if (varp == &T_BSU || varp == &T_ESU)
+       term_set_sync_output(TERM_SYNC_OUTPUT_OFF);
+
     return NULL;
 }
 
diff --git a/src/po/vim.pot b/src/po/vim.pot
index f56581d18..32898088c 100644
--- a/src/po/vim.pot
+++ b/src/po/vim.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Vim
"
 "Report-Msgid-Bugs-To: [email protected]
"
-"POT-Creation-Date: 2026-03-02 19:53+0000
"
+"POT-Creation-Date: 2026-03-04 21:06+0000
"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE
"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>
"
 "Language-Team: LANGUAGE <[email protected]>
"
@@ -9445,6 +9445,9 @@ msgstr ""
 msgid "don't redraw while executing macros"
 msgstr ""
 
+msgid "enable terminal sync mode"
+msgstr ""
+
 msgid "timeout for 'hlsearch' and :match highlighting in msec"
 msgstr ""
 
diff --git a/src/proto/option.pro b/src/proto/option.pro
index 4fa8935c0..892a6ce3b 100644
--- a/src/proto/option.pro
+++ b/src/proto/option.pro
@@ -72,6 +72,7 @@ char *did_set_smoothscroll(optset_T *args);
 char *did_set_spell(optset_T *args);
 char *did_set_swapfile(optset_T *args);
 char *did_set_termguicolors(optset_T *args);
+char *did_set_termsync(optset_T *args);
 char *did_set_termwinscroll(optset_T *args);
 char *did_set_terse(optset_T *args);
 char *did_set_textauto(optset_T *args);
diff --git a/src/proto/term.pro b/src/proto/term.pro
index b831bc181..862864b39 100644
--- a/src/proto/term.pro
+++ b/src/proto/term.pro
@@ -96,4 +96,6 @@ void swap_tcap(void);
 void ansi_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx);
 void cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u 
*ansi_idx);
 int term_replace_keycodes(char_u *ta_buf, int ta_len, int len_arg);
+void may_req_sync_output(void);
+void term_set_sync_output(int flags);
 /* vim: set ft=c : */
diff --git a/src/structs.h b/src/structs.h
index b0b559e8a..2e0aaa31a 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -5329,3 +5329,12 @@ typedef enum {
 
 # endif
 #endif
+
+// Used in term_set_sync_output()
+typedef enum
+{
+    TERM_SYNC_OUTPUT_ENABLE = 1 << 0,
+    TERM_SYNC_OUTPUT_DISABLE = 1 << 1,
+    TERM_SYNC_OUTPUT_OFF = 1 << 2,
+    TERM_SYNC_OUTPUT_FLUSH = 1 << 3,
+} term_sync_output_T;
diff --git a/src/term.c b/src/term.c
index 39f63fa95..5e8b0945c 100644
--- a/src/term.c
+++ b/src/term.c
@@ -130,6 +130,9 @@ static termrequest_T u7_status = TERMREQUEST_INIT;
 // Request xterm compatibility check:
 static termrequest_T xcc_status = TERMREQUEST_INIT;
 
+// Request synchronized output report
+static termrequest_T sync_output_status = TERMREQUEST_INIT;
+
 #ifdef FEAT_TERMRESPONSE
 # ifdef FEAT_TERMINAL
 // Request foreground color report:
@@ -165,6 +168,7 @@ static termrequest_T *all_termrequests[] = {
     &rbm_status,
     &rcs_status,
     &winpos_status,
+    &sync_output_status,
     NULL
 };
 
@@ -224,6 +228,24 @@ static int initial_cursor_shape_blink = FALSE;
 static int initial_cursor_blink = FALSE;
 #endif
 
+// 0   Mode is not recognized  not supported
+//
+// 1   Set                     supported and screen updates are not shown to
+//                             the user until mode is disabled
+//
+// 2   Reset                   supported and screen updates are shown as usual
+//                             (e.g. as soon as they arrive)
+//
+// 3   Permanently set         undefined
+//
+// 4   Permanently reset       not supported
+//
+static int sync_output_setting = 0;
+
+// > 0: Currently batching output
+// == 0: No synchronized output
+static int sync_output_state = 0;
+
 /*
  * The builtin termcap entries.
  *
@@ -2185,6 +2207,14 @@ set_termname(char_u *term)
                                           && (T_CRV == NULL || *T_CRV == NUL))
        T_CRV = (char_u *)" [>c";
 
+    // These are the DECSET/DECRESET codes for synchronized output. iTerm
+    // supports another way, but this is the de facto standard terminal codes
+    // that are used (from what I can tell - 64bitman).
+    if (T_BSU == NULL || T_BSU == empty_option)
+       T_BSU = (char_u *)" [?2026h";
+    if (T_ESU == NULL || T_ESU == empty_option)
+       T_ESU = (char_u *)" [?2026l";
+
 #ifdef UNIX
 /*
  * Any "stty" settings override the default for t_kb from the termcap.
@@ -5564,6 +5594,8 @@ handle_csi_function_key(
  *
  * - DA1 query response: {lead}?...;c
  *
+ * - DEC mode 2026 response (synchronized output): {lead}?2026;{mode}$y
+ *
  * Return 0 for no match, -1 for partial match, > 0 for full match.
  */
     static int
@@ -5692,6 +5724,28 @@ handle_csi(
        key_name[1] = (int)KE_IGNORE;
     }
 
+    // DEC 2026 mode response (for 'termsync' option)
+    else if (first == '?' && trail == 'y' && argc == 2 && arg[0] == 2026)
+    {
+       int setting = arg[1];
+
+       *slen = csi_len;
+       key_name[0] = (int)KS_EXTRA;
+       key_name[1] = (int)KE_IGNORE;
+
+       if (setting >= 0 && setting <= 4)
+       {
+           sync_output_setting = setting;
+           LOG_TRN("Received DEC 2026 mode: %s", tp);
+           sync_output_status.tr_progress = STATUS_GOT;
+
+           set_option_value_give_err((char_u *)"termsync",
+                   setting == 1 || setting == 2, NULL, 0);
+       }
+       else
+           LOG_TRN("Unknown synchronized output setting %d", setting);
+    }
+
     // Version string: Eat it when there is at least one digit and
     // it ends in 'c'
     else if (*T_CRV != NUL && ap > argp + 1 && trail == 'c')
@@ -7798,3 +7852,95 @@ term_replace_keycodes(char_u *ta_buf, int ta_len, int 
len_arg)
     }
     return len;
 }
+
+#ifdef FEAT_TERMRESPONSE
+/*
+ * Query the setting for DEC mode 2026 (synchronized output) from the terminal.
+ */
+    void
+may_req_sync_output(void)
+{
+    if (can_get_termresponse() && starting == 0
+           && sync_output_status.tr_progress == STATUS_GET)
+    {
+       MAY_WANT_TO_LOG_THIS;
+       LOG_TR1("Sending synchronized output request");
+
+       out_str((char_u *)" [?2026$p");
+       termrequest_sent(&sync_output_status);
+
+       // check for the characters now, otherwise they might be eaten by
+       // get_keystroke()
+       out_flush();
+       (void)vpeekc_nomap();
+    }
+
+}
+#endif
+
+/*
+ * Enable or disable synchronized output if possible. Specification can be 
found
+ * here:
+ * 
https://github.com/contour-terminal/vt-extensions/blob/master/synchronized-output.md
+ */
+    void
+term_set_sync_output(int flags)
+{
+    bool    allowed;
+    char_u  *str;
+#ifdef FEAT_GUI
+    bool    in_gui = gui.in_use;
+#else
+    bool    in_gui = false;
+#endif
+
+    allowed = p_tsy && (sync_output_setting == 1 || sync_output_setting == 2);
+
+    if (flags & TERM_SYNC_OUTPUT_FLUSH)
+    {
+       // Tell terminal to display screen contents
+       if (allowed && !in_gui && sync_output_state > 0 && *T_ESU != NUL &&
+               *T_BSU != NUL)
+       {
+           out_str((char_u *)T_ESU);
+           out_str((char_u *)T_BSU);
+       }
+       return;
+    }
+
+    // Forcibly turn off synchronized output (e.g. 'notermsync')
+    if (flags & TERM_SYNC_OUTPUT_OFF)
+    {
+       if (sync_output_state > 0 && *T_ESU != NUL)
+       {
+           out_str((char_u *)T_ESU);
+           sync_output_state = 0;
+       }
+       return;
+    }
+
+    if (!allowed || in_gui || *T_BSU == NUL || *T_ESU == NUL)
+       return;
+
+    // Only enable if we aren't already, and only disable if we have reached
+    // zero.
+    if (flags & TERM_SYNC_OUTPUT_ENABLE)
+    {
+       if (sync_output_state++ > 0)
+           return;
+       str = T_BSU;
+    }
+    else if (flags & TERM_SYNC_OUTPUT_DISABLE)
+    {
+       if (sync_output_state == 0 || --sync_output_state > 0)
+           return;
+       str = T_ESU;
+    }
+    else
+    {
+       siemsg("Unknown sync output value %d", flags);
+       return;
+    }
+
+    out_str((char_u *)str);
+}
diff --git a/src/termdefs.h b/src/termdefs.h
index d611fcf44..7c15c26c1 100644
--- a/src/termdefs.h
+++ b/src/termdefs.h
@@ -116,10 +116,12 @@ enum SpecialKey
     KS_FD,     // disable focus event tracking
     KS_FE,     // enable focus event tracking
     KS_CF,     // set terminal alternate font
-    KS_XON     // terminal uses xon/xoff handshaking
+    KS_XON,    // terminal uses xon/xoff handshaking
+    KS_BSU,    // begin synchronized update
+    KS_ESU     // end synchronized update
 };
 
-#define KS_LAST            KS_XON
+#define KS_LAST            KS_ESU
 
 /*
  * the terminal capabilities are stored in this array
@@ -226,6 +228,8 @@ extern char_u *(term_strings[]);    // current terminal 
strings
 #define T_FD   (TERM_STR(KS_FD))       // disable focus event tracking
 #define T_FE   (TERM_STR(KS_FE))       // enable focus event tracking
 #define T_XON  (TERM_STR(KS_XON))      // terminal uses xon/xoff handshaking
+#define T_BSU  (TERM_STR(KS_BSU))      // begin synchronized update
+#define T_ESU  (TERM_STR(KS_ESU))      // end synchronized update
 
 typedef enum {
     TMODE_COOK,            // terminal mode for external cmds and Ex mode
diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim
index dc1399793..bca393b1a 100644
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -318,7 +318,7 @@ func Test_set_completion()
 
   " Expand abbreviation of options.
   call feedkeys(":set ts\<C-A>\<C-B>\"\<CR>", 'tx')
-  call assert_equal('"set tabstop thesaurus thesaurusfunc ttyscroll', @:)
+  call assert_equal('"set tabstop termsync thesaurus thesaurusfunc ttyscroll', 
@:)
 
   " Expand current value
   call feedkeys(":set suffixes=\<C-A>\<C-B>\"\<CR>", 'tx')
diff --git a/src/version.c b/src/version.c
index 39821b752..0590e75f7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    110,
 /**/
     109,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vxtYg-006wwd-43%40256bit.org.

Raspunde prin e-mail lui