[patch] "ga" on ^J shows 0x0d instead of 0x0a if 'ff' is "mac"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch] "ga" on ^J shows 0x0d instead of 0x0a if 'ff' is "mac"

Lech Lorens
The attached patch fixes the problem with displaying the value of the NL
character in files edited with 'ff' set to "mac". The solution was to
replace CARs with NLs when printing their values for mac-format files.

--
Cheers,
Lech

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


Index: runtime/doc/todo.txt
===================================================================
diff -c "runtime/doc/.svn/text-base/todo.txt.svn-base" "runtime/doc/todo.txt"
*** runtime/doc/.svn/text-base/todo.txt.svn-base 2009-01-04 15:08:21.000000000 +0100
--- runtime/doc/todo.txt 2009-01-04 15:18:01.000000000 +0100
***************
*** 414,422 ****
 
  Mac: Using gvim: netrw window disappears. (Nick Lo, 2006 Jun 21)
 
- When 'ff' is "mac" then "ga" on a ^J shows 0x0d instead of 0x0a.  Compare with
- using "ga" on a NUL when 'ff' is "unix". (Andy Wokula, 2008 Jul 16)
-
  Add an option to specify the character to use when a double-width character is
  moved to the next line.  Default '>', set to a space to blank it out.  Check
  that char is single width when it's set (compare with 'listchars').
--- 414,419 ----
Index: src/ex_cmds.c
===================================================================
diff -c "src/.svn/text-base/ex_cmds.c.svn-base" "src/ex_cmds.c"
*** src/.svn/text-base/ex_cmds.c.svn-base 2009-01-04 15:08:09.000000000 +0100
--- src/ex_cmds.c 2009-01-04 15:10:10.000000000 +0100
***************
*** 49,54 ****
--- 49,55 ----
      exarg_T *eap;
  {
      int c;
+     int cvalue;
      char buf1[20];
      char buf2[20];
      char_u buf3[7];
***************
*** 92,100 ****
  else
  #endif
     buf2[0] = NUL;
  vim_snprintf((char *)IObuff, IOSIZE,
  _("<%s>%s%s  %d,  Hex %02x,  Octal %03o"),
!   transchar(c), buf1, buf2, c, c, c);
  #ifdef FEAT_MBYTE
  if (enc_utf8)
     c = cc[ci++];
--- 93,105 ----
  else
  #endif
     buf2[0] = NUL;
+ if (CAR == c && EOL_MAC == get_fileformat(curbuf))
+    cvalue = NL;
+ else
+    cvalue = c;
  vim_snprintf((char *)IObuff, IOSIZE,
  _("<%s>%s%s  %d,  Hex %02x,  Octal %03o"),
!   transchar(c), buf1, buf2, cvalue, cvalue, cvalue);
  #ifdef FEAT_MBYTE
  if (enc_utf8)
     c = cc[ci++];
Reply | Threaded
Open this post in threaded view
|

Re: [patch] "ga" on ^J shows 0x0d instead of 0x0a if 'ff' is "mac"

Bram Moolenaar


Lech Lorens wrote:

> The attached patch fixes the problem with displaying the value of the NL
> character in files edited with 'ff' set to "mac". The solution was to
> replace CARs with NLs when printing their values for mac-format files.

Thanks.  I'll look into it later.

--
Why I like vim:
> I like VIM because, when I ask a question in this newsgroup, I get a
> one-line answer.  With xemacs, I get a 1Kb lisp script with bugs in it ;-)

 /// Bram Moolenaar -- [hidden email] -- 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
-~----------~----~----~----~------~----~------~--~---