Last active
June 11, 2018 14:22
-
-
Save tsutsui/5e9ceafa52ab6830257aaeeccdd77411 to your computer and use it in GitHub Desktop.
mikutter 3.6 で Twitter 投稿欄の残り文字数を 280文字対応にする修正 https://dev.mikutter.hachune.net/issues/1153 をモンキーパッチでしのぐプラグイン (要 twitter-text gem 2.1.0 なので twitter-text 1.14.7 を使っている deiban 等の環境では動きません; 3.7.2対応版→ https://gist.github.com/tsutsui/5c7ae61a3d28084632270f2b2d18273d )
This file contains hidden or 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 -*- | |
| # Usage: | |
| # mkdir -p ~/.mikutter/plugin | |
| # cp [this file] ~/.mikutter/plugin/remain_charcount_280.rb | |
| # mon-chi! | |
| class Gtk::PostBox | |
| def remain_charcount | |
| if not widget_post.destroyed? | |
| text = trim_hidden_regions(widget_post.buffer.text + UserConfig[:footer]) | |
| tweet = Twitter::TwitterText::Validation.parse_tweet(text) | |
| return 280 - tweet[:weighted_length] | |
| 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