예제 #1
0
    def expand_abbreviation(self):

        zen_core.set_caret_placeholder(self.placeholder)

        abbr = zen_actions.find_abbreviation(self)

        if abbr:

            if self.snippet_document[self.view]:
                self.expand_with_snippet(abbr)

            else:
                self.buffer.begin_user_action()
                content = zen_core.expand_abbreviation(abbr, self.get_syntax(),
                                                       self.get_profile_name())
                if content:
                    content = content.replace(self.placeholder, '')
                    content = re.sub('\$\d+|\$\{\d+:[^\}]*\}', '', content)
                    unused, offset_end = self.get_selection_range()
                    self.replace_content(content, offset_end - len(abbr),
                                         offset_end)
                    self.start_edit()
                self.buffer.end_user_action()

        zen_core.set_caret_placeholder('')
예제 #2
0
	def wrap_with_abbreviation(self):

		zen_core.set_caret_placeholder(self.placeholder)
		self.save_selection()

		done, self.last_wrap = zen_dialog.main(self, self.window, self.callback_wrap_with_abbreviation, self.last_wrap, True)

		if done and not self.snippet_document[self.view]:
			self.start_edit()

		zen_core.set_caret_placeholder('')
예제 #3
0
    def wrap_with_abbreviation(self):

        zen_core.set_caret_placeholder(self.placeholder)
        self.save_selection()

        done, self.last_wrap = zen_dialog.main(self, self.window, self.callback_wrap_with_abbreviation, self.last_wrap, True)

        if done and not self.snippet_document[self.view]:
            self.start_edit()

        zen_core.set_caret_placeholder('')
예제 #4
0
	def __init__(self, window):

		self.window = window

		self.last_wrap = ''
		self.last_expand = ''
		self.last_lorem_ipsum = 'list 5*5'

		self.placeholder = zen_core.get_caret_placeholder()
		zen_core.set_caret_placeholder('')		

		self.html_navigation = None
		self.snippet_document = {}
예제 #5
0
    def __init__(self, window):

        self.window = window

        self.last_wrap = ''
        self.last_expand = ''
        self.last_lorem_ipsum = 'list 5*5'

        self.placeholder = zen_core.get_caret_placeholder()
        zen_core.set_caret_placeholder('')

        self.html_navigation = None
        self.snippet_document = {}
예제 #6
0
	def expand_abbreviation(self):

		zen_core.set_caret_placeholder(self.placeholder)
		
		abbr = zen_actions.find_abbreviation(self)

		if abbr:

			if self.snippet_document[self.view]:
				self.expand_with_snippet(abbr)

			else:
				self.buffer.begin_user_action()
				content = zen_core.expand_abbreviation(abbr, self.get_syntax(), self.get_profile_name())
				if content:
					content = content.replace(self.placeholder, '')
					content = re.sub('\$\d+|\$\{\d+:[^\}]*\}', '', content)
					unused, offset_end = self.get_selection_range()
					self.replace_content(content, offset_end - len(abbr), offset_end)
					self.start_edit()
				self.buffer.end_user_action()

		zen_core.set_caret_placeholder('')
예제 #7
0
	def set_context(self, context):
		"""
		Setup underlying editor context. You should call this method
		<code>before</code> using any Zen Coding action.
		@param context: context object
		"""
		self.context = context
#		default_locale = locale.getdefaultlocale()[0]
#		lang = re.sub(r'_[^_]+$', '', default_locale)
		from zen_core import set_caret_placeholder, set_variable
		set_caret_placeholder('')
#		if lang != default_locale:
#			set_variable('lang', lang)
#			set_variable('locale', default_locale.replace('_', '-'))
#		else:
#			set_variable('lang', default_locale)
#			set_variable('locale', default_locale)
		self.encoding = "utf8" # self.document.get_encoding().get_charset()
		set_variable('charset', self.encoding)
		if self.__view.get_insert_spaces_instead_of_tabs():
			set_variable('indentation', " " * self.__view.get_tab_width())
		else:
			set_variable('indentation', "\t")
		return
예제 #8
0
    def set_context(self, context):
        """
		Setup underlying editor context. You should call this method
		<code>before</code> using any Zen Coding action.
		@param context: context object
		"""
        self.context = context
        #		default_locale = locale.getdefaultlocale()[0]
        #		lang = re.sub(r'_[^_]+$', '', default_locale)
        from zen_core import set_caret_placeholder, set_variable
        set_caret_placeholder('')
        #		if lang != default_locale:
        #			set_variable('lang', lang)
        #			set_variable('locale', default_locale.replace('_', '-'))
        #		else:
        #			set_variable('lang', default_locale)
        #			set_variable('locale', default_locale)
        self.encoding = "utf8"  # self.document.get_encoding().get_charset()
        set_variable('charset', self.encoding)
        if self.__view.get_insert_spaces_instead_of_tabs():
            set_variable('indentation', " " * self.__view.get_tab_width())
        else:
            set_variable('indentation', "\t")
        return
예제 #9
0
 def __init__(self):
     self.last_wrap = ''
     self.last_expand = ''
     zen_core.set_caret_placeholder('')
예제 #10
0
 def __init__(self):
     self.last_wrap = ''
     self.last_expand = ''
     zen_core.set_caret_placeholder('')
예제 #11
0
 def __init__(self):
     self.last_wrap = ""
     self.last_expand = ""
     zen_core.set_caret_placeholder("")