Logo Search packages:      
Sourcecode: zim version File versions  Download package

def zim::gui::pageview::TextBuffer::do_insert_text (   self,
  end,
  string,
  length 
)

Signal handler for insert-text signal

Definition at line 937 of file pageview.py.

00937                                                    :
            '''Signal handler for insert-text signal'''
            # First call parent for the actual insert
            if string == '\n':
                  # Break tags that are not allowed to span over multiple lines
                  self._editmode_tags = filter(_is_not_style_tag, self._editmode_tags)
                  self._editmode_tags = filter(_is_not_link_tag, self._editmode_tags)
                  # TODO make this more robust for multiline inserts
            elif string in CHARS_END_OF_WORD:
                  # Break links if end-of-word char is typed at end of a link
                  # without this you not insert text behind a link e.g. at the end of a line
                  links = filter(_is_link_tag, self._editmode_tags)
                  if links and end.ends_tag(links[0]):
                        self._editmode_tags = filter(_is_not_link_tag, self._editmode_tags)
                        # TODO this should go into the TextView, not here
                        # Now it goes OK only because we only check single char inserts, but would break
                        # for multi char inserts from the view - fixing that here breaks insert parsetree

            gtk.TextBuffer.do_insert_text(self, end, string, length)

            # Apply current text style
            length = len(unicode(string))
                  # default function argument gives byte length :S
            start = end.copy()
            start.backward_chars(length)
            self.remove_all_tags(start, end)
            for tag in self._editmode_tags:
                  self.apply_tag(tag, start, end)

      def do_delete_range(self, start, end):


Generated by  Doxygen 1.6.0   Back to index