summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMadhur Garg <madhurgarg96@gmail.com>2019-06-06 03:46:09 +0530
committerMadhur Garg <madhurgarg96@gmail.com>2019-06-20 03:09:30 +0530
commitd8f53e82662fb2d9e445605b4552538e3ef4187c (patch)
tree947eb764a3061c6e0bde7c4a504c0585a6f1f0e3
parent0d2e2b084b5df92cdeef75349fd1a6ea1a2223f0 (diff)
downloadpoezio-d8f53e82662fb2d9e445605b4552538e3ef4187c.tar.gz
poezio-d8f53e82662fb2d9e445605b4552538e3ef4187c.tar.bz2
poezio-d8f53e82662fb2d9e445605b4552538e3ef4187c.tar.xz
poezio-d8f53e82662fb2d9e445605b4552538e3ef4187c.zip
Corrected code duplication
-rw-r--r--poezio/tabs/basetabs.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index a5e4bf4a..bf2ef9d9 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -796,10 +796,8 @@ class ChatTab(Tab):
/sb
"""
if args is None or len(args) == 0:
- self.text_win.scroll_down(len(self.text_win.built_lines))
- self.core.refresh_window()
- self.core.information('Command Usage: clear goto home end status', 'Info')
- elif len(args) == 1:
+ args = ['end']
+ if len(args) == 1:
if args[0] == 'end':
self.text_win.scroll_down(len(self.text_win.built_lines))
self.core.refresh_window()
@@ -826,15 +824,12 @@ class ChatTab(Tab):
self.text_win.scroll_down(int(scroll_len))
self.core.refresh_window()
return
- elif int(args[1]):
- if len(self.text_win.built_lines) - self.text_win.height >= int(args[1]):
- self.text_win.pos = len(self.text_win.built_lines) - self.text_win.height - int(args[1]) + 1
- self.core.refresh_window()
- return
- else:
- self.text_win.pos = 0
- self.core.refresh_window()
- return
+ else:
+ self.text_win.pos = 0
+ self.core.refresh_window()
+ return
+ elif args[1] == '0':
+ args = ['home']
text_buffer = self._text_buffer
line_count=0
for message in text_buffer.messages: