Wishlist: no terminal fallback in gvim

2006-08-29 Thread Martin Krischik

Hello,

When gvim is started in gui mode but cannot connect to the X-Server it  
falls back to terminal mode.


I would which that this feature could be disabled as it caused serious  
problems when gvim is started as background task - in which case the  
now simple vim has a terminal to display but no keyboard to accept  
commands from.


Martin

PS: Please remember that on some operating systems gvim allways starts  
as if --nofork has been set.




Patch 7.0.067

2006-08-29 Thread Bram Moolenaar

Patch 7.0.067
Problem:Undo doesn't always work properly when using scim input method.
Undo is split up when using preediting.
Solution:   Reset xim_has_preediting also when preedit_start_col is not
MAXCOL.  Don't split undo when Left is used while preediting.
(Yukihiro Nakadaira)
Files:  src/edit.c, src/mbyte.c


*** ../vim-7.0.066/src/edit.c   Tue Aug 22 19:58:22 2006
--- src/edit.c  Tue Aug 29 14:57:46 2006
***
*** 8597,8603 
  tpos = curwin-w_cursor;
  if (oneleft() == OK)
  {
!   start_arrow(tpos);
  #ifdef FEAT_RIGHTLEFT
/* If exit reversed string, position is fixed */
if (revins_scol != -1  (int)curwin-w_cursor.col = revins_scol)
--- 8597,8608 
  tpos = curwin-w_cursor;
  if (oneleft() == OK)
  {
! #if defined(FEAT_XIM)  defined(FEAT_GUI_GTK)
!   /* Only call start_arrow() when not busy with preediting, it will
!* break undo.  K_LEFT is inserted in im_correct_cursor(). */
!   if (!im_is_preediting())
! #endif
!   start_arrow(tpos);
  #ifdef FEAT_RIGHTLEFT
/* If exit reversed string, position is fixed */
if (revins_scol != -1  (int)curwin-w_cursor.col = revins_scol)
*** ../vim-7.0.066/src/mbyte.c  Wed Aug 16 18:05:36 2006
--- src/mbyte.c Tue Aug 29 14:41:45 2006
***
*** 3514,3519 
--- 3514,3524 
add_to_input_buf(delkey, (int)sizeof(delkey));
  }
  
+ /*
+  * Move the cursor left by num_move_back characters.
+  * Note that ins_left() checks im_is_preediting() to avoid breaking undo for
+  * these K_LEFT keys.
+  */
  static void
  im_correct_cursor(int num_move_back)
  {
***
*** 3741,3748 
  }
  else if (cursor_index == 0  preedit_string[0] == '\0')
  {
!   if (preedit_start_col == MAXCOL)
!   xim_has_preediting = FALSE;
  
/* If at the start position (after typing backspace)
 * preedit_start_col must be reset. */
--- 3746,3752 
  }
  else if (cursor_index == 0  preedit_string[0] == '\0')
  {
!   xim_has_preediting = FALSE;
  
/* If at the start position (after typing backspace)
 * preedit_start_col must be reset. */
*** ../vim-7.0.066/src/version.cTue Aug 22 21:51:18 2006
--- src/version.c   Tue Aug 29 16:09:35 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 67,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
265. Your reason for not staying in touch with family is that
 they do not have e-mail addresses.

 /// 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///


Re: Fastest way to append line or char to a buffer

2006-08-29 Thread Brad Beveridge

On 29/08/06, Ilya [EMAIL PROTECTED] wrote:

Brad Beveridge wrote:
 On 26/08/06, Brad Beveridge [EMAIL PROTECTED] wrote:
 SNIP

 Cheers
 Brad

 Hi, sorry for all the trouble :)  I'm having redraw issues, where
 running this code to append chars is causing strange problems.
 The scenario is this (always using the code below for char output):
 1) Write a char to a buffer (line1)
 2) Write a newline (line 2)
 3) Move the cursor to the bottom of the buffer (line2 empty)
 4) Write another Char (appears in line2)
 5) Press Ctrl-L
 6) Notice that line1 has vanished.

 moving the cursor to the new blank line at the bottom of the line is
 critical here.  I'm sure that I'm doing something wrong, but I really
 can't figure it out.
 As a side note, it feels very clumsy to have to manually call changed
 line functions when calling ml_* funcs - is there some notes I can
 read about why this is?
 Anyhow, here is the code I'm using to put chars in a buffer - I really
 appreciate any thoughts, this feels so close to working, but I've
 spend several hours trying to get it right.  Very frustrating :)

 Cheers
 Brad

 static void vim_append_char (buf_T target_buf, char c)
 {
static char string[2] = {0};
Should not you have = {0, 0} here?  Second element never get
initialized but it could be accessed by ml_append_string.


That might be more clear perhaps, but when you initialize an array
like that in C, the last element is propagated for the whole array.

Cheers
Brad


Patch 7.0.071

2006-08-29 Thread Bram Moolenaar

Patch 7.0.071
Problem:Using an empty search pattern may cause a crash.
Solution:   Avoid using a NULL pointer.
Files:  src/search.c


*** ../vim-7.0.070/src/search.c Tue Aug 29 17:28:56 2006
--- src/search.cTue Aug 29 14:56:15 2006
***
*** 1259,1265 
/*
 * Add character and/or line offset
 */
!   if (!(options  SEARCH_NOOF) || *pat == ';')
{
if (spats[0].off.line)  /* Add the offset to the line number. */
{
--- 1259,1265 
/*
 * Add character and/or line offset
 */
!   if (!(options  SEARCH_NOOF) || (pat != NULL  *pat == ';'))
{
if (spats[0].off.line)  /* Add the offset to the line number. */
{
*** ../vim-7.0.070/src/version.cTue Aug 29 17:28:56 2006
--- src/version.c   Tue Aug 29 17:59:24 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 71,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
268. You get up in the morning and go online before getting your coffee.

 /// 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///


Re: Wishlist: no terminal fallback in gvim

2006-08-29 Thread Martin Krischik
Am Dienstag, 29. August 2006 11:44 schrieb Bram Moolenaar:

 Martin Krischik wrote:
  When gvim is started in gui mode but cannot connect to the X-Server it
  falls back to terminal mode.
 
  I would which that this feature could be disabled as it caused serious
  problems when gvim is started as background task - in which case the
  now simple vim has a terminal to display but no keyboard to accept
  commands from.
 
  Martin
 
  PS: Please remember that on some operating systems gvim allways starts
  as if --nofork has been set.

 There appears to be no way to do something in this situation.  How about
 adding a GUIFailed event?  Then you can do:

   au GUIFailed * qall

 GUIFailed would be done in the same position as GUIEnter, but when it
 failed to start.

That is even cooler then my idea of having a setting as it could be used for 
more then just qall. I am thinking of others here as qall is all I could do 
to solve my problem at hand. (with solving being xhost +... or a SET 
Display ...  or whatever went wrong this time round).

Martin
-- 
Martin Krischik
mailto://[EMAIL PROTECTED]


pgp91FJSqMfBj.pgp
Description: PGP signature


Re: better recognising of tex vs plaintex filetype

2006-08-29 Thread Benji Fisher
On Sat, Aug 26, 2006 at 01:38:11AM +0200, Stefano Zacchiroli wrote:
 [ Forwarded to vim-dev, as requested by Bram. Consider both the patch
   and the suggested default change as RFCs ]
 
 Hi Bram,
   could you please consider the attached patch for filetype.vim? It
 provides better recognition of 'tex' filetypes against 'plaintex' ones.
 It looks for sectioning commands that are specific to latex (\part,
 \section, \paragraph, ...).
 
 Also, according to a comment in filetype.vim, the code distinguishing
 between 'tex' and 'plaintex' should default to 'tex', whereas, according
 to these lines:
 
  Default value, may be changed later:
 let format = exists(g:tex_flavor) ? g:tex_flavor : 'plain'
 
 I assume it defaults to 'plaintex'. Is there a reason for that or it is
 just a typo? I found the default to 'tex' much more reasonable, as most
 of people write latex these days ...
 
 What about changing it so that it matches the comment?
 
 Many thanks in advance,
 Cheers.

 I believe that Bram does not use any version of TeX himself.  I
maintain the plaintex and latex ftplugins, and I suggested the current
detection scheme (after a RFC before vim 7.0 was released).  If the
comments, documentation, and code do not agree, it is probably my fault.

 I do not think there is any reliable way to distinguish between
plain TeX and LaTeX.  After my RFC, I decided to treat plain TeX as the
default, since it is the more basic, even though I agree that LaTeX is
probably far more common now.  I suggest adding

let tex_flavor = latex

to your vimrc file.

HTH --Benji Fisher


Patch 7.0.074 (extra)

2006-08-29 Thread Bram Moolenaar

Patch 7.0.074 (extra)
Problem:Win32: tooltips were not converted from 'encoding' to Unicode.
Solution:   Set the tooltip to use Unicode and do the conversion.  Also
cleanup the code for the tab pages tooltips. (Yukihiro Nakadaira)
Files:  src/gui_w32.c, src/gui_w48.c


*** ../vim-7.0.073/src/gui_w32.cSat May  6 23:43:11 2006
--- src/gui_w32.c   Tue Aug 29 21:16:58 2006
***
*** 889,1005 
  # ifdef FEAT_MBYTE
case TTN_GETDISPINFOW:
  # endif
!   case TTN_NEEDTEXT:
! # ifdef FEAT_GUI_TABLINE
!   if (gui_mch_showing_tabline()
!((LPNMHDR)lParam)-hwndFrom ==
!  TabCtrl_GetToolTips(s_tabhwnd))
{
!   LPNMTTDISPINFO  lpdi;
!   POINT   pt;
!   static char *tt_text = NULL;
!   static int  tt_text_len = 0;
! 
!   /*
!* Mouse is over the GUI tabline. Display the tooltip
!* for the tab under the cursor
!*/
!   lpdi = (LPNMTTDISPINFO)lParam;
!   lpdi-hinst = NULL;
!   lpdi-szText[0] = '\0';
! 
!   /*
!* Get the cursor position within the tab control
!*/
!   GetCursorPos(pt);
!   if (ScreenToClient(s_tabhwnd, pt) != 0)
!   {
!   TCHITTESTINFO htinfo;
!   int idx;
  
/*
!* Get the tab under the cursor
 */
!   htinfo.pt.x = pt.x;
!   htinfo.pt.y = pt.y;
!   idx = TabCtrl_HitTest(s_tabhwnd, htinfo);
!   if (idx != -1)
{
!   tabpage_T *tp;
  
!   tp = find_tabpage(idx + 1);
!   if (tp != NULL)
{
! #  ifdef FEAT_MBYTE
!   WCHAR   *wstr = NULL;
! #  endif
!   get_tabline_label(tp, TRUE);
! #  ifdef FEAT_MBYTE
!   if (enc_codepage = 0
! (int)GetACP() != enc_codepage)
!   {
!   wstr = enc_to_ucs2(NameBuff, NULL);
!   if (wstr != NULL)
!   {
!   int wlen;
! 
!   wlen = ((int)wcslen(wstr) + 1)
! * sizeof(WCHAR);
!   if (tt_text_len  wlen)
!   {
!   tt_text = vim_realloc(tt_text,
!   wlen);
!   if (tt_text != NULL)
!   tt_text_len = wlen;
!   }
!   if (tt_text != NULL)
!   wcscpy((WCHAR *)tt_text, wstr);
!   lpdi-lpszText = tt_text;
!   vim_free(wstr);
!   }
!   }
!   if (wstr == NULL)
! #  endif
!   {
!   int len;
  
!   len = (int)STRLEN(NameBuff) + 1;
!   if (tt_text_len  len)
!   {
!   tt_text = vim_realloc(tt_text, len);
!   if (tt_text != NULL)
!   tt_text_len = len;
!   }
!   if (tt_text != NULL)
!   STRCPY(tt_text, NameBuff);
!   lpdi-lpszText = tt_text;
}
}
}
}
-   }
-   else
  # endif
-   {
  # ifdef FEAT_TOOLBAR
!   LPTOOLTIPTEXT   lpttt;
!   UINTidButton;
!   int idx;
!   vimmenu_T   *pMenu;
! 
!   lpttt = (LPTOOLTIPTEXT)lParam;
!   idButton = (UINT) lpttt-hdr.idFrom;
!   pMenu = gui_mswin_find_menu(root_menu, idButton);
!   if (pMenu)
{
!   idx = MENU_INDEX_TIP;
!   if 

Re: Netrw and cindent

2006-08-29 Thread Charles E Campbell Jr

Benji Fisher wrote:


A quick look at netrw.vba.gz (searching for swf) suggests that
this may be the problem:

fun! netrw#NetBrowseX(fname,remote)
[snip]
 if a:remote == 1
  set bh=delete bt=nofile noswf
  exe norm! \c-o
  redraw!
 endif

  call Dret(NetBrowseX)
endfun

All the other matches for swf involve either :setlocal or :let l: .
I did not see anything suspicious with cin.
 

Thanks, Benji F!  I've uploaded a netrw v103i with the latest fixes to 
my website:


 http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs  , see 
Network Oriented Reading, Writing, and Browsing.


Regards,
Chip Campbell




Patch 7.0.075

2006-08-29 Thread Bram Moolenaar

Patch 7.0.075
Problem:winsaveview() did not store the actual value of the desired cursor
column.  This could move the cursor in the matchparen plugin.
Solution:   Call update_curswant() before using the value w_curswant.
Files:  src/eval.c


*** ../vim-7.0.074/src/eval.c   Tue Aug 29 17:28:56 2006
--- src/eval.c  Tue Aug 29 21:53:26 2006
***
*** 16232,16237 
--- 16232,16238 
  #ifdef FEAT_VIRTUALEDIT
  dict_add_nr_str(dict, coladd, (long)curwin-w_cursor.coladd, NULL);
  #endif
+ update_curswant();
  dict_add_nr_str(dict, curswant, (long)curwin-w_curswant, NULL);
  
  dict_add_nr_str(dict, topline, (long)curwin-w_topline, NULL);
*** ../vim-7.0.074/src/version.cTue Aug 29 21:30:15 2006
--- src/version.c   Tue Aug 29 21:57:03 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 75,
  /**/

-- 
Women are probably the main cause of free software starvation.

 /// 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///


Patch 7.0.076

2006-08-29 Thread Bram Moolenaar

Patch 7.0.076 (after 7.0.010)
Problem:Automatic downloading of spell files only works for ftp.
Solution:   Don't add login and password for non-ftp URLs. (Alexander Patrakov)
Files:  runtime/autoload/spellfile.vim


*** ../vim-7.0.075/runtime/autoload/spellfile.vim   Sat May 13 14:29:16 2006
--- runtime/autoload/spellfile.vim  Tue Aug 29 22:17:03 2006
***
*** 1,6 
   Vim script to download a missing spell file
   Maintainer: Bram Moolenaar [EMAIL PROTECTED]
!  Last Change:2006 May 10
  
  if !exists('g:spellfile_URL')
let g:spellfile_URL = 'ftp://ftp.vim.org/pub/vim/runtime/spell'
--- 1,6 
   Vim script to download a missing spell file
   Maintainer: Bram Moolenaar [EMAIL PROTECTED]
!  Last Change:2006 Aug 29
  
  if !exists('g:spellfile_URL')
let g:spellfile_URL = 'ftp://ftp.vim.org/pub/vim/runtime/spell'
***
*** 110,118 
endif
  endfunc
  
!  Read fname from the ftp server.
  function! spellfile#Nread(fname)
!   let machine = substitute(g:spellfile_URL, 'ftp://\([^/]*\).*', '\1', '')
!   let dir = substitute(g:spellfile_URL, 'ftp://[^/]*/\(.*\)', '\1', '')
!   exe 'Nread ' . machine . ' anonymous vim7user ' . dir . '/' . a:fname . ''
  endfunc
--- 110,123 
endif
  endfunc
  
!  Read fname from the server.
  function! spellfile#Nread(fname)
!   if g:spellfile_URL =~ '^ftp://'
!  for an ftp server use a default login and password to avoid a prompt
! let machine = substitute(g:spellfile_URL, 'ftp://\([^/]*\).*', '\1', '')
! let dir = substitute(g:spellfile_URL, 'ftp://[^/]*/\(.*\)', '\1', '')
! exe 'Nread ' . machine . ' anonymous vim7user ' . dir . '/' . a:fname . 
''
!   else
! exe 'Nread ' g:spellfile_URL . '/' . a:fname
!   endif
  endfunc
*** ../vim-7.0.075/src/version.cTue Aug 29 21:59:25 2006
--- src/version.c   Tue Aug 29 22:31:45 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 76,
  /**/

-- 
This sentence is not sure that it exists, but if it does, it will
certainly consider the possibility that other sentences exist.

 /// 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///