Hi,

Attached patch fixes a low priority cosmetic bug.

When doing ":cs help", messages are properly aligned
in English but are misaligned on some other languages
when using utf-8 encoding. So it looks ugly.

Misalignment buglet happens in languages which uses
non ASCII characters and happens at least for French
and Esperanto for example because of accentuated
characters.

The problem happens because cs_help() in if_cscope.c
uses "%-30s" format to align text but "%-30s" prints
strings on 30 *bytes* rather than 30 characters (or
30 screen cells to be more exact).

Attached patch fixes it.

See screenshot before fix (notice how strings are misaligned):
  http://dominique.pelle.free.fr/pic/align-buglet-eo.png

And after fix (strings correctly aligned):
  http://dominique.pelle.free.fr/pic/align-buglet-eo-fixed.png

Cheers
-- Dominique

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

Index: if_cscope.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/if_cscope.c,v
retrieving revision 1.32
diff -c -r1.32 if_cscope.c
*** if_cscope.c	25 Aug 2008 02:35:59 -0000	1.32
--- if_cscope.c	17 Jan 2009 22:29:26 -0000
***************
*** 1177,1184 ****
      (void)MSG_PUTS(_("cscope commands:\n"));
      while (cmdp->name != NULL)
      {
! 	(void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
! 				      cmdp->name, _(cmdp->help), cmdp->usage);
  	if (strcmp(cmdp->name, "find") == 0)
  	    MSG_PUTS(_("\n"
  		       "       c: Find functions calling this function\n"
--- 1177,1192 ----
      (void)MSG_PUTS(_("cscope commands:\n"));
      while (cmdp->name != NULL)
      {
! 	char *help = _(cmdp->help);
! 	int sz = vim_strsize((char_u *)help);
! 	int space_cnt = 30 - sz;
! 	if (space_cnt < 0)
! 	    space_cnt = 0;
! 	/* Use %*s rather than %30s to ensure proper alignment in utf-8 */
! 	(void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"),
! 				      cmdp->name,
! 				      help, space_cnt, " ",
! 				      cmdp->usage);
  	if (strcmp(cmdp->name, "find") == 0)
  	    MSG_PUTS(_("\n"
  		       "       c: Find functions calling this function\n"

Raspunde prin e-mail lui