diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index 7aab061dc3..15b419c691 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -40,17 +40,6 @@ describe('Diff mode screen', function() screen = Screen.new(40, 16) screen:attach() - screen:set_default_attr_ids({ - [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray }, - [2] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }, - [3] = { reverse = true }, - [4] = { background = Screen.colors.LightBlue }, - [5] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey }, - [6] = { bold = true, foreground = Screen.colors.Blue1 }, - [7] = { bold = true, reverse = true }, - [8] = { bold = true, background = Screen.colors.Red }, - [9] = { background = Screen.colors.LightMagenta }, - }) end) it('Add a line in beginning of file 2', function() @@ -60,31 +49,31 @@ describe('Diff mode screen', function() feed(':set diffopt=filler') screen:expect([[ - {1: }{2:------------------}│{1: }{4:0 }| - {1: }^1 │{1: }1 | - {1: }2 │{1: }2 | - {1: }3 │{1: }3 | - {1: }4 │{1: }4 | - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1:+ }{5:+-- 4 lines: 7···}│{1:+ }{5:+-- 4 lines: 7··}| - {6:~ }│{6:~ }|*6 - {7:') screen:expect([[ - {1: }{2:------------------}│{1: }{4:0 }| - {1: }^1 │{1: }1 | - {1: }2 │{1: }2 | - {1: }3 │{1: }3 | - {1: }4 │{1: }4 | - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1:+ }{5:+-- 4 lines: 7···}│{1:+ }{5:+-- 4 lines: 7··}| - {6:~ }│{6:~ }|*6 - {7:') screen:expect([[ - {1: }{4:^0 }│{1: }{2:-----------------}| - {1: }1 │{1: }1 | - {1: }2 │{1: }2 | - {1: }3 │{1: }3 | - {1: }4 │{1: }4 | - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1:+ }{5:+-- 4 lines: 7···}│{1:+ }{5:+-- 4 lines: 7··}| - {6:~ }│{6:~ }|*6 - {7:') screen:expect([[ - {1: }{4:^0 }│{1: }{2:-----------------}| - {1: }1 │{1: }1 | - {1: }2 │{1: }2 | - {1: }3 │{1: }3 | - {1: }4 │{1: }4 | - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1:+ }{5:+-- 4 lines: 7···}│{1:+ }{5:+-- 4 lines: 7··}| - {6:~ }│{6:~ }|*6 - {7:') screen:expect([[ - {1:+ }{5:^+-- 4 lines: 1···}│{1:+ }{5:+-- 4 lines: 1··}| - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1: }7 │{1: }7 | - {1: }8 │{1: }8 | - {1: }9 │{1: }9 | - {1: }10 │{1: }10 | - {1: }{2:------------------}│{1: }{4:11 }| - {6:~ }│{6:~ }|*6 - {7:') screen:expect([[ - {1:+ }{5:^+-- 4 lines: 1···}│{1:+ }{5:+-- 4 lines: 1··}| - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1: }7 │{1: }7 | - {1: }8 │{1: }8 | - {1: }9 │{1: }9 | - {1: }10 │{1: }10 | - {1: }{2:------------------}│{1: }{4:11 }| - {6:~ }│{6:~ }|*6 - {7:') screen:expect([[ - {1:+ }{5:^+-- 4 lines: 1···}│{1:+ }{5:+-- 4 lines: 1··}| - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1: }7 │{1: }7 | - {1: }8 │{1: }8 | - {1: }9 │{1: }9 | - {1: }10 │{1: }10 | - {1: }{4:11 }│{1: }{2:-----------------}| - {6:~ }│{6:~ }|*6 - {7:') screen:expect([[ - {1:+ }{5:^+-- 4 lines: 1···}│{1:+ }{5:+-- 4 lines: 1··}| - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1: }7 │{1: }7 | - {1: }8 │{1: }8 | - {1: }9 │{1: }9 | - {1: }10 │{1: }10 | - {1: }{4:11 }│{1: }{2:-----------------}| - {6:~ }│{6:~ }|*6 - {7:') screen:expect([[ - {1: }^1 │{1: }1 | - {1: }2 │{1: }2 | - {1: }3 │{1: }3 | - {1: }4 │{1: }4 | - {1: }{2:------------------}│{1: }{4:4 }| - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1: }7 │{1: }7 | - {1: }8 │{1: }8 | - {1: }9 │{1: }9 | - {1: }10 │{1: }10 | - {1: }{4:11 }│{1: }{2:-----------------}| - {6:~ }│{6:~ }|*2 - {7:') screen:expect([[ - {1: }^1 │{1: }1 | - {1: }2 │{1: }2 | - {1: }3 │{1: }3 | - {1: }4 │{1: }4 | - {1: }{2:------------------}│{1: }{4:4 }| - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1: }7 │{1: }7 | - {1: }8 │{1: }8 | - {1: }9 │{1: }9 | - {1: }10 │{1: }10 | - {1: }{4:11 }│{1: }{2:-----------------}| - {6:~ }│{6:~ }|*2 - {7:') screen:expect([[ - {1: }^1 │{1: }1 | - {1: }2 │{1: }2 | - {1: }3 │{1: }3 | - {1: }4 │{1: }4 | - {1: }{4:4 }│{1: }{2:-----------------}| - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1: }7 │{1: }7 | - {1: }8 │{1: }8 | - {1: }9 │{1: }9 | - {1: }10 │{1: }10 | - {1: }{2:------------------}│{1: }{4:11 }| - {6:~ }│{6:~ }|*2 - {7:') screen:expect([[ - {1: }^1 │{1: }1 | - {1: }2 │{1: }2 | - {1: }3 │{1: }3 | - {1: }4 │{1: }4 | - {1: }{4:4 }│{1: }{2:-----------------}| - {1: }5 │{1: }5 | - {1: }6 │{1: }6 | - {1: }7 │{1: }7 | - {1: }8 │{1: }8 | - {1: }9 │{1: }9 | - {1: }10 │{1: }10 | - {1: }{2:------------------}│{1: }{4:11 }| - {6:~ }│{6:~ }|*2 - {7:') screen:expect([[ - {1: }^#include │{1: }#include 2)}{9: }| - {1: }{4: for(i = 0; i <}│{1: }{2:-----------------}| - {1: } { │{1: } { | - {1: }{9: }{8:printf("Yo}│{1: }{9: }{8:return fi}| - {1: }{4: printf("%d}│{1: }{2:-----------------}| - {1: } } │{1: } } | - {1: }{2:------------------}│{1: }{4: return 1; }| - {1: }} │{1: }} | - {1: } │{1: } | - {7:│{7: }#include 2)}{4: }| + {7: }{22: for(i = 0; i <}│{7: }{23:-----------------}| + {7: } { │{7: } { | + {7: }{4: }{27:printf("Yo}│{7: }{4: }{27:return fi}| + {7: }{22: printf("%d}│{7: }{23:-----------------}| + {7: } } │{7: } } | + {7: }{23:------------------}│{7: }{22: return 1; }| + {7: }} │{7: }} | + {7: } │{7: } | + {3: 1)}{9: }│{1: }{9: i}{8:nt i;}{9: }| - {1: }{2:------------------}│{1: }{4: for(i = 0; i }| - {1: } { │{1: } { | - {1: }{9: }{8:return fac}│{1: }{9: }{8:printf("%}| - {1: } } │{1: } } | - {1: }{4: return 1; }│{1: }{2:-----------------}| - {1: }} │{1: }} | - {1: } │{1: } | - {1: }int main(int argc,│{1: }int main(int argc| - {1: }{ │{1: }{ | - {1: }{9: frobnitz(f}{8:act}{9:(}│{1: }{9: frobnitz(f}{8:ib}{9:(}| - {1: }^} │{1: }} | - {7: 1)}{4: }│{7: }{4: i}{27:nt i;}{4: }| + {7: }{23:------------------}│{7: }{22: for(i = 0; i }| + {7: } { │{7: } { | + {7: }{4: }{27:return fac}│{7: }{4: }{27:printf("%}| + {7: } } │{7: } } | + {7: }{22: return 1; }│{7: }{23:-----------------}| + {7: }} │{7: }} | + {7: } │{7: } | + {7: }int main(int argc,│{7: }int main(int argc| + {7: }{ │{7: }{ | + {7: }{4: frobnitz(f}{27:act}{4:(}│{7: }{4: frobnitz(f}{27:ib}{4:(}| + {7: }^} │{7: }} | + {3:') screen:expect([[ - {1: }^#include │{1: }#include 2) }| - {1: }{2:------------------}│{1: }{4: { }| - {1: }{2:------------------}│{1: }{4: return fi}| - {1: }{2:------------------}│{1: }{4: } }| - {1: }{2:------------------}│{1: }{4: return 1; }| - {1: }{2:------------------}│{1: }{4:} }| - {1: }{2:------------------}│{1: }{4: }| - {1: }// Frobs foo heart│{1: }// Frobs foo hear| - {1: }int frobnitz(int f│{1: }int frobnitz(int | - {1: }{ │{1: }{ | - {7:│{7: }#include 2) }| + {7: }{23:------------------}│{7: }{22: { }| + {7: }{23:------------------}│{7: }{22: return fi}| + {7: }{23:------------------}│{7: }{22: } }| + {7: }{23:------------------}│{7: }{22: return 1; }| + {7: }{23:------------------}│{7: }{22:} }| + {7: }{23:------------------}│{7: }{22: }| + {7: }// Frobs foo heart│{7: }// Frobs foo hear| + {7: }int frobnitz(int f│{7: }int frobnitz(int | + {7: }{ │{7: }{ | + {3: 1) }│{1: }{2:-----------------}| - {1: }{4: { }│{1: }{2:-----------------}| - {1: }{4: return fac}│{1: }{2:-----------------}| - {1: }{4: } }│{1: }{2:-----------------}| - {1: }{4: return 1; }│{1: }{2:-----------------}| - {1: }{4:} }│{1: }{2:-----------------}| - {1: }{4: }│{1: }{2:-----------------}| - {1: }int main(int argc,│{1: }int main(int argc| - {1: }{ │{1: }{ | - {1: }{9: frobnitz(f}{8:act}{9:(}│{1: }{9: frobnitz(f}{8:ib}{9:(}| - {1: }^} │{1: }} | - {7: 1) }│{7: }{23:-----------------}| + {7: }{22: { }│{7: }{23:-----------------}| + {7: }{22: return fac}│{7: }{23:-----------------}| + {7: }{22: } }│{7: }{23:-----------------}| + {7: }{22: return 1; }│{7: }{23:-----------------}| + {7: }{22:} }│{7: }{23:-----------------}| + {7: }{22: }│{7: }{23:-----------------}| + {7: }int main(int argc,│{7: }int main(int argc| + {7: }{ │{7: }{ | + {7: }{4: frobnitz(f}{27:act}{4:(}│{7: }{4: frobnitz(f}{27:ib}{4:(}| + {7: }^} │{7: }} | + {3:') screen:expect([[ - {1: }^#include │{1: }#include 2) }| - {1: }{2:------------------}│{1: }{4: { }| - {1: }{2:------------------}│{1: }{4: return fi}| - {1: }{2:------------------}│{1: }{4: } }| - {1: }{2:------------------}│{1: }{4: return 1; }| - {1: }{2:------------------}│{1: }{4:} }| - {1: }{2:------------------}│{1: }{4: }| - {1: }// Frobs foo heart│{1: }// Frobs foo hear| - {1: }int frobnitz(int f│{1: }int frobnitz(int | - {1: }{ │{1: }{ | - {7:│{7: }#include 2) }| + {7: }{23:------------------}│{7: }{22: { }| + {7: }{23:------------------}│{7: }{22: return fi}| + {7: }{23:------------------}│{7: }{22: } }| + {7: }{23:------------------}│{7: }{22: return 1; }| + {7: }{23:------------------}│{7: }{22:} }| + {7: }{23:------------------}│{7: }{22: }| + {7: }// Frobs foo heart│{7: }// Frobs foo hear| + {7: }int frobnitz(int f│{7: }int frobnitz(int | + {7: }{ │{7: }{ | + {3: 1) }│{1: }{2:-----------------}| - {1: }{4: { }│{1: }{2:-----------------}| - {1: }{4: return fac}│{1: }{2:-----------------}| - {1: }{4: } }│{1: }{2:-----------------}| - {1: }{4: return 1; }│{1: }{2:-----------------}| - {1: }{4:} }│{1: }{2:-----------------}| - {1: }{4: }│{1: }{2:-----------------}| - {1: }int main(int argc,│{1: }int main(int argc| - {1: }{ │{1: }{ | - {1: }{9: frobnitz(f}{8:act}{9:(}│{1: }{9: frobnitz(f}{8:ib}{9:(}| - {1: }^} │{1: }} | - {7: 1) }│{7: }{23:-----------------}| + {7: }{22: { }│{7: }{23:-----------------}| + {7: }{22: return fac}│{7: }{23:-----------------}| + {7: }{22: } }│{7: }{23:-----------------}| + {7: }{22: return 1; }│{7: }{23:-----------------}| + {7: }{22:} }│{7: }{23:-----------------}| + {7: }{22: }│{7: }{23:-----------------}| + {7: }int main(int argc,│{7: }int main(int argc| + {7: }{ │{7: }{ | + {7: }{4: frobnitz(f}{27:act}{4:(}│{7: }{4: frobnitz(f}{27:ib}{4:(}| + {7: }^} │{7: }} | + {3:') screen:expect([[ - {1: }^def finalize(value│{1: }def finalize(valu| - {1: } │{1: } | - {1: } values.each do |│{1: } values.each do | - {1: }{2:------------------}│{1: }{4: v.prepare }| - {1: }{2:------------------}│{1: }{4: end }| - {1: }{2:------------------}│{1: }{4: }| - {1: }{2:------------------}│{1: }{4: values.each do }| - {1: } v.finalize │{1: } v.finalize | - {1: } end │{1: } end | - {6:~ }│{6:~ }|*5 - {7:') screen:expect([[ - {1: }^def finalize(value│{1: }def finalize(valu| - {1: } │{1: } | - {1: }{2:------------------}│{1: }{4: values.each do }| - {1: }{2:------------------}│{1: }{4: v.prepare }| - {1: }{2:------------------}│{1: }{4: end }| - {1: }{2:------------------}│{1: }{4: }| - {1: } values.each do |│{1: } values.each do | - {1: } v.finalize │{1: } v.finalize | - {1: } end │{1: } end | - {6:~ }│{6:~ }|*5 - {7:') feed(':') screen:expect([[ - {1: }^def finalize(value│{1: }def finalize(valu| - {1: } │{1: } | - {1: }{2:------------------}│{1: }{4: values.each do }| - {1: }{2:------------------}│{1: }{4: v.prepare }| - {1: }{2:------------------}│{1: }{4: end }| - {1: }{2:------------------}│{1: }{4: }| - {1: } values.each do |│{1: } values.each do | - {1: } v.finalize │{1: } v.finalize | - {1: } end │{1: } end | - {6:~ }│{6:~ }|*5 - {7:') screen:expect([[ - {1:+ }{5:^+-- 10 lines: 1···}│{1:+ }{5:+-- 10 lines: 1··}| - {6:~ }│{6:~ }|*13 - {7:') screen:expect([[ - {1:+ }{5:^+-- 10 lines: 1···}│{1:+ }{5:+-- 10 lines: 1··}| - {6:~ }│{6:~ }|*13 - {7:') screen:expect([[ - {1:- }^ │{1:- } | - {6:~ }│{6:~ }|*13 - {7:') screen:expect([[ - {1:- }^ │{1:- } | - {6:~ }│{6:~ }|*13 - {7:') screen:expect([[ - {1: }^a │{1: }A | - {1: }b │{1: }b | - {1: }{9:cd }│{1: }{9:cD}{8:e}{9: }| - {6:~ }│{6:~ }|*11 - {7:') screen:expect([[ - {1: }^a │{1: }A | - {1: }b │{1: }b | - {1: }{9:cd }│{1: }{9:cD}{8:e}{9: }| - {6:~ }│{6:~ }|*11 - {7:') screen:expect([[ - {1: }^int main() │{1: }int main() | - {1: }{ │{1: }{ | - {1: }{2:------------------}│{1: }{4: if (0) }| - {1: }{2:------------------}│{1: }{4: { }| - {1: } printf("Hello, │{1: } printf("Hel| - {1: } return 0; │{1: } return 0; | - {1: }{2:------------------}│{1: }{4: } }| - {1: }} │{1: }} | - {6:~ }│{6:~ }|*6 - {7:') screen:expect([[ - {1: }^int main() │{1: }int main() | - {1: }{ │{1: }{ | - {1: }{2:------------------}│{1: }{4: if (0) }| - {1: }{2:------------------}│{1: }{4: { }| - {1: } printf("Hello, │{1: } printf("Hel| - {1: } return 0; │{1: } return 0; | - {1: }{2:------------------}│{1: }{4: } }| - {1: }} │{1: }} | - {6:~ }│{6:~ }|*6 - {7:') screen:expect([[ - {1: }^a │{1: }a | - {1: }{4: }│{1: }{2:-----------------}|*2 - {1: }cd │{1: }cd | - {1: }ef │{1: } | - {1: }{8:xxx}{9: }│{1: }ef | - {6:~ }│{1: }{8:yyy}{9: }| - {6:~ }│{6:~ }|*7 - {7:') feed(':') screen:expect([[ - {1: }^a │{1: }a | - {1: } │{1: }cd | - {1: } │{1: } | - {1: }cd │{1: }ef | - {1: }ef │{1: }{8:yyy}{9: }| - {1: }{8:xxx}{9: }│{6:~ }| - {6:~ }│{6:~ }|*8 - {7:') feed(':') screen:expect([[ - {1: }^a │{1: }a | - {1: } │{1: }cd | - {1: } │{1: } | - {1: }cd │{1: }ef | - {1: }ef │{1: }{8:yyy}{9: }| - {1: }{8:xxx}{9: }│{6:~ }| - {6:~ }│{6:~ }|*8 - {7:') feed(':') screen:expect([[ - {1: }^a │{1: }a | - {1: } │{1: }cd | - {1: } │{1: } | - {1: }cd │{1: }ef | - {1: }ef │{1: }{8:yyy}{9: }| - {1: }{8:xxx}{9: }│{6:~ }| - {6:~ }│{6:~ }|*8 - {7:') feed(':') screen:expect([[ - {1: }^a │{1: }a | - {1: }x │{1: }x | - {1: }{9:cd }│{1: }{9:c}{8: }{9:d }| - {1: }{9:ef }│{1: }{8: }{9:ef }| - {1: }{9:xx }{8: }{9:xx }│{1: }{9:xx xx }| - {1: }foo │{1: }foo | - {1: }{2:------------------}│{1: }{4: }| - {1: }bar │{1: }bar | - {6:~ }│{6:~ }|*6 - {7:') feed(':') screen:expect([[ - {1: }^a │{1: }a | - {1: }x │{1: }x | - {1: }cd │{1: }c d | - {1: }ef │{1: } ef | - {1: }xx xx │{1: }xx xx | - {1: }foo │{1: }foo | - {1: }{2:------------------}│{1: }{4: }| - {1: }bar │{1: }bar | - {6:~ }│{6:~ }|*6 - {7:jjjj') screen:expect([[ - {1: }line 1 │{1: }line 1 | - {1: }line 2 │{1: }line 2 | - {1: }line 3 │{1: }line 3 | - {1: }line 4 │{1: }line 4 | - {1: } │{1: }^ | - {1: }{2:-----------------}│{1: }{4:Lorem }| - {1: }{2:-----------------}│{1: }{4:ipsum }| - {1: }{2:-----------------}│{1: }{4:dolor }| - {1: }{2:-----------------}│{1: }{4:sit }| - {1: }{2:-----------------}│{1: }{4:amet, }| - {3:') screen:expect([[ - {1: }^if __name__ == "__│{1: }if __name__ == "_| - {1: } import sys │{1: } import sys | - {1: }{9: }{8:app = QWidgets}│{1: }{9: }{8:comment these}| - {1: }{9: }{8:MainWindow = Q}│{1: }{9: }{8:#app = QWidge}| - {1: }{9: }{8:ui = UI_}{9:MainWi}│{1: }{9: }{8:#MainWindow =}| - {1: }{2:------------------}│{1: }{4: add a complet}| - {1: }{2:------------------}│{1: }{4: #ui = UI_Main}| - {1: }{2:------------------}│{1: }{4: add another n}| - {1: } ui.setupUI(Mai│{1: } ui.setupUI(Ma| - {1: } MainWindow.sho│{1: } MainWindow.sh| - {1: } sys.exit(app.e│{1: } sys.exit(app.| - {6:~ }│{6:~ }|*3 - {7:') screen:expect([[ - {1: }if __name__ == "__│{1: }if __name__ == "_| - {1: } import sys │{1: } import sys | - {1: }{2:------------------}│{1: }{4: comment these}| - {1: }{9: app = QWidgets}│{1: }{9: }{8:#}{9:app = QWidge}| - {1: }{9: MainWindow = Q}│{1: }{9: }{8:#}{9:MainWindow =}| - {1: }{2:------------------}│{1: }{4: add a complet}| - {1: }{9: ui = UI_MainWi}│{1: }{9: }{8:#}{9:ui = UI_Main}| - {1: }{2:------------------}│{1: }{4: add another n}| - {1: } ui.setupUI(Mai│{1: } ui.setupUI(Ma| - {1: } MainWindow.sho│{1: } MainWindow.sh| - {1: } ^sys.exit(app.e│{1: } sys.exit(app.| - {6:~ }│{6:~ }|*3 - {7:') screen:expect([[ - {1: }^DDD │{1: }DDD | - {1: }{2:------------------}│{1: }{4:AAA }| - {1: }{8:_a}{9:a }│{1: }{8:ccc}{9:a }| - {6:~ }│{6:~ }|*11 - {7:') screen:expect([[ - {1: }^DDD │{1: }DDD | - {1: }{8:_}{9:aa }│{1: }{8:A}{9:AA }| - {1: }{2:------------------}│{1: }{4:ccca }| - {6:~ }│{6:~ }|*11 - {7:') screen:expect { grid = [[ - {1: }^BB │{1: }BB | - {1: }{9: AA}{8:A}{9: }│{1: }{9: AA}{8:B}{9: }| - {1: }{2:------------------}│{1: }{4:AAAB }| - {6:~ }│{6:~ }|*11 - {7:') screen:expect { grid = [[ - {1: }^BB │{1: }BB | - {1: }{2:------------------}│{1: }{4: AAB }| - {1: }{9: AAA }│{1: }{9:AAA}{8:B}{9: }| - {6:~ }│{6:~ }|*11 - {7:') screen:expect { grid = [[ - {1: }{2:------------------}│{1: }{4:6 }| - {1: }{2:------------------}│{1: }{4:7 }| - {1: }{2:------------------}│{1: }{4:8 }| - {1: }9 │{1: }9 | - {1: }10 │{1: }10 | - {1: }11 │{1: }11 | - {1: }12 │{1: }12 | - {1: }13 │{1: }13 | - {1: }14 │{1: }14 | - {1: }{5:15}{6:^x}{5: }│{1: }{5:15 }| - {7:~ }│{7:~ }|*8 - {8:[No Name] [+] }{3:[No Name] [+] }| + {7: }{23:------------------}│{7: }{22:6 }| + {7: }{23:------------------}│{7: }{22:7 }| + {7: }{23:------------------}│{7: }{22:8 }| + {7: }9 │{7: }9 | + {7: }10 │{7: }10 | + {7: }11 │{7: }11 | + {7: }12 │{7: }12 | + {7: }13 │{7: }13 | + {7: }14 │{7: }14 | + {7: }{4:15}{27:^x}{4: }│{7: }{4:15 }| + {1:~ }│{1:~ }|*8 + {3:[No Name] [+] }{2:[No Name] [+] }| | ]], } feed('lay') screen:expect { grid = [[ - {1: }{2:-----------------}│{1: }{4:6 }| - {1: }{2:-----------------}│{1: }{4:7 }| - {1: }{2:-----------------}│{1: }{4:8 }| - {1: }9 │{1: }9 | - {1: }10 │{1: }10 | - {1: }11 │{1: }11 | - {1: }12 │{1: }12 | - {1: }13 │{1: }13 | - {1: }14 │{1: }14 | - {1: }{5:15}{6:x}{5: }│{1: }{5:15}{6:^y}{5: }| - {7:~ }│{7:~ }|*8 - {3:[No Name] [+] }{8:[No Name] [+] }| + {7: }{23:-----------------}│{7: }{22:6 }| + {7: }{23:-----------------}│{7: }{22:7 }| + {7: }{23:-----------------}│{7: }{22:8 }| + {7: }9 │{7: }9 | + {7: }10 │{7: }10 | + {7: }11 │{7: }11 | + {7: }12 │{7: }12 | + {7: }13 │{7: }13 | + {7: }14 │{7: }14 | + {7: }{4:15}{27:x}{4: }│{7: }{4:15}{27:^y}{4: }| + {1:~ }│{1:~ }|*8 + {2:[No Name] [+] }{3:[No Name] [+] }| | ]], } @@ -1368,15 +1334,12 @@ end) it("diff mode doesn't restore invalid 'foldcolumn' value #21647", function() local screen = Screen.new(60, 6) - screen:set_default_attr_ids({ - [0] = { foreground = Screen.colors.Blue, bold = true }, - }) screen:attach() eq('0', api.nvim_get_option_value('foldcolumn', {})) command('diffsplit | bd') screen:expect([[ ^ | - {0:~ }|*4 + {1:~ }|*4 | ]]) eq('0', api.nvim_get_option_value('foldcolumn', {})) @@ -1385,16 +1348,9 @@ end) -- oldtest: Test_diff_binary() it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', function() local screen = Screen.new(40, 20) - screen:set_default_attr_ids({ - [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Gray }, - [2] = { reverse = true }, - [3] = { background = Screen.colors.LightBlue }, - [4] = { background = Screen.colors.LightMagenta }, - [5] = { background = Screen.colors.Red, bold = true }, - [6] = { foreground = Screen.colors.Blue, bold = true }, - [7] = { background = Screen.colors.Red, foreground = Screen.colors.Blue, bold = true }, - [8] = { reverse = true, bold = true }, - }) + screen:add_extra_attr_ids { + [100] = { foreground = Screen.colors.Blue, bold = true, background = Screen.colors.Red }, + } screen:attach() exec([[ call setline(1, ['a', 'b', "c\n", 'd', 'e', 'f', 'g']) @@ -1408,15 +1364,15 @@ it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', fun -- Test using internal diff screen:expect([[ - {1: }{5:^A}{4: }│{1: }{5:a}{4: }| - {1: }b │{1: }b | - {1: }{4:c }│{1: }{4:c}{7:^@}{4: }| - {1: }d │{1: }d | - {1: }{5:E}{4: }│{1: }{5:e}{4: }| - {1: }f │{1: }f | - {1: }g │{1: }g | - {6:~ }│{6:~ }|*11 - {8:[No Name] [+] }{2:[No Name] [+] }| + {7: }{27:^A}{4: }│{7: }{27:a}{4: }| + {7: }b │{7: }b | + {7: }{4:c }│{7: }{4:c}{100:^@}{4: }| + {7: }d │{7: }d | + {7: }{27:E}{4: }│{7: }{27:e}{4: }| + {7: }f │{7: }f | + {7: }g │{7: }g | + {1:~ }│{1:~ }|*11 + {3:[No Name] [+] }{2:[No Name] [+] }| | ]]) @@ -1424,15 +1380,15 @@ it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', fun command('set diffopt+=icase') feed('') screen:expect([[ - {1: }^A │{1: }a | - {1: }b │{1: }b | - {1: }{4:c }│{1: }{4:c}{7:^@}{4: }| - {1: }d │{1: }d | - {1: }E │{1: }e | - {1: }f │{1: }f | - {1: }g │{1: }g | - {6:~ }│{6:~ }|*11 - {8:[No Name] [+] }{2:[No Name] [+] }| + {7: }^A │{7: }a | + {7: }b │{7: }b | + {7: }{4:c }│{7: }{4:c}{100:^@}{4: }| + {7: }d │{7: }d | + {7: }E │{7: }e | + {7: }f │{7: }f | + {7: }g │{7: }g | + {1:~ }│{1:~ }|*11 + {3:[No Name] [+] }{2:[No Name] [+] }| | ]]) @@ -1440,15 +1396,15 @@ it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', fun command('set diffopt=filler') feed('') screen:expect([[ - {1: }{5:^A}{4: }│{1: }{5:a}{4: }| - {1: }b │{1: }b | - {1: }{4:c }│{1: }{4:c}{7:^@}{4: }| - {1: }d │{1: }d | - {1: }{5:E}{4: }│{1: }{5:e}{4: }| - {1: }f │{1: }f | - {1: }g │{1: }g | - {6:~ }│{6:~ }|*11 - {8:[No Name] [+] }{2:[No Name] [+] }| + {7: }{27:^A}{4: }│{7: }{27:a}{4: }| + {7: }b │{7: }b | + {7: }{4:c }│{7: }{4:c}{100:^@}{4: }| + {7: }d │{7: }d | + {7: }{27:E}{4: }│{7: }{27:e}{4: }| + {7: }f │{7: }f | + {7: }g │{7: }g | + {1:~ }│{1:~ }|*11 + {3:[No Name] [+] }{2:[No Name] [+] }| | ]]) @@ -1456,15 +1412,15 @@ it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', fun command('set diffopt+=filler,icase') feed('') screen:expect([[ - {1: }^A │{1: }a | - {1: }b │{1: }b | - {1: }{4:c }│{1: }{4:c}{7:^@}{4: }| - {1: }d │{1: }d | - {1: }E │{1: }e | - {1: }f │{1: }f | - {1: }g │{1: }g | - {6:~ }│{6:~ }|*11 - {8:[No Name] [+] }{2:[No Name] [+] }| + {7: }^A │{7: }a | + {7: }b │{7: }b | + {7: }{4:c }│{7: }{4:c}{100:^@}{4: }| + {7: }d │{7: }d | + {7: }E │{7: }e | + {7: }f │{7: }f | + {7: }g │{7: }g | + {1:~ }│{1:~ }|*11 + {3:[No Name] [+] }{2:[No Name] [+] }| | ]]) end) @@ -1473,12 +1429,6 @@ end) it("diff mode draws 'breakindent' correctly after filler lines", function() local screen = Screen.new(45, 8) screen:attach() - screen:set_default_attr_ids({ - [1] = { background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue }, - [2] = { background = Screen.colors.LightBlue }, - [3] = { background = Screen.colors.LightCyan, bold = true, foreground = Screen.colors.Blue }, - [4] = { foreground = Screen.colors.Blue, bold = true }, - }) exec([[ set laststatus=0 diffopt+=followwrap breakindent breakindentopt=min:0 call setline(1, ['a', ' ' .. repeat('c', 50)]) @@ -1488,11 +1438,11 @@ it("diff mode draws 'breakindent' correctly after filler lines", function() norm! G$ ]]) screen:expect([[ - {1: }a │{1: }a | - {1: }{2:b }│{1: }{3:--------------------}| - {1: } cccccccccccccccccc│{1: } cccccccccccccccccc|*2 - {1: } cccccccccccccc │{1: } ccccccccccccc^c | - {4:~ }│{4:~ }|*2 + {7: }a │{7: }a | + {7: }{22:b }│{7: }{23:--------------------}| + {7: } cccccccccccccccccc│{7: } cccccccccccccccccc|*2 + {7: } cccccccccccccc │{7: } ccccccccccccc^c | + {1:~ }│{1:~ }|*2 | ]]) end) diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index 8f9cc868fc..8e4e3cf597 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -65,26 +65,12 @@ local function common_setup(screen, inccommand, text) command('set nohlsearch') command('hi Substitute guifg=red guibg=yellow') screen:attach() - screen:set_default_attr_ids({ - [1] = { foreground = Screen.colors.Fuchsia }, - [2] = { foreground = Screen.colors.Brown, bold = true }, - [3] = { foreground = Screen.colors.SlateBlue }, - [4] = { bold = true, foreground = Screen.colors.SlateBlue }, - [5] = { foreground = Screen.colors.DarkCyan }, - [6] = { bold = true }, - [7] = { underline = true, bold = true, foreground = Screen.colors.SlateBlue }, - [8] = { foreground = Screen.colors.Slateblue, underline = true }, - [9] = { background = Screen.colors.Yellow }, - [10] = { reverse = true }, - [11] = { reverse = true, bold = true }, - [12] = { foreground = Screen.colors.Red, background = Screen.colors.Yellow }, - [13] = { bold = true, foreground = Screen.colors.SeaGreen }, - [14] = { foreground = Screen.colors.White, background = Screen.colors.Red }, - [15] = { bold = true, foreground = Screen.colors.Blue }, - [16] = { background = Screen.colors.Grey90 }, -- cursorline - [17] = { foreground = Screen.colors.Blue1 }, + + screen:add_extra_attr_ids { + [100] = { underline = true }, + [101] = { underline = true, foreground = Screen.colors.SlateBlue, bold = true }, vis = { background = Screen.colors.LightGrey }, - }) + } end command('set inccommand=' .. (inccommand or '')) @@ -142,13 +128,13 @@ describe(":substitute, 'inccommand' preserves", function() screen:expect([[ BAC | - {15:~ }|*3 - {11: }| + {1:~ }|*3 + {3: }| :ls | 1 %a + "[No Name]" | line 1 | - {13:Press ENTER or type command to}| - {13: continue}^ | + {6:Press ENTER or type command to}| + {6: continue}^ | ]]) end) @@ -577,7 +563,7 @@ describe(":substitute, 'inccommand' preserves undo", function() Inc substitution on | two lines | ^ | - {15:~ }|*6 + {1:~ }|*6 | ]]) command('set undolevels=1') @@ -613,7 +599,7 @@ describe(":substitute, 'inccommand' preserves undo", function() Inc substitution on | ^MOo lines | | - {15:~ }|*6 + {1:~ }|*6 Already ...t change | ]]) else @@ -621,7 +607,7 @@ describe(":substitute, 'inccommand' preserves undo", function() Inc substitution on | ^MOo lines | | - {15:~ }|*6 + {1:~ }|*6 Already ...t change | ]]) end @@ -655,7 +641,7 @@ describe(":substitute, 'inccommand' preserves undo", function() Inc substitution on | two line^s | | - {15:~ }|*6 + {1:~ }|*6 Already ...t change | ]]) else @@ -663,7 +649,7 @@ describe(":substitute, 'inccommand' preserves undo", function() Inc substitution on | two line^s | | - {15:~ }|*6 + {1:~ }|*6 Already ...t change | ]]) end @@ -693,7 +679,7 @@ describe(":substitute, 'inccommand' preserves undo", function() Inc substitution on | ^MOo lines | | - {15:~ }|*6 + {1:~ }|*6 Already ...t change | ]]) else @@ -701,7 +687,7 @@ describe(":substitute, 'inccommand' preserves undo", function() Inc substitution on | ^MOo lines | | - {15:~ }|*6 + {1:~ }|*6 Already ...t change | ]]) end @@ -725,7 +711,7 @@ describe(":substitute, 'inccommand' preserves undo", function() Inc substitution on | ^MOo lines | | - {15:~ }|*6 + {1:~ }|*6 Already ...t change | ]]) else @@ -733,7 +719,7 @@ describe(":substitute, 'inccommand' preserves undo", function() Inc substitution on | ^MOo lines | | - {15:~ }|*6 + {1:~ }|*6 Already ...t change | ]]) end @@ -754,7 +740,7 @@ describe(":substitute, 'inccommand' preserves undo", function() ^LInc substitution on| two lines | | - {15:~ }|*6 + {1:~ }|*6 Already ...t change | ]]) end @@ -775,15 +761,15 @@ describe(':substitute, inccommand=split', function() feed(':%s/tw') screen:expect([[ Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | | - {11:[No Name] }| - |2| {12:tw}o lines | - |4| {12:tw}o lines | - {15:~ }|*5 - {10:[Preview] }| + {3:[No Name] }| + |2| {20:tw}o lines | + |4| {20:tw}o lines | + {1:~ }|*5 + {2:[Preview] }| :%s/tw^ | ]]) feed([[]]) -- Cancel the :substitute command. @@ -793,13 +779,13 @@ describe(':substitute, inccommand=split', function() it('shows preview when cmd modifiers are present', function() -- one modifier feed(':keeppatterns %s/tw/to') - screen:expect { any = [[{12:to}o lines]] } + screen:expect { any = [[{20:to}o lines]] } feed('') screen:expect { any = [[two lines]] } -- multiple modifiers feed(':keeppatterns silent %s/tw/to') - screen:expect { any = [[{12:to}o lines]] } + screen:expect { any = [[{20:to}o lines]] } feed('') screen:expect { any = [[two lines]] } @@ -811,14 +797,14 @@ describe(':substitute, inccommand=split', function() Inc substitution on | two lines | | - {15:~ }|*9 + {1:~ }|*9 :silent tabedit %s/tw/to^ | ]]) feed('') -- leading colons feed(':::%s/tw/to') - screen:expect { any = [[{12:to}o lines]] } + screen:expect { any = [[{20:to}o lines]] } feed('') screen:expect { any = [[two lines]] } end) @@ -828,15 +814,15 @@ describe(':substitute, inccommand=split', function() feed(':topleft %s/tw/to') screen:expect([[ Inc substitution on | - {12:to}o lines | + {20:to}o lines | Inc substitution on | - {12:to}o lines | + {20:to}o lines | | - {11:[No Name] [+] }| - |2| {12:to}o lines | - |4| {12:to}o lines | - {15:~ }|*5 - {10:[Preview] }| + {3:[No Name] [+] }| + |2| {20:to}o lines | + |4| {20:to}o lines | + {1:~ }|*5 + {2:[Preview] }| :topleft %s/tw/to^ | ]]) feed('') @@ -846,15 +832,15 @@ describe(':substitute, inccommand=split', function() feed(':topleft vert %s/tw/to') screen:expect([[ Inc substitution on | - {12:to}o lines | + {20:to}o lines | Inc substitution on | - {12:to}o lines | + {20:to}o lines | | - {11:[No Name] [+] }| - |2| {12:to}o lines | - |4| {12:to}o lines | - {15:~ }|*5 - {10:[Preview] }| + {3:[No Name] [+] }| + |2| {20:to}o lines | + |4| {20:to}o lines | + {1:~ }|*5 + {2:[Preview] }| :topleft vert %s/tw/to^ | ]]) feed('') @@ -865,15 +851,15 @@ describe(':substitute, inccommand=split', function() feed(':%s/tw') screen:expect([[ Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | | - {11:[No Name] [+] }| - |2| {12:tw}o lines | - |4| {12:tw}o lines | - {15:~ }|*5 - {10:[Preview] }| + {3:[No Name] [+] }| + |2| {20:tw}o lines | + |4| {20:tw}o lines | + {1:~ }|*5 + {2:[Preview] }| :%s/tw^ | ]]) end) @@ -886,26 +872,26 @@ describe(':substitute, inccommand=split', function() Inc substitution on | o lines | | - {11:[No Name] [+] }| + {3:[No Name] [+] }| |2| o lines | |4| o lines | - {15:~ }|*5 - {10:[Preview] }| + {1:~ }|*5 + {2:[Preview] }| :%s/tw/^ | ]]) feed('x') screen:expect([[ Inc substitution on | - {12:x}o lines | + {20:x}o lines | Inc substitution on | - {12:x}o lines | + {20:x}o lines | | - {11:[No Name] [+] }| - |2| {12:x}o lines | - |4| {12:x}o lines | - {15:~ }|*5 - {10:[Preview] }| + {3:[No Name] [+] }| + |2| {20:x}o lines | + |4| {20:x}o lines | + {1:~ }|*5 + {2:[Preview] }| :%s/tw/x^ | ]]) @@ -916,11 +902,11 @@ describe(':substitute, inccommand=split', function() Inc substitution on | o lines | | - {11:[No Name] [+] }| + {3:[No Name] [+] }| |2| o lines | |4| o lines | - {15:~ }|*5 - {10:[Preview] }| + {1:~ }|*5 + {2:[Preview] }| :%s/tw/^ | ]]) end) @@ -929,15 +915,15 @@ describe(':substitute, inccommand=split', function() feed(':%s/tw/XX') screen:expect([[ Inc substitution on | - {12:XX}o lines | + {20:XX}o lines | Inc substitution on | - {12:XX}o lines | + {20:XX}o lines | | - {11:[No Name] [+] }| - |2| {12:XX}o lines | - |4| {12:XX}o lines | - {15:~ }|*5 - {10:[Preview] }| + {3:[No Name] [+] }| + |2| {20:XX}o lines | + |4| {20:XX}o lines | + {1:~ }|*5 + {2:[Preview] }| :%s/tw/XX^ | ]]) end) @@ -947,11 +933,11 @@ describe(':substitute, inccommand=split', function() feed(':s/tw') screen:expect([[ Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | Inc substitution on | two lines | | - {15:~ }|*9 + {1:~ }|*9 :s/tw^ | ]]) end) @@ -962,12 +948,12 @@ describe(':substitute, inccommand=split', function() -- Assert that 'cursorline' is active. screen:expect([[ - {16:^Inc substitution on }| + {21:^Inc substitution on }| two lines | Inc substitution on | two lines | | - {15:~ }|*9 + {1:~ }|*9 | ]]) @@ -975,15 +961,15 @@ describe(':substitute, inccommand=split', function() -- 'cursorline' is NOT active during preview. screen:expect([[ Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | | - {11:[No Name] [+] }| - |2| {12:tw}o lines | - |4| {12:tw}o lines | - {15:~ }|*5 - {10:[Preview] }| + {3:[No Name] [+] }| + |2| {20:tw}o lines | + |4| {20:tw}o lines | + {1:~ }|*5 + {2:[Preview] }| :%s/tw^ | ]]) end) @@ -993,15 +979,15 @@ describe(':substitute, inccommand=split', function() feed('M M M') feed(':%s/M/123/g') screen:expect([[ - {12:123} {12:123} {12:123} | + {20:123} {20:123} {20:123} | Inc substitution on | two lines | Inc substitution on | two lines | - {11:[No Name] [+] }| - |1| {12:123} {12:123} {12:123} | - {15:~ }|*6 - {10:[Preview] }| + {3:[No Name] [+] }| + |1| {20:123} {20:123} {20:123} | + {1:~ }|*6 + {2:[Preview] }| :%s/M/123/g^ | ]]) end) @@ -1015,10 +1001,10 @@ describe(':substitute, inccommand=split', function() Inc substitution on | two lines | | - {11:[No Name] [+] }| + {3:[No Name] [+] }| | - {15:~ }|*6 - {10:[Preview] }| + {1:~ }|*6 + {2:[Preview] }| :%s/Inx^ | ]]) end) @@ -1030,12 +1016,12 @@ describe(':substitute, inccommand=split', function() insert(string.rep('abc abc abc\n', 20)) feed(':%s/abc/MMM/g') screen:expect([[ - {12:MMM} {12:MMM} {12:MMM} |*9 - {11:[No Name] [+] }| - | 1| {12:MMM} {12:MMM} {12:MMM} | - | 2| {12:MMM} {12:MMM} {12:MMM} | - | 3| {12:MMM} {12:MMM} {12:MMM} | - {10:[Preview] }| + {20:MMM} {20:MMM} {20:MMM} |*9 + {3:[No Name] [+] }| + | 1| {20:MMM} {20:MMM} {20:MMM} | + | 2| {20:MMM} {20:MMM} {20:MMM} | + | 3| {20:MMM} {20:MMM} {20:MMM} | + {2:[Preview] }| :%s/abc/MMM/g^ | ]]) end) @@ -1051,7 +1037,7 @@ describe(':substitute, inccommand=split', function() Inc substitution on | ^XXo lines | | - {15:~ }|*9 + {1:~ }|*9 :%s/tw/XX/g | ]]) end) @@ -1067,17 +1053,17 @@ describe(':substitute, inccommand=split', function() Inc substitution on | BBo lines | Inc substitution on | - {12:X}o lines | + {20:X}o lines | Inc substitution on | - {11:[No Name] [+] }| - |1001| {12:X}o lines | - |1003| {12:X}o lines | - |1005| {12:X}o lines | - |1007| {12:X}o lines | - |1009| {12:X}o lines | - |1011| {12:X}o lines | - |1013| {12:X}o lines | - {10:[Preview] }| + {3:[No Name] [+] }| + |1001| {20:X}o lines | + |1003| {20:X}o lines | + |1005| {20:X}o lines | + |1007| {20:X}o lines | + |1009| {20:X}o lines | + |1011| {20:X}o lines | + |1013| {20:X}o lines | + {2:[Preview] }| :%s/tw/X^ | ]]) end) @@ -1111,7 +1097,7 @@ describe(':substitute, inccommand=split', function() Inc substitution on | two lines | ^ | - {15:~ }|*9 + {1:~ }|*9 2 matches on 2 lines | ]]) end) @@ -1196,16 +1182,16 @@ describe(':substitute, inccommand=split', function() feed(':1,2s/t/X') screen:expect([[ - Inc subs{12:X}itution on | - {12:X}wo lines | + Inc subs{20:X}itution on | + {20:X}wo lines | Inc substitution on | two lines | | - {11:[No Name] [+] }| - |1| Inc subs{12:X}itution on | - |2| {12:X}wo lines | - {15:~ }|*5 - {10:[Preview] }| + {3:[No Name] [+] }| + |1| Inc subs{20:X}itution on | + |2| {20:X}wo lines | + {1:~ }|*5 + {2:[Preview] }| :1,2s/t/X^ | ]]) @@ -1218,7 +1204,7 @@ describe(':substitute, inccommand=split', function() Inc substitution on | two lines | | - {15:~ }|*9 + {1:~ }|*9 :echo 'foo'^ | ]]) end) @@ -1227,65 +1213,65 @@ describe(':substitute, inccommand=split', function() feed('gg') feed(':1,2s/t/X') screen:expect([[ - Inc subs{12:X}itution on | - {12:X}wo lines | + Inc subs{20:X}itution on | + {20:X}wo lines | Inc substitution on | two lines | | - {11:[No Name] [+] }| - |1| Inc subs{12:X}itution on | - |2| {12:X}wo lines | - {15:~ }|*5 - {10:[Preview] }| + {3:[No Name] [+] }| + |1| Inc subs{20:X}itution on | + |2| {20:X}wo lines | + {1:~ }|*5 + {2:[Preview] }| :1,2s/t/X^ | ]]) feed([[='Y']]) -- preview should be unchanged during c_CTRL-R_= editing screen:expect([[ - Inc subs{12:X}itution on | - {12:X}wo lines | + Inc subs{20:X}itution on | + {20:X}wo lines | Inc substitution on | two lines | | - {11:[No Name] [+] }| - |1| Inc subs{12:X}itution on | - |2| {12:X}wo lines | - {15:~ }|*5 - {10:[Preview] }| - ={1:'Y'}^ | + {3:[No Name] [+] }| + |1| Inc subs{20:X}itution on | + |2| {20:X}wo lines | + {1:~ }|*5 + {2:[Preview] }| + ={26:'Y'}^ | ]]) feed('') -- preview should be changed by the result of the expression screen:expect([[ - Inc subs{12:XY}itution on | - {12:XY}wo lines | + Inc subs{20:XY}itution on | + {20:XY}wo lines | Inc substitution on | two lines | | - {11:[No Name] [+] }| - |1| Inc subs{12:XY}itution on | - |2| {12:XY}wo lines | - {15:~ }|*5 - {10:[Preview] }| + {3:[No Name] [+] }| + |1| Inc subs{20:XY}itution on | + |2| {20:XY}wo lines | + {1:~ }|*5 + {2:[Preview] }| :1,2s/t/XY^ | ]]) feed([[e'echo']]) -- preview should be unchanged during c_CTRL-\_e editing screen:expect([[ - Inc subs{12:XY}itution on | - {12:XY}wo lines | + Inc subs{20:XY}itution on | + {20:XY}wo lines | Inc substitution on | two lines | | - {11:[No Name] [+] }| - |1| Inc subs{12:XY}itution on | - |2| {12:XY}wo lines | - {15:~ }|*5 - {10:[Preview] }| - ={1:'echo'}^ | + {3:[No Name] [+] }| + |1| Inc subs{20:XY}itution on | + |2| {20:XY}wo lines | + {1:~ }|*5 + {2:[Preview] }| + ={26:'echo'}^ | ]]) feed('') @@ -1296,7 +1282,7 @@ describe(':substitute, inccommand=split', function() Inc substitution on | two lines | | - {15:~ }|*9 + {1:~ }|*9 :echo^ | ]]) end) @@ -1321,8 +1307,8 @@ describe('inccommand=nosplit', function() two lines | Inc substitution on | two lines | - Line *.{12:X} | - {15:~ }|*4 + Line *.{20:X} | + {1:~ }|*4 :%smagic/3.*/X^ | ]]) @@ -1333,8 +1319,8 @@ describe('inccommand=nosplit', function() two lines | Inc substitution on | two lines | - Line *.{12:X} here | - {15:~ }|*4 + Line *.{20:X} here | + {1:~ }|*4 :%snomagic/3.*/X^ | ]]) end) @@ -1342,13 +1328,13 @@ describe('inccommand=nosplit', function() it('shows preview when cmd modifiers are present', function() -- one modifier feed(':keeppatterns %s/tw/to') - screen:expect { any = [[{12:to}o lines]] } + screen:expect { any = [[{20:to}o lines]] } feed('') screen:expect { any = [[two lines]] } -- multiple modifiers feed(':keeppatterns silent %s/tw/to') - screen:expect { any = [[{12:to}o lines]] } + screen:expect { any = [[{20:to}o lines]] } feed('') screen:expect { any = [[two lines]] } @@ -1360,8 +1346,8 @@ describe('inccommand=nosplit', function() Inc substitution on | two lines | | - {15:~ }|*2 - {11: }| + {1:~ }|*2 + {3: }| :silent tabedit %s/t| w/to^ | ]]) @@ -1378,11 +1364,11 @@ describe('inccommand=nosplit', function() poke_eventloop() screen:expect([[ Inc substitution on | - {12:OKOK}o lines | + {20:OKOK}o lines | Inc substitution on | - {12:OKOK}o lines | + {20:OKOK}o lines | | - {15:~ }|*4 + {1:~ }|*4 :%s/tw/OKOK^ | ]]) end) @@ -1393,33 +1379,33 @@ describe('inccommand=nosplit', function() feed(':%s/tw') screen:expect([[ Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | | - {15:~ }|*4 + {1:~ }|*4 :%s/tw^ | ]]) feed('/BM') screen:expect([[ Inc substitution on | - {12:BM}o lines | + {20:BM}o lines | Inc substitution on | - {12:BM}o lines | + {20:BM}o lines | | - {15:~ }|*4 + {1:~ }|*4 :%s/tw/BM^ | ]]) feed('/') screen:expect([[ Inc substitution on | - {12:BM}o lines | + {20:BM}o lines | Inc substitution on | - {12:BM}o lines | + {20:BM}o lines | | - {15:~ }|*4 + {1:~ }|*4 :%s/tw/BM/^ | ]]) @@ -1430,7 +1416,7 @@ describe('inccommand=nosplit', function() Inc substitution on | ^BMo lines | | - {15:~ }|*4 + {1:~ }|*4 :%s/tw/BM/ | ]]) end) @@ -1442,12 +1428,12 @@ describe('inccommand=nosplit', function() feed(':1,2s/t/X') screen:expect([[ - Inc subs{12:X}itution on | - {12:X}wo lines | + Inc subs{20:X}itution on | + {20:X}wo lines | Inc substitution on | two lines | | - {15:~ }|*4 + {1:~ }|*4 :1,2s/t/X^ | ]]) @@ -1460,7 +1446,7 @@ describe('inccommand=nosplit', function() Inc substitution on | two lines | | - {15:~ }|*4 + {1:~ }|*4 :echo 'foo'^ | ]]) end) @@ -1469,11 +1455,11 @@ describe('inccommand=nosplit', function() feed(':%s/two/three/g|q!') screen:expect([[ Inc substitution on | - {12:three} lines | + {20:three} lines | Inc substitution on | - {12:three} lines | + {20:three} lines | | - {15:~ }|*4 + {1:~ }|*4 :%s/two/three/g|q!^ | ]]) eq(eval('v:null'), eval('v:exiting')) @@ -1494,7 +1480,7 @@ describe('inccommand=nosplit', function() Inc substitution on | two lines | | - {15:~ }|*4 + {1:~ }|*4 :%s/^ | ]]) end) @@ -1546,7 +1532,7 @@ describe(":substitute, 'inccommand' with a failing expression", function() Inc substitution on | two lines | | - {15:~ }|*6 + {1:~ }|*6 :100s/^ | ]]) @@ -1555,8 +1541,8 @@ describe(":substitute, 'inccommand' with a failing expression", function() Inc substitution on | two lines | ^ | - {15:~ }|*6 - {14:E16: Invalid range} | + {1:~ }|*6 + {9:E16: Invalid range} | ]]) end end) @@ -1649,7 +1635,7 @@ describe("'inccommand' and :cnoremap", function() command("cnoremap x execute('bwipeout!')[-1].'x'") feed(':%s/tw/tox') - screen:expect { any = [[{14:^E565:]] } + screen:expect { any = [[{9:^E565:]] } feed('') -- error thrown b/c of the mapping @@ -1807,18 +1793,18 @@ describe("'inccommand' split windows", function() feed(':%s/tw') screen:expect([[ Inc substitution on │Inc substitution on| - {12:tw}o lines │{12:tw}o lines | + {20:tw}o lines │{20:tw}o lines | │ | - {15:~ }│{15:~ }|*11 - {11:[No Name] [+] }│{15:~ }| - Inc substitution on │{15:~ }| - {12:tw}o lines │{15:~ }| - │{15:~ }| - {15:~ }│{15:~ }|*2 - {10:[No Name] [+] [No Name] [+] }| - |2| {12:tw}o lines | - {15:~ }|*6 - {10:[Preview] }| + {1:~ }│{1:~ }|*11 + {3:[No Name] [+] }│{1:~ }| + Inc substitution on │{1:~ }| + {20:tw}o lines │{1:~ }| + │{1:~ }| + {1:~ }│{1:~ }|*2 + {2:[No Name] [+] [No Name] [+] }| + |2| {20:tw}o lines | + {1:~ }|*6 + {2:[Preview] }| :%s/tw^ | ]]) @@ -1830,18 +1816,18 @@ describe("'inccommand' split windows", function() feed(':%s/tw') screen:expect([[ Inc substitution on │Inc substitution on| - {12:tw}o lines │{12:tw}o lines | + {20:tw}o lines │{20:tw}o lines | │ | - {15:~ }│{15:~ }|*11 - {11:[No Name] [+] }{10:[No Name] [+] }| + {1:~ }│{1:~ }|*11 + {3:[No Name] [+] }{2:[No Name] [+] }| Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | | - {15:~ }|*2 - {10:[No Name] [+] }| - |2| {12:tw}o lines | - {15:~ }|*6 - {10:[Preview] }| + {1:~ }|*2 + {2:[No Name] [+] }| + |2| {20:tw}o lines | + {1:~ }|*6 + {2:[Preview] }| :%s/tw^ | ]]) end) @@ -1864,13 +1850,13 @@ describe("'inccommand' split windows", function() screen:expect([[ Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | | - {15:~ }|*17 - {11:[No Name] [+] }| - |2| {12:tw}o lines | - {15:~ }|*6 - {10:[Preview] }| + {1:~ }|*17 + {3:[No Name] [+] }| + |2| {20:tw}o lines | + {1:~ }|*6 + {2:[Preview] }| :%s/tw^ | ]]) end @@ -1882,7 +1868,7 @@ describe("'inccommand' split windows", function() feed('gg:%s/tw') screen:expect([[ Inc substitution on | - {12:tw}o lines | + {20:tw}o lines | :%s/tw^ | ]]) end) @@ -1931,10 +1917,10 @@ describe("'inccommand' with 'gdefault'", function() feed(':%s/\\%1c/a/') screen:expect([[ - {12:a}Inc substitution on | - {12:a}two lines | - {12:a} | - {15:~ }| + {20:a}Inc substitution on | + {20:a}two lines | + {20:a} | + {1:~ }| :%s/\%1c/a/^ | ]]) @@ -1943,7 +1929,7 @@ describe("'inccommand' with 'gdefault'", function() Inc substitution on | two lines | ^ | - {15:~ }| + {1:~ }| | ]]) end) @@ -1962,47 +1948,47 @@ describe(':substitute', function() feed(':%s/2\\_.*X') screen:expect([[ - 1 {12:2 3} | - {12:A B C} | - {12:4 5 6} | - {12:X} Y Z | + 1 {20:2 3} | + {20:A B C} | + {20:4 5 6} | + {20:X} Y Z | 7 8 9 | - {11:[No Name] [+] }| - |1| 1 {12:2 3} | - |2|{12: A B C} | - |3|{12: 4 5 6} | - |4|{12: X} Y Z | - {15:~ }|*3 - {10:[Preview] }| + {3:[No Name] [+] }| + |1| 1 {20:2 3} | + |2|{20: A B C} | + |3|{20: 4 5 6} | + |4|{20: X} Y Z | + {1:~ }|*3 + {2:[Preview] }| :%s/2\_.*X^ | ]]) feed('/MMM') screen:expect([[ - 1 {12:MMM} Y Z | + 1 {20:MMM} Y Z | 7 8 9 | | - {15:~ }|*2 - {11:[No Name] [+] }| - |1| 1 {12:MMM} Y Z | - {15:~ }|*6 - {10:[Preview] }| + {1:~ }|*2 + {3:[No Name] [+] }| + |1| 1 {20:MMM} Y Z | + {1:~ }|*6 + {2:[Preview] }| :%s/2\_.*X/MMM^ | ]]) feed('\\rK\\rLLL') screen:expect([[ - 1 {12:MMM} | - {12:K} | - {12:LLL} Y Z | + 1 {20:MMM} | + {20:K} | + {20:LLL} Y Z | 7 8 9 | | - {11:[No Name] [+] }| - |1| 1 {12:MMM} | - |2|{12: K} | - |3|{12: LLL} Y Z | - {15:~ }|*4 - {10:[Preview] }| + {3:[No Name] [+] }| + |1| 1 {20:MMM} | + |2|{20: K} | + |3|{20: LLL} Y Z | + {1:~ }|*4 + {2:[Preview] }| :%s/2\_.*X/MMM\rK\rLLL^ | ]]) end) @@ -2013,21 +1999,21 @@ describe(':substitute', function() feed(':%s/2\\_.*X/MMM') screen:expect([[ - 1 {12:MMM} Y Z | + 1 {20:MMM} Y Z | 7 8 9 | | - {15:~ }|*11 + {1:~ }|*11 :%s/2\_.*X/MMM^ | ]]) feed('\\rK\\rLLL') screen:expect([[ - 1 {12:MMM} | - {12:K} | - {12:LLL} Y Z | + 1 {20:MMM} | + {20:K} | + {20:LLL} Y Z | 7 8 9 | | - {15:~ }|*9 + {1:~ }|*9 :%s/2\_.*X/MMM\rK\rLLL^ | ]]) end) @@ -2039,15 +2025,15 @@ describe(':substitute', function() feed(':%s/a/XLK') screen:expect([[ - {12:XLK} bdc e{12:XLK}e {12:XLK} fgl lzi{12:XLK} r| + {20:XLK} bdc e{20:XLK}e {20:XLK} fgl lzi{20:XLK} r| x | | - {15:~ }|*2 - {11:[No Name] [+] }| - |1| {12:XLK} bdc e{12:XLK}e {12:XLK} fgl lzi{12:X}| - {12:LK} r | - {15:~ }|*5 - {10:[Preview] }| + {1:~ }|*2 + {3:[No Name] [+] }| + |1| {20:XLK} bdc e{20:XLK}e {20:XLK} fgl lzi{20:X}| + {20:LK} r | + {1:~ }|*5 + {2:[Preview] }| :%s/a/XLK^ | ]]) end) @@ -2059,10 +2045,10 @@ describe(':substitute', function() feed(':%s/a/XLK') screen:expect([[ - {12:XLK} bdc e{12:XLK}e {12:XLK} fgl lzi{12:XLK} r| + {20:XLK} bdc e{20:XLK}e {20:XLK} fgl lzi{20:XLK} r| x | | - {15:~ }|*11 + {1:~ }|*11 :%s/a/XLK^ | ]]) end) @@ -2073,18 +2059,18 @@ describe(':substitute', function() feed(':%s/[0-9]\\n\\zs[A-Z]/OKO') screen:expect([[ - {12:OKO} B C | + {20:OKO} B C | 4 5 6 | - {12:OKO} Y Z | + {20:OKO} Y Z | 7 8 9 | | - {11:[No Name] [+] }| + {3:[No Name] [+] }| |1| 1 2 3 | - |2| {12:OKO} B C | + |2| {20:OKO} B C | |3| 4 5 6 | - |4| {12:OKO} Y Z | - {15:~ }|*3 - {10:[Preview] }| + |4| {20:OKO} Y Z | + {1:~ }|*3 + {2:[Preview] }| :%s/[0-9]\n\zs[A-Z]/OKO^ | ]]) end) @@ -2096,12 +2082,12 @@ describe(':substitute', function() feed(':%s/[0-9]\\n\\zs[A-Z]/OKO') screen:expect([[ 1 2 3 | - {12:OKO} B C | + {20:OKO} B C | 4 5 6 | - {12:OKO} Y Z | + {20:OKO} Y Z | 7 8 9 | | - {15:~ }|*8 + {1:~ }|*8 :%s/[0-9]\n\zs[A-Z]/OKO^ | ]]) end) @@ -2111,14 +2097,14 @@ describe(':substitute', function() feed(':%s/T\\([0-9]\\+\\)/\\1\\1/g') screen:expect([[ - T {12:123123} {12:22}T TTT {12:090804090804} | + T {20:123123} {20:22}T TTT {20:090804090804} | x | - {15:~ }|*3 - {11:[No Name] [+] }| - |1| T {12:123123} {12:22}T TTT {12:090804090}| - {12:804} | - {15:~ }|*5 - {10:[Preview] }| + {1:~ }|*3 + {3:[No Name] [+] }| + |1| T {20:123123} {20:22}T TTT {20:090804090}| + {20:804} | + {1:~ }|*5 + {2:[Preview] }| :%s/T\([0-9]\+\)/\1\1/g^ | ]]) end) @@ -2128,9 +2114,9 @@ describe(':substitute', function() feed(':%s/T\\([0-9]\\+\\)/\\1\\1/g') screen:expect([[ - T {12:123123} {12:22}T TTT {12:090804090804} | + T {20:123123} {20:22}T TTT {20:090804090804} | x | - {15:~ }|*12 + {1:~ }|*12 :%s/T\([0-9]\+\)/\1\1/g^ | ]]) end) @@ -2147,17 +2133,17 @@ describe(':substitute', function() common_setup(screen, 'split', text) feed(':%s/[QR]\\n') screen:expect([[ - afa {12:Q} | - adf la;lkd {12:R} | + afa {20:Q} | + adf la;lkd {20:R} | alx | | - {15:~ }| - {11:[No Name] [+] }| - |3| afa {12:Q} | - |4|{12: }adf la;lkd {12:R} | - |5|{12: }alx | - {15:~ }|*4 - {10:[Preview] }| + {1:~ }| + {3:[No Name] [+] }| + |3| afa {20:Q} | + |4|{20: }adf la;lkd {20:R} | + |5|{20: }alx | + {1:~ }|*4 + {2:[Preview] }| :%s/[QR]\n^ | ]]) @@ -2165,13 +2151,13 @@ describe(':substitute', function() screen:expect([[ T T123 T T123 T2T TT T23423424| x | - afa {12:KKK}adf la;lkd {12:KKK}alx | + afa {20:KKK}adf la;lkd {20:KKK}alx | | - {15:~ }| - {11:[No Name] [+] }| - |3| afa {12:KKK}adf la;lkd {12:KKK}alx | - {15:~ }|*6 - {10:[Preview] }| + {1:~ }| + {3:[No Name] [+] }| + |3| afa {20:KKK}adf la;lkd {20:KKK}alx | + {1:~ }|*6 + {2:[Preview] }| :%s/[QR]\n/KKK^ | ]]) end) @@ -2190,9 +2176,9 @@ describe(':substitute', function() screen:expect([[ T T123 T T123 T2T TT T23423424| x | - afa {12:KKK}adf la;lkd {12:KKK}alx | + afa {20:KKK}adf la;lkd {20:KKK}alx | | - {15:~ }|*10 + {1:~ }|*10 :%s/[QR]\n/KKK^ | ]]) end) @@ -2218,16 +2204,16 @@ describe(':substitute', function() BBB BB | CCC CC | | - {11:[No Name] [+] }| + {3:[No Name] [+] }| | 1| AAA AA | - | 2|{12: }BBB BB | - | 3|{12: }CCC CC | - | 4|{12: }AAA AA | - | 5|{12: }BBB BB | - | 6|{12: }CCC CC | - | 7|{12: }AAA AA | - {10:[Preview] }| - :%s/\n\n/{17:^M}/g^ | + | 2|{20: }BBB BB | + | 3|{20: }CCC CC | + | 4|{20: }AAA AA | + | 5|{20: }BBB BB | + | 6|{20: }CCC CC | + | 7|{20: }AAA AA | + {2:[Preview] }| + :%s/\n\n/{18:^M}/g^ | ]], } assert_alive() @@ -2261,7 +2247,7 @@ describe(':substitute', function() BBB BB | CCC CC | | - :%s/\n\n/{17:^M}/g^ | + :%s/\n\n/{18:^M}/g^ | ]], } assert_alive() @@ -2271,36 +2257,36 @@ describe(':substitute', function() common_setup(screen, 'split', multibyte_text) feed(':%s/£.*ѫ/X¥¥') screen:expect([[ - a{12:X¥¥}¥KOL | + a{20:X¥¥}¥KOL | £ ¥ libm | £ ¥ | | - {15:~ }| - {11:[No Name] [+] }| - |1| {12:X¥¥} PEPPERS | - |2| {12:X¥¥} | - |3| a{12:X¥¥}¥KOL | - {15:~ }|*4 - {10:[Preview] }| + {1:~ }| + {3:[No Name] [+] }| + |1| {20:X¥¥} PEPPERS | + |2| {20:X¥¥} | + |3| a{20:X¥¥}¥KOL | + {1:~ }|*4 + {2:[Preview] }| :%s/£.*ѫ/X¥¥^ | ]]) feed('\\ra££ ¥') screen:expect([[ - a{12:X¥¥} | - {12:a££ ¥}¥KOL | + a{20:X¥¥} | + {20:a££ ¥}¥KOL | £ ¥ libm | £ ¥ | | - {11:[No Name] [+] }| - |1| {12:X¥¥} | - |2|{12: a££ ¥} PEPPERS | - |3| {12:X¥¥} | - |4|{12: a££ ¥} | - |5| a{12:X¥¥} | - |6|{12: a££ ¥}¥KOL | - {15:~ }| - {10:[Preview] }| + {3:[No Name] [+] }| + |1| {20:X¥¥} | + |2|{20: a££ ¥} PEPPERS | + |3| {20:X¥¥} | + |4|{20: a££ ¥} | + |5| a{20:X¥¥} | + |6|{20: a££ ¥}¥KOL | + {1:~ }| + {2:[Preview] }| :%s/£.*ѫ/X¥¥\ra££ ¥^ | ]]) end) @@ -2309,28 +2295,28 @@ describe(':substitute', function() common_setup(screen, 'nosplit', multibyte_text) feed(':%s/£.*ѫ/X¥¥') screen:expect([[ - {12:X¥¥} PEPPERS | - {12:X¥¥} | - a{12:X¥¥}¥KOL | + {20:X¥¥} PEPPERS | + {20:X¥¥} | + a{20:X¥¥}¥KOL | £ ¥ libm | £ ¥ | | - {15:~ }|*8 + {1:~ }|*8 :%s/£.*ѫ/X¥¥^ | ]]) feed('\\ra££ ¥') screen:expect([[ - {12:X¥¥} | - {12:a££ ¥} PEPPERS | - {12:X¥¥} | - {12:a££ ¥} | - a{12:X¥¥} | - {12:a££ ¥}¥KOL | + {20:X¥¥} | + {20:a££ ¥} PEPPERS | + {20:X¥¥} | + {20:a££ ¥} | + a{20:X¥¥} | + {20:a££ ¥}¥KOL | £ ¥ libm | £ ¥ | | - {15:~ }|*5 + {1:~ }|*5 :%s/£.*ѫ/X¥¥\ra££ ¥^ | ]]) end) @@ -2344,17 +2330,17 @@ describe(':substitute', function() X Y Z | 7 8 9 | K L M | - {12:a} b c | - {12:d} e f | - {12:q} r s | - {12:x} y z | - £ {12:m} n | - {12:t} œ ¥ | + {20:a} b c | + {20:d} e f | + {20:q} r s | + {20:x} y z | + £ {20:m} n | + {20:t} œ ¥ | | - {11:[No Name] [+] }| - | 7| {12:a} b c | - | 8| {12:d} e f | - {10:[Preview] }| + {3:[No Name] [+] }| + | 7| {20:a} b c | + | 8| {20:d} e f | + {2:[Preview] }| :%s/[a-z]^ | ]]) @@ -2363,17 +2349,17 @@ describe(':substitute', function() X Y Z | 7 8 9 | K L M | - {12:JLKR £} b c | - {12:JLKR £} e f | - {12:JLKR £} r s | - {12:JLKR £} y z | - £ {12:JLKR £} n | - {12:JLKR £} œ ¥ | + {20:JLKR £} b c | + {20:JLKR £} e f | + {20:JLKR £} r s | + {20:JLKR £} y z | + £ {20:JLKR £} n | + {20:JLKR £} œ ¥ | | - {11:[No Name] [+] }| - | 7| {12:JLKR £} b c | - | 8| {12:JLKR £} e f | - {10:[Preview] }| + {3:[No Name] [+] }| + | 7| {20:JLKR £} b c | + | 8| {20:JLKR £} e f | + {2:[Preview] }| :%s/[a-z]/JLKR £^ | ]]) @@ -2381,17 +2367,17 @@ describe(':substitute', function() screen:expect([[ 7 8 9 | K L M | - {12:JLKR £} | - {12:ѫ ab } | - {12:XXXX} b c | - {12:JLKR £} | - {12:ѫ ab } | - {12:XXXX} e f | - {12:JLKR £} | - {12:ѫ ab } | - {11:[No Name] [+] }| - | 7| {12:JLKR £} | - {11: }| + {20:JLKR £} | + {20:ѫ ab } | + {20:XXXX} b c | + {20:JLKR £} | + {20:ѫ ab } | + {20:XXXX} e f | + {20:JLKR £} | + {20:ѫ ab } | + {3:[No Name] [+] }| + | 7| {20:JLKR £} | + {3: }| :%s/[a-z]/JLKR £\rѫ ab \rXXX| X^ | ]]) @@ -2403,58 +2389,58 @@ describe(':substitute', function() feed(':%s/. .$') screen:expect([[ - t {12:œ ¥} | - {11:[No Name] [+] }| - | 1| 1 {12:2 3} | - | 2| A {12:B C} | - | 3| 4 {12:5 6} | - | 4| X {12:Y Z} | - | 5| 7 {12:8 9} | - | 6| K {12:L M} | - | 7| a {12:b c} | - | 8| d {12:e f} | - | 9| q {12:r s} | - |10| x {12:y z} | - |11| £ {12:m n} | - {10:[Preview] }| + t {20:œ ¥} | + {3:[No Name] [+] }| + | 1| 1 {20:2 3} | + | 2| A {20:B C} | + | 3| 4 {20:5 6} | + | 4| X {20:Y Z} | + | 5| 7 {20:8 9} | + | 6| K {20:L M} | + | 7| a {20:b c} | + | 8| d {20:e f} | + | 9| q {20:r s} | + |10| x {20:y z} | + |11| £ {20:m n} | + {2:[Preview] }| :%s/. .$^ | ]]) feed('/ YYY') screen:expect([[ - t {12: YYY} | - {11:[No Name] [+] }| - | 1| 1 {12: YYY} | - | 2| A {12: YYY} | - | 3| 4 {12: YYY} | - | 4| X {12: YYY} | - | 5| 7 {12: YYY} | - | 6| K {12: YYY} | - | 7| a {12: YYY} | - | 8| d {12: YYY} | - | 9| q {12: YYY} | - |10| x {12: YYY} | - |11| £ {12: YYY} | - {10:[Preview] }| + t {20: YYY} | + {3:[No Name] [+] }| + | 1| 1 {20: YYY} | + | 2| A {20: YYY} | + | 3| 4 {20: YYY} | + | 4| X {20: YYY} | + | 5| 7 {20: YYY} | + | 6| K {20: YYY} | + | 7| a {20: YYY} | + | 8| d {20: YYY} | + | 9| q {20: YYY} | + |10| x {20: YYY} | + |11| £ {20: YYY} | + {2:[Preview] }| :%s/. .$/ YYY^ | ]]) feed('\\r KKK') screen:expect([[ - a {12: YYY} | - {11:[No Name] [+] }| - | 1| 1 {12: YYY} | - | 2|{12: KKK} | - | 3| A {12: YYY} | - | 4|{12: KKK} | - | 5| 4 {12: YYY} | - | 6|{12: KKK} | - | 7| X {12: YYY} | - | 8|{12: KKK} | - | 9| 7 {12: YYY} | - |10|{12: KKK} | - |11| K {12: YYY} | - {10:[Preview] }| + a {20: YYY} | + {3:[No Name] [+] }| + | 1| 1 {20: YYY} | + | 2|{20: KKK} | + | 3| A {20: YYY} | + | 4|{20: KKK} | + | 5| 4 {20: YYY} | + | 6|{20: KKK} | + | 7| X {20: YYY} | + | 8|{20: KKK} | + | 9| 7 {20: YYY} | + |10|{20: KKK} | + |11| K {20: YYY} | + {2:[Preview] }| :%s/. .$/ YYY\r KKK^ | ]]) end) @@ -2463,14 +2449,14 @@ describe(':substitute', function() common_setup(screen, 'split', 'something\neverything\nsomeone') feed([[:%s/\(some\)\@=thing/one/]]) screen:expect([[ - some{12:one} | + some{20:one} | everything | someone | - {15:~ }|*2 - {11:[No Name] [+] }| - |1| some{12:one} | - {15:~ }|*6 - {10:[Preview] }| + {1:~ }|*2 + {3:[No Name] [+] }| + |1| some{20:one} | + {1:~ }|*6 + {2:[Preview] }| :%s/\(some\)\@<=thing/one/^ | ]]) @@ -2480,13 +2466,13 @@ describe(':substitute', function() feed([[:%s/\(some\)\@!thing/one/]]) screen:expect([[ something | - every{12:one} | + every{20:one} | someone | - {15:~ }|*2 - {11:[No Name] [+] }| - |2| every{12:one} | - {15:~ }|*6 - {10:[Preview] }| + {1:~ }|*2 + {3:[No Name] [+] }| + |2| every{20:one} | + {1:~ }|*6 + {2:[Preview] }| :%s/\(some\)\@') screen:expect([[ - {12:MO}o lines | - {11:[No Name] [+] }| - |2| {12:MO}o lines | - {15:~ }|*3 - {10:[Preview] }| - {13:Backwards range given, OK to swap (y/n)?}^ | + {20:MO}o lines | + {3:[No Name] [+] }| + |2| {20:MO}o lines | + {1:~ }|*3 + {2:[Preview] }| + {6:Backwards range given, OK to swap (y/n)?}^ | ]]) feed('y') @@ -2552,8 +2538,8 @@ describe(':substitute', function() Inc substitution on | ^MOo lines | | - {15:~ }|*4 - {13:Backwards range given, OK to swap (y/n)?}y | + {1:~ }|*4 + {6:Backwards range given, OK to swap (y/n)?}y | ]]) end) end) @@ -2595,15 +2581,15 @@ it(':substitute with inccommand, timer-induced :redraw #9777', function() feed(':%s/foo/ZZZ') sleep(20) -- Allow some timer activity. screen:expect([[ - {12:ZZZ} bar baz | + {20:ZZZ} bar baz | bar baz fox | - bar {12:ZZZ} baz | - {15:~ }|*3 - {11:[No Name] [+] }| - |1| {12:ZZZ} bar baz | - |3| bar {12:ZZZ} baz | - {15:~ }| - {10:[Preview] }| + bar {20:ZZZ} baz | + {1:~ }|*3 + {3:[No Name] [+] }| + |1| {20:ZZZ} bar baz | + |3| bar {20:ZZZ} baz | + {1:~ }| + {2:[Preview] }| :%s/foo/ZZZ^ | ]]) end) @@ -2627,8 +2613,8 @@ it(':substitute with inccommand, allows :redraw before first separator is typed foo bar baz | bar baz fox | bar foo baz | - {16: }{15: }| - {15:~ }| + {21: }{1: }| + {1:~ }| :^ | ]]) feed('%s') @@ -2636,8 +2622,8 @@ it(':substitute with inccommand, allows :redraw before first separator is typed foo bar baz | bar baz fox | bar foo baz | - {16: }{15: }| - {15:~ }| + {21: }{1: }| + {1:~ }| :%s^ | ]]) api.nvim_buf_set_lines(float_buf, 0, -1, true, { 'foo' }) @@ -2646,8 +2632,8 @@ it(':substitute with inccommand, allows :redraw before first separator is typed foo bar baz | bar baz fox | bar foo baz | - {16:foo }{15: }| - {15:~ }| + {21:foo }{1: }| + {1:~ }| :%s^ | ]]) end) @@ -2659,7 +2645,7 @@ it(':substitute with inccommand, does not crash if range contains invalid marks' feed([[:'a,'bs]]) screen:expect([[ test | - {15:~ }|*4 + {1:~ }|*4 :'a,'bs^ | ]]) -- v:errmsg shouldn't be set either before the first separator is typed @@ -2667,7 +2653,7 @@ it(':substitute with inccommand, does not crash if range contains invalid marks' feed('/') screen:expect([[ test | - {15:~ }|*4 + {1:~ }|*4 :'a,'bs/^ | ]]) end) @@ -2679,18 +2665,18 @@ it(':substitute with inccommand, no unnecessary redraw if preview is not shown', feed(':ls') screen:expect([[ test | - {15:~ }| - {11: }| + {1:~ }| + {3: }| :ls | 1 %a + "[No Name]" line 1 | - {13:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) feed(':s') -- no unnecessary redraw, so messages are still shown screen:expect([[ test | - {15:~ }| - {11: }| + {1:~ }| + {3: }| :ls | 1 %a + "[No Name]" line 1 | :s^ | @@ -2698,8 +2684,8 @@ it(':substitute with inccommand, no unnecessary redraw if preview is not shown', feed('o') screen:expect([[ test | - {15:~ }| - {11: }| + {1:~ }| + {3: }| :ls | 1 %a + "[No Name]" line 1 | :so^ | @@ -2707,8 +2693,8 @@ it(':substitute with inccommand, no unnecessary redraw if preview is not shown', feed('') screen:expect([[ test | - {15:~ }| - {11: }| + {1:~ }| + {3: }| :ls | 1 %a + "[No Name]" line 1 | :s^ | @@ -2716,8 +2702,8 @@ it(':substitute with inccommand, no unnecessary redraw if preview is not shown', feed('/test') -- now inccommand is shown, so screen is redrawn screen:expect([[ - {12:test} | - {15:~ }|*4 + {20:test} | + {1:~ }|*4 :s/test^ | ]]) end) @@ -2733,8 +2719,8 @@ it(":substitute doesn't crash with inccommand, if undo is empty #12932", functio sleep(100) feed('f') screen:expect([[ - {12:f} | - {15:~ }|*3 + {20:f} | + {1:~ }|*3 :%s/test/f^ | ]]) assert_alive() @@ -2756,11 +2742,11 @@ it(':substitute with inccommand works properly if undo is not synced #20029', fu ]]) feed('hjkl') screen:expect([[ - aaaaa {12:hjkl} | + aaaaa {20:hjkl} | foo | bar | baz | - bbbbb {12:hjkl} | + bbbbb {20:hjkl} | :'<,'>s/asdf/hjkl^ | ]]) feed('') @@ -2784,25 +2770,25 @@ it(':substitute with inccommand does not unexpectedly change viewport #25697', f command('vnew | tabnew | tabclose') screen:expect([[ ^ │£ m n | - {15:~ }│t œ ¥ | - {15:~ }│ | - {11:[No Name] }{10:[No Name] [+] }| + {1:~ }│t œ ¥ | + {1:~ }│ | + {3:[No Name] }{2:[No Name] [+] }| | ]]) feed(':s/') screen:expect([[ │£ m n | - {15:~ }│t œ ¥ | - {15:~ }│ | - {11:[No Name] }{10:[No Name] [+] }| + {1:~ }│t œ ¥ | + {1:~ }│ | + {3:[No Name] }{2:[No Name] [+] }| :s/^ | ]]) feed('') screen:expect([[ ^ │£ m n | - {15:~ }│t œ ¥ | - {15:~ }│ | - {11:[No Name] }{10:[No Name] [+] }| + {1:~ }│t œ ¥ | + {1:~ }│ | + {3:[No Name] }{2:[No Name] [+] }| | ]]) end) @@ -2836,7 +2822,7 @@ it('long :%s/ with inccommand does not collapse cmdline', function() ) screen:expect([[ | - {11: }| + {3: }| :%s/AAAAAAAA| AAAAAAAAAAAA| AAAAAAA^ | @@ -2850,7 +2836,7 @@ it("with 'inccommand' typing invalid `={expr}` does not show error", function() feed(':edit `=`') screen:expect([[ | - {15:~ }|*4 + {1:~ }|*4 :edit `=`^ | ]]) end) @@ -2903,26 +2889,26 @@ it("'inccommand' value can be changed multiple times #27086", function() for _ = 1, 3 do feed(':%s/foo/bar') screen:expect([[ - {12:bar}1 | - {12:bar}2 | - {12:bar}3 | - {15:~ }|*7 - {11:[No Name] [+] }| - |1| {12:bar}1 | - |2| {12:bar}2 | - |3| {12:bar}3 | - {15:~ }|*4 - {10:[Preview] }| + {20:bar}1 | + {20:bar}2 | + {20:bar}3 | + {1:~ }|*7 + {3:[No Name] [+] }| + |1| {20:bar}1 | + |2| {20:bar}2 | + |3| {20:bar}3 | + {1:~ }|*4 + {2:[Preview] }| :%s/foo/bar^ | ]]) feed('') command('set inccommand=nosplit') feed(':%s/foo/bar') screen:expect([[ - {12:bar}1 | - {12:bar}2 | - {12:bar}3 | - {15:~ }|*16 + {20:bar}1 | + {20:bar}2 | + {20:bar}3 | + {1:~ }|*16 :%s/foo/bar^ | ]]) feed('') @@ -2938,10 +2924,10 @@ it("'inccommand' disables preview if preview buffer can't be created #27086", fu eq('split', api.nvim_get_option_value('inccommand', {})) feed(':%s/foo/bar') screen:expect([[ - {12:bar}1 | - {12:bar}2 | - {12:bar}3 | - {15:~ }|*16 + {20:bar}1 | + {20:bar}2 | + {20:bar}3 | + {1:~ }|*16 :%s/foo/bar^ | ]]) eq('nosplit', api.nvim_get_option_value('inccommand', {})) diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua index 0f95d2d856..d08c16c1ad 100644 --- a/test/functional/ui/inccommand_user_spec.lua +++ b/test/functional/ui/inccommand_user_spec.lua @@ -237,13 +237,6 @@ describe("'inccommand' for user commands", function() before_each(function() clear() screen = Screen.new(40, 17) - screen:set_default_attr_ids({ - [1] = { background = Screen.colors.Yellow1 }, - [2] = { foreground = Screen.colors.Blue1, bold = true }, - [3] = { reverse = true }, - [4] = { reverse = true, bold = true }, - [5] = { foreground = Screen.colors.Blue }, - }) screen:attach() exec_lua(setup_replace_cmd) command('set cmdwinheight=5') @@ -263,16 +256,16 @@ describe("'inccommand' for user commands", function() command('set inccommand=nosplit') feed(':Replace text cats') screen:expect([[ - {1:cats} on line 1 | - more {1:cats} on line 2 | - oh no, even more {1:cats} | - will the {1:cats} ever stop | + {10:cats} on line 1 | + more {10:cats} on line 2 | + oh no, even more {10:cats} | + will the {10:cats} ever stop | oh well | - did the {1:cats} stop | + did the {10:cats} stop | why won't it stop | - make the {1:cats} stop | + make the {10:cats} stop | | - {2:~ }|*7 + {1:~ }|*7 :Replace text cats^ | ]]) end) @@ -281,22 +274,22 @@ describe("'inccommand' for user commands", function() command('set inccommand=split') feed(':Replace text cats') screen:expect([[ - {1:cats} on line 1 | - more {1:cats} on line 2 | - oh no, even more {1:cats} | - will the {1:cats} ever stop | + {10:cats} on line 1 | + more {10:cats} on line 2 | + oh no, even more {10:cats} | + will the {10:cats} ever stop | oh well | - did the {1:cats} stop | + did the {10:cats} stop | why won't it stop | - make the {1:cats} stop | + make the {10:cats} stop | | - {4:[No Name] [+] }| - |1| {1:cats} on line 1 | - |2| more {1:cats} on line 2 | - |3| oh no, even more {1:cats} | - |4| will the {1:cats} ever stop | - |6| did the {1:cats} stop | - {3:[Preview] }| + {3:[No Name] [+] }| + |1| {10:cats} on line 1 | + |2| more {10:cats} on line 2 | + |3| oh no, even more {10:cats} | + |4| will the {10:cats} ever stop | + |6| did the {10:cats} stop | + {2:[Preview] }| :Replace text cats^ | ]]) end) @@ -314,7 +307,7 @@ describe("'inccommand' for user commands", function() why won't it stop | make the text stop | ^ | - {2:~ }|*7 + {1:~ }|*7 | ]]) end) @@ -332,7 +325,7 @@ describe("'inccommand' for user commands", function() why won't it stop | make the cats stop | ^ | - {2:~ }|*7 + {1:~ }|*7 :Replace text cats | ]]) end) @@ -341,7 +334,7 @@ describe("'inccommand' for user commands", function() command('set inccommand=split') feed('gg:.Replace text cats') screen:expect([[ - {1:cats} on line 1 | + {10:cats} on line 1 | more text on line 2 | oh no, even more text | will the text ever stop | @@ -350,7 +343,7 @@ describe("'inccommand' for user commands", function() why won't it stop | make the text stop | | - {2:~ }|*7 + {1:~ }|*7 :.Replace text cats^ | ]]) end) @@ -394,7 +387,7 @@ describe("'inccommand' for user commands", function() ]]) feed(':C') screen:expect([[ - {1: cats on line 1} | + {10: cats on line 1} | more cats on line 2 | oh no, even more cats | will the cats ever stop | @@ -403,7 +396,7 @@ describe("'inccommand' for user commands", function() why won't it stop | make the cats stop | | - {2:~ }|*7 + {1:~ }|*7 :C^ | ]]) assert_alive() @@ -453,7 +446,7 @@ describe("'inccommand' for user commands", function() why won't it stop | make the text stop | a.a.a.a. | - {2:~ }|*7 + {1:~ }|*7 :Test a.a.a.a.^ | ]]) feed('u') @@ -467,8 +460,8 @@ describe("'inccommand' for user commands", function() why won't it stop | make the text stop | a.a.a. | - {2:~ }|*7 - :Test a.a.a.a.{5:^[}u^ | + {1:~ }|*7 + :Test a.a.a.a.{18:^[}u^ | ]]) feed('') screen:expect([[ @@ -481,7 +474,7 @@ describe("'inccommand' for user commands", function() why won't it stop | make the text stop | ^ | - {2:~ }|*7 + {1:~ }|*7 | ]]) end @@ -521,12 +514,6 @@ describe("'inccommand' with multiple buffers", function() before_each(function() clear() screen = Screen.new(40, 17) - screen:set_default_attr_ids({ - [1] = { background = Screen.colors.Yellow1 }, - [2] = { foreground = Screen.colors.Blue1, bold = true }, - [3] = { reverse = true }, - [4] = { reverse = true, bold = true }, - }) screen:attach() exec_lua(setup_replace_cmd) command('set cmdwinheight=10') @@ -547,12 +534,12 @@ describe("'inccommand' with multiple buffers", function() command('set inccommand=nosplit') feed(':Replace foo bar') screen:expect([[ - bar baz {1:bar} │ {1:bar} bar baz | - baz {1:bar} bar │ bar baz {1:bar} | - {1:bar} bar baz │ baz {1:bar} bar | + bar baz {10:bar} │ {10:bar} bar baz | + baz {10:bar} bar │ bar baz {10:bar} | + {10:bar} bar baz │ baz {10:bar} bar | │ | - {2:~ }│{2:~ }|*11 - {4:[No Name] [+] }{3:[No Name] [+] }| + {1:~ }│{1:~ }|*11 + {3:[No Name] [+] }{2:[No Name] [+] }| :Replace foo bar^ | ]]) feed('') @@ -561,8 +548,8 @@ describe("'inccommand' with multiple buffers", function() baz bar bar │ bar baz bar | bar bar baz │ baz bar bar | ^ │ | - {2:~ }│{2:~ }|*11 - {4:[No Name] [+] }{3:[No Name] [+] }| + {1:~ }│{1:~ }|*11 + {3:[No Name] [+] }{2:[No Name] [+] }| :Replace foo bar | ]]) end) @@ -571,22 +558,22 @@ describe("'inccommand' with multiple buffers", function() command('set inccommand=split') feed(':Replace foo bar') screen:expect([[ - bar baz {1:bar} │ {1:bar} bar baz | - baz {1:bar} bar │ bar baz {1:bar} | - {1:bar} bar baz │ baz {1:bar} bar | + bar baz {10:bar} │ {10:bar} bar baz | + baz {10:bar} bar │ bar baz {10:bar} | + {10:bar} bar baz │ baz {10:bar} bar | │ | - {4:[No Name] [+] }{3:[No Name] [+] }| + {3:[No Name] [+] }{2:[No Name] [+] }| Buffer #1: | - |1| {1:bar} bar baz | - |2| bar baz {1:bar} | - |3| baz {1:bar} bar | + |1| {10:bar} bar baz | + |2| bar baz {10:bar} | + |3| baz {10:bar} bar | Buffer #2: | - |1| bar baz {1:bar} | - |2| baz {1:bar} bar | - |3| {1:bar} bar baz | + |1| bar baz {10:bar} | + |2| baz {10:bar} bar | + |3| {10:bar} bar baz | | - {2:~ }| - {3:[Preview] }| + {1:~ }| + {2:[Preview] }| :Replace foo bar^ | ]]) feed('') @@ -595,8 +582,8 @@ describe("'inccommand' with multiple buffers", function() baz bar bar │ bar baz bar | bar bar baz │ baz bar bar | ^ │ | - {2:~ }│{2:~ }|*11 - {4:[No Name] [+] }{3:[No Name] [+] }| + {1:~ }│{1:~ }|*11 + {3:[No Name] [+] }{2:[No Name] [+] }| :Replace foo bar | ]]) end) diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua index b8a73b1c61..627a13ee12 100644 --- a/test/functional/ui/output_spec.lua +++ b/test/functional/ui/output_spec.lua @@ -108,20 +108,15 @@ describe('shell command :!', function() it('handles control codes', function() skip(is_os('win'), 'missing printf') local screen = Screen.new(50, 4) - screen:set_default_attr_ids { - [1] = { bold = true, reverse = true }, - [2] = { bold = true, foreground = Screen.colors.SeaGreen }, - [3] = { foreground = Screen.colors.Blue }, - } screen:attach() -- Print TAB chars. #2958 feed([[:!printf '1\t2\t3']]) screen:expect { grid = [[ - {1: }| + {3: }| :!printf '1\t2\t3' | 1 2 3 | - {2:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]], } feed([[]]) @@ -131,10 +126,10 @@ describe('shell command :!', function() feed([[:!printf '\007\007\007\007text']]) screen:expect { grid = [[ - {1: }| + {3: }| :!printf '\007\007\007\007text' | text | - {2:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]], condition = function() eq(true, screen.bell) @@ -145,10 +140,10 @@ describe('shell command :!', function() -- Print BS control code. feed([[:echo system('printf ''\010\n''')]]) screen:expect([[ - {1: }| - {3:^H} | + {3: }| + {18:^H} | | - {2:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) feed([[]]) @@ -157,7 +152,7 @@ describe('shell command :!', function() screen:expect([[ :!printf '\n' | |*2 - {2:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) feed([[]]) end) @@ -171,12 +166,6 @@ describe('shell command :!', function() write_file('bang_filter_spec/f2', 'f2') write_file('bang_filter_spec/f3', 'f3') screen = Screen.new(53, 10) - screen:set_default_attr_ids({ - [1] = { bold = true, foreground = Screen.colors.Blue1 }, - [2] = { foreground = Screen.colors.Blue1 }, - [3] = { bold = true, foreground = Screen.colors.SeaGreen4 }, - [4] = { bold = true, reverse = true }, - }) screen:attach() end) @@ -196,13 +185,13 @@ describe('shell command :!', function() screen:expect([[ | {1:~ }|*2 - {4: }| + {3: }| ]] .. result .. [[ | f1 | f2 | f3 | | - {3:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) end) @@ -213,14 +202,14 @@ describe('shell command :!', function() grid = [[ | {1:~ }| - {4: }| + {3: }| :!cat test/functional/fixtures/shell_data.txt | - {2:^@^A^B^C^D^E^F^H} | - {2:^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_} | - ö 한글 {2:} | - t {2:} | + {18:^@^A^B^C^D^E^F^H} | + {18:^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_} | + ö 한글 {18:} | + t {18:} | | - {3:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]], condition = function() eq(true, screen.bell) @@ -235,7 +224,7 @@ describe('shell command :!', function() -- Note: only the first example of split composed char works screen:expect([[ | - {4: }| + {3: }| :]] .. cmd .. [[ | å | ref: å̲ | @@ -243,7 +232,7 @@ describe('shell command :!', function() 2: å ̲ | 3: å ̲ | | - {3:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) end) end)