diff options
author | Jason Chu <jchu@xentac.net> | 2012-05-15 09:51:58 -0700 |
---|---|---|
committer | Jason Chu <jchu@xentac.net> | 2012-05-15 09:51:58 -0700 |
commit | 3dfad85645b35ce410efac2f3c5b551419520394 (patch) | |
tree | 5b65e4755dc84ab9cdc0c6d35373326ccd3a3434 | |
parent | f2eae5c0bb61aea39dbc623500bc29afbbb17a8d (diff) | |
download | awesompd-3dfad85645b35ce410efac2f3c5b551419520394.tar.gz awesompd-3dfad85645b35ce410efac2f3c5b551419520394.tar.bz2 |
Fix support for disabling scrolling
-rw-r--r-- | awesompd.lua | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/awesompd.lua b/awesompd.lua index faa1a97..b0be721 100644 --- a/awesompd.lua +++ b/awesompd.lua @@ -833,18 +833,20 @@ end -- Scroll the given text by the current number of symbols. function awesompd:scroll_text(text) local result = text - if self.output_size < utf8len(text) then - text = text .. " - " - if self.scroll_pos + self.output_size - 1 > utf8len(text) then - result = utf8sub(text, self.scroll_pos) - result = result .. utf8sub(text, 1, self.scroll_pos + self.output_size - 1 - utf8len(text)) - self.scroll_pos = self.scroll_pos + 1 - if self.scroll_pos > utf8len(text) then - self.scroll_pos = 1 - end - else - result = utf8sub(text, self.scroll_pos, self.scroll_pos + self.output_size - 1) - self.scroll_pos = self.scroll_pos + 1 + if self.scrolling then + if self.output_size < utf8len(text) then + text = text .. " - " + if self.scroll_pos + self.output_size - 1 > utf8len(text) then + result = utf8sub(text, self.scroll_pos) + result = result .. utf8sub(text, 1, self.scroll_pos + self.output_size - 1 - utf8len(text)) + self.scroll_pos = self.scroll_pos + 1 + if self.scroll_pos > utf8len(text) then + self.scroll_pos = 1 + end + else + result = utf8sub(text, self.scroll_pos, self.scroll_pos + self.output_size - 1) + self.scroll_pos = self.scroll_pos + 1 + end end end return result |