30 lines
906 B
Python
30 lines
906 B
Python
|
import os, commands, re, tempfile
|
||
|
from subprocess import Popen, PIPE, STDOUT
|
||
|
|
||
|
import buffer, default, dirutil, lex, regex, util, window
|
||
|
from point import Point
|
||
|
|
||
|
from method import Method, Argument, arg
|
||
|
|
||
|
class Utf8Get(Method):
|
||
|
def _execute(self, w, **vargs):
|
||
|
p = w.logical_cursor()
|
||
|
c = w.buffer.get_substring(p, p.add(1, 0))
|
||
|
w.set_error(repr(c))
|
||
|
|
||
|
class Utf8Describe(Method):
|
||
|
def _execute(self, w, **vargs):
|
||
|
w.set_error("not implemented")
|
||
|
|
||
|
class Utf8Insert(Method):
|
||
|
'''insert the specified UTF-8 character into the buffer'''
|
||
|
args = [arg("data", t=type(""), p="Data: ",
|
||
|
h="the UTF-8 escaped data to use to use")]
|
||
|
def _execute(self, w, **vargs):
|
||
|
s = "u'" + vargs['data'] + "'"
|
||
|
try:
|
||
|
u = eval(s, {}, {})
|
||
|
w.insert_string_at_cursor(u)
|
||
|
except:
|
||
|
w.set_error("invalid: %s" % vargs['data'])
|