[TxMt] New "Unicode" bundle in the Review trunk

Alexey Blinov nilcolor at gmail.com
Mon Jun 2 13:26:16 UTC 2008


Sorry but do i miss something? I have that error
-------------------------
Traceback (most recent call last):
  File "/tmp/temp_textmate.0WYiu4", line 50, in <module>
    result=dialog.menu([re.sub(r"(?=[^a-zA-Z0-9_ .\/\-\x7F-\xFF\n])",
r'\\', a) + "\t" + unicodedata.name(a, "U+%04X" % ord(a)) for a in
suggestions])
  File "/Applications/TextMate.app/Contents/SharedSupport/Support/lib/dialog.py",
line 51, in menu
    plist = to_plist(menu)
UnboundLocalError: local variable 'menu' referenced before assignment
-------------------------
when try to "Convert to Greek..." or "Convert to Similar..."

Alexey Blinov

On Mon, Jun 2, 2008 at 3:09 AM, Hans-Jörg Bibiko <bibiko at eva.mpg.de> wrote:
> On 02.06.2008, at 00:04, Walter Dörwald wrote:
>>
>> Here's another patch (against the current version). It shows both the
>> codepoint and the name.
>>
>> BTW, you don't have to use a regular expression to split a string into
>> characters, simply iterating through it does the trick:
>>
>> Index: Commands/Show Unicode Names.tmCommand
>> -for a in re.compile("(?um)(.)").split(unicode(sys.stdin.read(),
>> "UTF-8")):
>> -     if (len(a)==1) and (a != '\n'):
>> -          res = a + " : " + unicodedata.name(a, "U+%04X" % ord(a))
>> +for a in unicode(sys.stdin.read(), "UTF-8"):
>> +     if a != '\n':
>> +          res = u"%s : U+%04X" % (a, ord(a))
>> +          name = unicodedata.name(a, None)
>> +          if name:
>> +              res += u" : %s" % name
>>           print res.encode("UTF-8")</string>
>>        <key>fallbackInput</key>
>>        <string>character</string>
>
> Thanks! Just committed to the trunk.
>
>> >> Furthermore it would be great if this script could display all
>> >> information there is in the Python Unicode database, i.e. stuff like
>> >>
>> >>    unicodedata.category()
>> >>    unicodedata.bidrectional()
>> >>    unicodedata.decimal()
>> > Yes. I have such a script in Perl which also shows up info about Unicode
>> > code points etc.
>
> Just added to the bundle a prototype of 'Show Unicode Properties'
>
>
>> Another problem: Using Ctrl-Shift-U as the shortcut hides the "Convert To
>> Lowercase" command.
>
> Yes. This was a bad key combo. I changed it temporally to CTRL+OPT+APPLE+U
>
> BTW: Can Python handle Unicode codepoints which are specified in Unicode
> pane B, meaning greater U+FFFF? I tried it out. I found out that Python uses
> UTF-16 internally.
> But e.g. UCS hex: 20000 ; UTF-16: D840 DC00 .
> I can print that character to TM but unicodedata fails because it expects
> one character but not two (?)
>
> Servus,
>
> --der Hans
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>


More information about the textmate mailing list