On 08-Nov-2013 Lech Lorens <[email protected]> wrote:
> On 08-Nov-2013 Bram Moolenaar <[email protected]> wrote:
> >
> > Lech Lorens wrote:
> >
> > > Attached is a patch fixing E315 error caused by delete ex command not
> > > resetting visual selection.
> > >
> > > Test included.
> > >
> > > Note that this is related to pressing Escape when in visual mode
> > > triggering a yank to the clipboard. This means that the problem might
> > > (but I'm not sure) be limited to X11 (so *nix, Cygwin). This might mean
> > > that the test file should source unix.vim. Or perhaps check for Vim
> > > having been compiled with X11 support.
> >
> > I can't seem to reproduce the E315 error. I do see strange errors for
> > "normal gv" trying to select lines that don't exist.
>
> What about the attached test? Doesn't it fail for you without the patch
> and start working after the patch has been applied?
>
> > > diff --git a/src/ex_docmd.c b/src/ex_docmd.c
> > > index 24f80fb..1f6fd9b 100644
> > > --- a/src/ex_docmd.c
> > > +++ b/src/ex_docmd.c
> > > @@ -8556,6 +8556,7 @@ ex_operators(eap)
> > > beginline(BL_SOL | BL_FIX);
> > > }
> > >
> > > + end_visual_mode();
> > > switch (eap->cmdidx)
> > > {
> > > case CMD_delete:
> >
> > Calling end_visual_mode() without Visual mode being active is not right.
>
> Yes, now it doesn't look right any more.
>
> > And this should be inside an #ifdef.
> >
> > Can you have another look at this Lech?
>
> Sure. But do you mean anything other than not ending visual mode when
> we're not in visual mode?
Took my time to update the patch.
Wonder how it's possible that you are seeing other errors than me.
--
Lech Lorens
--
--
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].
For more options, visit https://groups.google.com/groups/opt_out.
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 24f80fb..e961242 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -8556,6 +8556,11 @@ ex_operators(eap)
beginline(BL_SOL | BL_FIX);
}
+#if defined(FEAT_VISUAL)
+ if (VIsual_active)
+ end_visual_mode();
+#endif
+
switch (eap->cmdidx)
{
case CMD_delete:
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index d155198..f89d99b 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -32,7 +32,8 @@ SCRIPTS = test3.out test4.out test5.out test6.out
test7.out \
test79.out test80.out test81.out test82.out test83.out \
test84.out test85.out test86.out test87.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
- test94.out test95.out test96.out test98.out test99.out
+ test94.out test95.out test96.out test98.out test99.out \
+ test100.out
SCRIPTS32 = test50.out test70.out
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index 380594c..e94b002 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -52,7 +52,8 @@ SCRIPTS = test3.out test4.out test5.out test6.out
test7.out \
test79.out test80.out test81.out test82.out test83.out \
test84.out test85.out test86.out test87.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
- test94.out test95.out test96.out test98.out test99.out
+ test94.out test95.out test96.out test98.out test99.out \
+ test100.out
SCRIPTS32 = test50.out test70.out
diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak
index e7ec617..acb7bd7 100644
--- a/src/testdir/Make_os2.mak
+++ b/src/testdir/Make_os2.mak
@@ -34,7 +34,8 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test76.out test77.out test78.out test79.out test80.out \
test81.out test82.out test83.out test84.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
- test94.out test95.out test96.out test98.out test99.out
+ test94.out test95.out test96.out test98.out test99.out \
+ test100.out
.SUFFIXES: .in .out
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index 2001bfc..0ace93c 100644
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -4,7 +4,7 @@
# Authors: Zoltan Arpadffy, <[email protected]>
# Sandor Kopanyi, <[email protected]>
#
-# Last change: 2013 Sep 19
+# Last change: 2013 Oct 26
#
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
# Edit the lines in the Configuration section below to select.
@@ -78,7 +78,8 @@ SCRIPT = test1.out test2.out test3.out test4.out
test5.out \
test77.out test78.out test79.out test80.out test81.out \
test82.out test83.out test84.out test88.out test89.out \
test90.out test91.out test92.out test93.out test94.out \
- test95.out test96.out test97.out test98.out test99.out
+ test95.out test96.out test97.out test98.out test99.out \
+ test100.out
# Known problems:
# Test 30: a problem around mac format - unknown reason
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index f736d54..3620cee 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -30,7 +30,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out
test6.out \
test84.out test85.out test86.out test87.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test97.out test98.out \
- test99.out
+ test99.out test100.out
SCRIPTS_GUI = test16.out
diff --git a/src/testdir/test100.in b/src/testdir/test100.in
new file mode 100644
index 0000000..7c7591e
--- /dev/null
+++ b/src/testdir/test100.in
@@ -0,0 +1,37 @@
+Test for visual mode not being reset causing E315 error.
+STARTTEST
+:so small.vim
+:enew
+:let g:msg="Everything's fine."
+:function! TriggerTheProblem()
+: " At this point there is no visual selection because :call reset it.
+: " Let's restore the selection:
+: normal gv
+: '<,'>del _
+: try
+: exe "normal \<Esc>"
+: catch /^Vim\%((\a\+)\)\=:E315/
+: echom 'Snap! E315 error!'
+: let g:msg='Snap! E315 error!'
+: endtry
+:endfunction
+:enew
+:setl buftype=nofile
+:call append(line('$'), 'Delete this line.')
+:"
+:"
+:" NOTE: this has to be done by a call to a function because executing :del the
+:" ex-way will require the colon operator which resets the visual mode
thus
+:" preventing the problem:
+:"
+GV:call TriggerTheProblem()
+:%del _
+:call append(line('$'), g:msg)
+:w! test.out
+:brewind
+ENDTEST
+
+STARTTEST
+:qa!
+ENDTEST
+
diff --git a/src/testdir/test100.ok b/src/testdir/test100.ok
new file mode 100644
index 0000000..9ea6dd6
--- /dev/null
+++ b/src/testdir/test100.ok
@@ -0,0 +1,2 @@
+
+Everything's fine.