diff options
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r-- | gtk2_ardour/utils.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 9aba168ef1..b8d7569414 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -1016,3 +1016,21 @@ pixbuf_from_ustring(const ustring& name, Pango::FontDescription* font, int clip_ return buf; } + +/** Replace _ with __ in a string; for use with menu item text to make underscores displayed correctly */ +string +escape_underscores (string const & s) +{ + string o; + string::size_type const N = s.length (); + + for (string::size_type i = 0; i < N; ++i) { + if (s[i] == '_') { + o += "__"; + } else { + o += s[i]; + } + } + + return o; +} |