Patch 7.1.148

2007-11-04 Fir de Conversatie Bram Moolenaar


Patch 7.1.148
Problem:Some types are not found by configure.
Solution:   Test for the sys/types.h header file. (Sean Boudreau)
Files:  src/configure.in, src/auto/configure


*** ../vim-7.1.147/src/configure.in Thu Jun 28 13:02:22 2007
--- src/configure.inSat Oct 27 15:52:16 2007
***
*** 2026,2032 
  fi
  
  AC_CHECK_HEADERS(stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
!   termcap.h fcntl.h sgtty.h sys/ioctl.h sys/time.h termio.h \
iconv.h langinfo.h unistd.h stropts.h errno.h \
sys/resource.h sys/systeminfo.h locale.h \
sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \
--- 2026,2032 
  fi
  
  AC_CHECK_HEADERS(stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
!   termcap.h fcntl.h sgtty.h sys/ioctl.h sys/time.h sys/types.h termio.h \
iconv.h langinfo.h unistd.h stropts.h errno.h \
sys/resource.h sys/systeminfo.h locale.h \
sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \
*** ../vim-7.1.147/src/auto/configure   Thu Jun 28 13:02:22 2007
--- src/auto/configure  Sun Nov  4 15:34:14 2007
***
*** 10265,10272 
  
  
  
  for ac_header in stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
!   termcap.h fcntl.h sgtty.h sys/ioctl.h sys/time.h termio.h \
iconv.h langinfo.h unistd.h stropts.h errno.h \
sys/resource.h sys/systeminfo.h locale.h \
sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \
--- 10265,10273 
  
  
  
+ 
  for ac_header in stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
!   termcap.h fcntl.h sgtty.h sys/ioctl.h sys/time.h sys/types.h termio.h \
iconv.h langinfo.h unistd.h stropts.h errno.h \
sys/resource.h sys/systeminfo.h locale.h \
sys/stream.h sys/ptem.h termios.h libc.h sys/statfs.h \
*** ../vim-7.1.147/src/version.cTue Oct 30 17:36:31 2007
--- src/version.c   Sun Nov  4 15:34:26 2007
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 148,
  /**/

-- 
If your nose runs, and your feet smell, you might be upside down.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: vim 6.3.82 (possibly others) DoS (and perhaps potential exploit) report

2007-11-04 Fir de Conversatie Bram Moolenaar


Chris Drake wrote:

 It's possible to craft a malformed .swp file that causes vim to crash
 in a way that completely locks up a terminal.

I can't do much without such a .swp file.  To be able to reproduce the
problem I would need both the original file and the .swp file that has
the problem.

Your text suggests that you know how to make a .swp file that causes the
problem.  Please share that with me.  Don't send to the list if you
think this may help malicious people to misuse the info.

6.3.82 is quite old, it's very well possible that the problem got fixed
in the mean time.  Can you reproduce the problem with Vim 7.1?  The swap
file should be compatible.

 Vim: Caught deadly signal ABRT
 
 (at this point - the terminal is completely locked up - ^C etc all
 have no effect.  kill also has no effect.  kill-9 from another session
 ended it OK)

You may need to reset the terminal (in xterm that's done by pressing
CTRL and the middle mouse button, select Do Full reset).  Sometimes
typing resetCRresetCR works.  Vim switches off echo, so you may
not see what you type.

 
 Here's some version info
 
 
 I think vim is used for lots of things, including at least editing
 crontab files (after copy stuff to /tmp) - thus - a malicious local
 user could place crafted .swp files in /tmp (or elsewhere that they
 might have access to) to crash (DoS) anyone elses future VIM
 sessions.  Depending on the error - it might be possible to exploit
 this to run arbitrary code elevated to the vim users permissions (the
 error reports as *either* double free (hard to exploit) or
 corruption (probably a buffer overflow - easy to exploit))

I think that would be really hard to do, but it can't be ruled out.

-- 
hundred-and-one symptoms of being an internet addict:
88. Every single time you press the 'Get mail' button...it does get new mail.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: The .phtml file extension, and the PHP filetype

2007-11-04 Fir de Conversatie Bram Moolenaar


Dave Hodder wrote:

 Vim presently associates *.phtml files with PHP/FI (a.k.a. PHP 2) syntax 
 highlighting, although realistically I doubt anybody uses it[1][2]. 
 Instead, the php filetype handles PHP versions 3 and above.
 
 Increasingly, however, I believe the .phtml extension is used by PHP 
 5-based web applications.  For example, apps based on the Zend Framework 
 typically use it for the view part of front controller MVC.
 
 I have the following suggestion:
 
1. Remove syntax/phtml.vim.
 
2. Change *.phtml association in filetype.vim to associate with php
   filetype instead.
 
3. Amend synmenu.vim so there's only one PHP menu item, just called
   PHP.  This might also be a good time to update Cold Fusion to
   ColdFusion (no space in name).
 
 Many Thanks,
 
 Dave
 
 [1] It was released in 1995, the same time we were all being wowed by
  Netscape Navigator 1.1!  :o)  PHP 3 superseded it in 1997.
 [2] 
 http://www.nexen.net/chiffres_cles/phpversion/17377-php_statistics_for_july_2007.php#versions


I don't know about the use of PHP in .phtml files.  I thought they were
always called *.php.  Opinions?

I don't delete an existing syntax file unless it is completely useless.

-- 
hundred-and-one symptoms of being an internet addict:
91. It's Saturday afternoon in the middle of May and you
are on computer.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Feature request: enable undo after reloading file

2007-11-04 Fir de Conversatie Bram Moolenaar


Alexei Alexandrov wrote:

 I'd like to request a feature in Vim which would be useful not very often but 
 is very important I think.
 
 Usually I don't lose information in Vim. You can undo things, you can restore 
 the file from a backup etc. There is only one situation which led me to 
 information loss several times. This situation happens when I have a file 
 with 
 modifications opened in Vim and then I also change this file by accident 
 outside of Vim. In this case Vim shows a message box with 2 buttons: reload 
 file or don't reload file. Several times I pressed reload file by accident. 
 And my changes in Vim were lost! Undo didn't work after that.
 
 I don't know if it's difficult to implement but it would be great if undo 
 worked after such reload. And this would be useful not only for by accident 
 cases - I could also press reload just to see what those external changes 
 are 
 and then undo if I don't need them.

I'll put it in the todo list.  However, don't expect it soon.  I think
the only right way to implement it is to do a diff between the buffer
text and the file that is to be loaded.  The difference would then be
stored as a change in the undo buffer.

 P.S. Persistent undo would be great too. :)

That's already in the todo list.

-- 
From know your smileys:
 :~)A man with a tape recorder up his nose

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Feature request: enable undo after reloading file

2007-11-04 Fir de Conversatie Andy Wokula

Bram Moolenaar schrieb:
 
 Alexei Alexandrov wrote:
 
 I'd like to request a feature in Vim which would be useful not very often 
 but 
 is very important I think.

 Usually I don't lose information in Vim. You can undo things, you can 
 restore 
 the file from a backup etc. There is only one situation which led me to 
 information loss several times. This situation happens when I have a file 
 with 
 modifications opened in Vim and then I also change this file by accident 
 outside of Vim. In this case Vim shows a message box with 2 buttons: reload 
 file or don't reload file. Several times I pressed reload file by 
 accident. 
 And my changes in Vim were lost! Undo didn't work after that.

 I don't know if it's difficult to implement but it would be great if undo 
 worked after such reload. And this would be useful not only for by 
 accident 
 cases - I could also press reload just to see what those external changes 
 are 
 and then undo if I don't need them.
 
 I'll put it in the todo list.  However, don't expect it soon.  I think
 the only right way to implement it is to do a diff between the buffer
 text and the file that is to be loaded.  The difference would then be
 stored as a change in the undo buffer.

Already there (todo.txt from 2007 Oct 30) as well:

8   See :e as a change operation, find the changes and add them to the
undo info.  Needed for when an external tool changes the file.
 
 P.S. Persistent undo would be great too. :)
 
 That's already in the todo list.

-- 
Andy

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Operator pending mode

2007-11-04 Fir de Conversatie Ben Schmidt
[CCing vim_dev; apologies for my continued disorganised postings!]

OK, folks,

After reading feedback, etc., here is a revised patch. It's just the 
documentation
that is different from the previous patch.

In the end, given that a number of things can be done without v:operator, as 
Andy
demonstrated, and that Yankring is a pretty specific example, I thought perhaps
the best thing would be to put a brief example analogous to the v:prevcount
example which is right nextdoor in the docs.

If you still think a lengthier example is better, though, Bram, I'm happy to
revise the patch again. I thought this, or a scaled-down count-ignorant version
might be a more useful lengthy example (compared to the function name thing I
suggested before):

: Defines a motion/text-object C which allows you to operate on
: the {count}th column of a tab-delimited table, or the column
: the cursor is currently in if no count is given.
:onoremap C Esc:call OperateColumn()CR
:function! OperateColumn()
:  let c = v:prevcount
:  if c == 0
:call search('^\|\t\zs','bc',line(.))
:  else
:call cursor(line(.),1)
:while search('\v(\zs[^\t]*(\t|$)){'.c.'}','c',line(.)) == 0
:  call setline(line(.),getline(line(.)).\t)
:endwhile
:  endif
:  call feedkeys(''.v:register.v:operator)
:  if strpart(getline(line('.')),col('.')-1,1) == \t
:call feedkeys(:\CR)
:  else
:call feedkeys(search('\t','n',line(.)) == 0 ? $ : t\t)
:  endif
:endfun

Ben.







--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---

Index: runtime/doc/eval.txt
===
--- runtime/doc/eval.txt(revision 621)
+++ runtime/doc/eval.txt(working copy)
@@ -1401,10 +1401,20 @@
This is the screen column number, like with |virtcol()|.  The
value is zero when there was no mouse button click.
 
+   *v:operator* *operator-variable*
+v:operator The last operator given in Normal mode. This is a single
+   character except for commands starting with g or z,
+   in which case it is two characters. Best used alongside
+   |v:prevcount| and |v:register|. Useful if you want to cancel
+   Operator-pending mode and then use the operator. 
+   :omap O Esc:call MyMotion(v:operator)CR
+  Read-only.
+
*v:prevcount* *prevcount-variable*
 v:prevcountThe count given for the last but one Normal mode command.
This is the v:count value of the previous command.  Useful if
-   you want to cancel Visual mode and then use the count. 
+   you want to cancel Visual or Operator-pending mode and then
+   use the count. 
:vmap % Esc:call MyFilter(v:prevcount)CR
   Read-only.
 
Index: src/vim.h
===
--- src/vim.h   (revision 607)
+++ src/vim.h   (working copy)
@@ -1688,7 +1688,8 @@
 #define VV_MOUSE_WIN   49
 #define VV_MOUSE_LNUM   50
 #define VV_MOUSE_COL   51
-#define VV_LEN 52  /* number of v: vars */
+#define VV_OP  52
+#define VV_LEN 53  /* number of v: vars */
 
 #ifdef FEAT_CLIPBOARD
 
Index: src/eval.c
===
--- src/eval.c  (revision 607)
+++ src/eval.c  (working copy)
@@ -345,6 +345,7 @@
 {VV_NAME(mouse_win,   VAR_NUMBER), 0},
 {VV_NAME(mouse_lnum,  VAR_NUMBER), 0},
 {VV_NAME(mouse_col,   VAR_NUMBER), 0},
+{VV_NAME(operator,VAR_STRING), VV_RO},
 };
 
 /* shorthand */
@@ -17260,6 +17261,35 @@
 }
 
 /*
+ * Set v:operator if needed.
+ */
+void
+set_op_var(optype)
+intoptype;
+{
+/* This will either be two operator characters, or one and a NUL. */
+char_u opchars[2];
+
+if (optype == OP_NOP)
+{
+   set_vim_var_string(VV_OP, NULL, 0);
+   return;
+}
+
+opchars[0] = get_op_char(optype);
+if (opchars[0] == 'g' || opchars[0] == 'z')
+   opchars[1] = get_extra_op_char(optype);
+else
+   opchars[1] = 0;
+
+/* Avoid free/alloc when the value is already right. */
+if (vimvars[VV_OP].vv_str == NULL ||
+   vimvars[VV_OP].vv_str[0] != opchars[0] ||
+   vimvars[VV_OP].vv_str[1] != opchars[1])
+   set_vim_var_string(VV_OP, opchars, opchars[1]==0?1:2);
+}
+
+/*
  * Get or set v:exception.  If oldval == NULL, return the current value.
  * Otherwise, restore the value to oldval and return NULL.
  * Must always be called 

Re: Feature request: enable undo after reloading file

2007-11-04 Fir de Conversatie Alexei Alexandrov

On 11/4/07, Bram Moolenaar [EMAIL PROTECTED] wrote:

 I'll put it in the todo list.  However, don't expect it soon.  I think
 the only right way to implement it is to do a diff between the buffer
 text and the file that is to be loaded.  The difference would then be
 stored as a change in the undo buffer.

Yes, this would be the most correct way. It is also not very easy to
implement perhaps?


  P.S. Persistent undo would be great too. :)

 That's already in the todo list.

I know actually - this is why the smile is there. Just making sure you
know people need this feature :)

-- 
Alexei Alexandrov

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---