2

vim is totally confused with soft hyphen characters (0xAD) in the Mac OS X Terminal. It is not displayed, although the "virtual column" number is right, the insertion is messed up.

So if I have a line with a-b, where - is the soft hyphen, it shows as ab in vim, and when I try to replace the character b by c, I obtain instead acb. Quite confusing.

The same happens with pico, but not with emacs.

Is there a way to fix this?

I'm using vim in the Terminal of Mac OS X.

Olivier Verdier
  • 46,998
  • 29
  • 98
  • 90
  • Just tried to edit a file with soft hyphen characters. It works for me on Urxvt (with Monaco font) under Linux. The soft hyphen is displayed as an ordinary hyphen (while `ga` on it says `<­> 173, Hex 00ad, Octal 255`, of course). So I think it's an issue of a specific terminal (and/or a specific font probably). – ib. Nov 27 '10 at 11:46
  • Good point. It's not the font, because it works with MacVim, so maybe it's some quirk with the Mac OS X Terminal? In fact it doesn't seem to be vim specific either. – Olivier Verdier Nov 27 '10 at 16:23
  • What encoding do you use? If 0xAD is leading character of multibyte, it may not be shown. – mattn Jun 23 '11 at 04:16
  • I just ran into this problem. Curiously, in MacVim while it doesn't screw up the column count, the soft hyphen causes MacVim to stop drawing characters on that line until it wraps. Moving the insertion point over the characters manually causes them to render one by one, but anything that causes the line to redraw makes them disappear again. – Lily Ballard Aug 22 '11 at 23:03

2 Answers2

0

Unicode assigns the U+00AD SOFT HYPHEN character East Asian Width Ambiguous, which means it occupies one or two terminal columns—it should be rendered visibly—but Terminal uses the full Unicode text renderer available in OS X, which doesn't render soft hyphens unless it's performing line breaking.

Interestingly, emacs displays soft hyphens by sending a hyphen to the terminal instead of depending on it to render the soft hyphen. vim just sends the soft hyphen to the terminal and assumes it will be displayed.

As of OS X Mountain Lion 10.8, Terminal displays soft hyphens.

Chris Page
  • 18,263
  • 4
  • 39
  • 47
0

iTerm2 does not have this issue with soft hyphens.

@Kevin Ballard If you turn on the "Experimental Renderer" in MacVim's preferences, MacVim renders the soft hyphens correctly.

Araxia
  • 1,136
  • 11
  • 22