[PATCH] unicode: fix lineedit navigation over wide and combining characters

Rob Landley rob at landley.net
Tue Apr 27 04:49:41 UTC 2010


On Wednesday 21 April 2010 16:22:47 Tomas Heinrich wrote:
>         }
> +#if ENABLE_UNICODE_SUPPORT
> +       c = validate_wc(c);
> +#endif
> +#if ENABLE_UNICODE_COMBINING_WCHARS || ENABLE_UNICODE_WIDE_WCHARS
> +       cmdedit_x += wcwidth(c);
> +#else
> +       cmdedit_x++;
> +#endif
>  #if ENABLE_FEATURE_NONPRINTABLE_INVERSE_PUT

No need for #ifdefs

  if (ENABLE_UNICODE_SUPPORT) c = validate_wc(c);
  if (ENABLE_UNICODE_COMBINING_WCHARS || ENABLE_UNICODE_WIDE_WCHARS)
    cmedit_x += wcwidth(c);
  else cmdedit_x++;

if (0) drops out due to the compiler's dead code elimination.  And C99 
requires that (0 || 0) gets simplified at compile time to (0)...

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds


More information about the busybox mailing list