Project

General

Profile

提案 #1153 » gtk_postbox.rb.diff

Izumi Tsutsui, 2018-01-07 22:34

View differences:

mikutter/core/mui/gtk_postbox.rb 2018-01-07 20:19:31.000000000 +0900
307 307
    def remain_charcount
308 308
      if not widget_post.destroyed?
309 309
        text = trim_hidden_regions(widget_post.buffer.text + UserConfig[:footer])
310
        Twitter::TwitterText::Extractor.extract_urls(text).map{|url|
311
          if url.length < posted_url_length(url)
312
            -(posted_url_length(url) - url.length)
313
          else
314
            url.length - posted_url_length(url) end
315
        }.inject(140 - text.size, &:+)
316
      end end
310
        tweet = Twitter::TwitterText::Validation.parse_tweet(text)
311
        return 280 - tweet[:weighted_length]
312
      end
313
    end
317 314

  
318 315
    def trim_hidden_regions(text)
319 316
      trim_hidden_header(trim_hidden_footer(text))
(1-1/2)