Skip to content

Instantly share code, notes, and snippets.

@ku1ik
Created March 10, 2010 21:20
Show Gist options
  • Save ku1ik/328418 to your computer and use it in GitHub Desktop.
Save ku1ik/328418 to your computer and use it in GitHub Desktop.
require "korundum4"
class MyHighlighter < Qt::SyntaxHighlighter
@@data = []
def highlightBlock(line)
old_data = currentBlockUserData
new_data = Qt::TextBlockUserData.new
@@data << new_data
setCurrentBlockUserData(new_data)
@@data.delete(old_data) if @@data.include?(old_data)
end
end
class MyEdit < Qt::TextEdit
def initialize
super
@highlighter = MyHighlighter.new(document)
end
end
app = Qt::Application.new(ARGV)
w = MyEdit.new
w.show
app.exec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment