Skip to content

Instantly share code, notes, and snippets.

@tsutsui
Created June 11, 2018 14:22
Show Gist options
  • Save tsutsui/5c7ae61a3d28084632270f2b2d18273d to your computer and use it in GitHub Desktop.
Save tsutsui/5c7ae61a3d28084632270f2b2d18273d to your computer and use it in GitHub Desktop.
「mikutter 3.6 で Twitter 投稿欄の残り文字数を 280文字対応にする修正 https://dev.mikutter.hachune.net/issues/1153 をモンキーパッチでしのぐプラグイン https://gist.github.com/tsutsui/5e9ceafa52ab6830257aaeeccdd77411 」の mikutter 3.7.2 対応版 (差分はこちらのプラグイン https://cobodo.hateblo.jp/entry/2018/06/11/mikutter_justsize_%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%E3%81%8C_mikutter_3.7.2%E5%A…
# -*- coding: utf-8 -*-
# Usage:
# mkdir -p ~/.mikutter/plugin
# cp [this file] ~/.mikutter/plugin/remain_charcount_280.rb
# mon-chi!
class Gtk::PostBox
def update_remain_charcount
if not widget_post.destroyed?
text = widget_post.buffer.text + UserConfig[:footer]
tweet = Twitter::TwitterText::Validation.parse_tweet(text)
remain = 280 - tweet[:weighted_length]
@remain.set_text(remain.to_s) if not @remain.destroyed?
end
end
end
Plugin.create :remain_charcount_280 do
# nothing?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment