Last active
August 29, 2015 14:03
-
-
Save primenumber/df71429a1a9a8c23d450 to your computer and use it in GitHub Desktop.
勝手に短冊になるmikutterプラグイン
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 | |
Plugin.create(:tanzaku) do | |
filter_gui_postbox_post do |gui_postbox| | |
buf = Plugin.create(:gtk).widgetof(gui_postbox).widget_post.buffer | |
text = buf.text | |
str = "┏┷┓\n┃ ┃\n┃" | |
text.each_char {|char| str += char + "┃\n┃"} | |
str += " ┃\n┗━┛\n" | |
buf.text = str | |
[gui_postbox] | |
end | |
end |
#-*- coding: utf-8
Plugin.create(:tanzaku) do
UserConfig[:tanzaku_ni_suru] ||= true
settings "短冊" do
boolean '短冊にする', :tanzaku_ni_suru
end
filter_gui_postbox_post do |gui_postbox|
buf = Plugin.create(:gtk).widgetof(gui_postbox).widget_post.buffer
text = buf.text
if UserConfig[:tanzaku_ni_suru]
to = nil
if /^@[a-zA-Z0-9_]* / =~ text
tmp = text.split(" ", 2)
to = tmp[0]
text = tmp[1]
end
str = ""
str = to unless to.nil?
str += "\n" unless to.nil?
str += "┏┷┓\n┃ ┃\n┃"
text.each_char {|char| str += char + "┃\n┃"}
str += " ┃\n┗━┛\n"
buf.text = str
end
[gui_postbox]
end
end
リプライだと変更しないようにしました
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
設定つけました