~ubuntu-branches/debian/sid/calibre/sid

« back to all changes in this revision

Viewing changes to src/calibre/gui2/tweak_book/editor/syntax/base.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-02-27 07:48:06 UTC
  • mto: This revision was merged to the branch mainline in revision 74.
  • Revision ID: package-import@ubuntu.com-20140227074806-64wdebb3ptosxhhx
Tags: upstream-1.25.0+dfsg
ImportĀ upstreamĀ versionĀ 1.25.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
    def highlightBlock(self, text):
54
54
        try:
55
55
            state = self.previousBlockState()
 
56
            self.setCurrentBlockUserData(None)  # Ensure that any stale user data is discarded
56
57
            if state == -1:
57
58
                state = 0
58
59
            state = self.state_class(state)
 
60
            state.get_user_data, state.set_user_data = self.currentBlockUserData, self.setCurrentBlockUserData
59
61
            for i, num, fmt in run_loop(state, self.state_map, self.formats, unicode(text)):
60
62
                if fmt is not None:
61
63
                    self.setFormat(i, num, fmt)
63
65
        except:
64
66
            import traceback
65
67
            traceback.print_exc()
 
68
        finally:
 
69
            QApplication.processEvents()  # Try to keep the editor responsive to user input
66
70