header nav via </>: can now get current focus post
parent
eb8e4fa844
commit
bf64d64071
|
@ -176,7 +176,7 @@ default_prefs = {
|
||||||
|
|
||||||
bars = {
|
bars = {
|
||||||
"index": "[RET]Open [C]ompose [R]efresh [O]ptions [?]Help [Q]uit",
|
"index": "[RET]Open [C]ompose [R]efresh [O]ptions [?]Help [Q]uit",
|
||||||
"thread": "[C]ompose [RET]Interact [Q]Back [R]efresh [0-9]Goto [B/T]End [?]Help"
|
"thread": "[C]ompose [RET]Interact [Q]Back [R]efresh [0-9]Goto [B/T]End [<>]Jump [?]Help"
|
||||||
}
|
}
|
||||||
|
|
||||||
colormap = [
|
colormap = [
|
||||||
|
@ -675,13 +675,36 @@ class App(object):
|
||||||
self.index()
|
self.index()
|
||||||
|
|
||||||
|
|
||||||
|
def get_focus_post(self):
|
||||||
|
pos = self.box.get_focus_path()[0]
|
||||||
|
if self.mode == "thread":
|
||||||
|
return (pos - (pos % 5)) // 5
|
||||||
|
return pos
|
||||||
|
|
||||||
|
|
||||||
|
def header_jump_next(self):
|
||||||
|
if self.mode == "index":
|
||||||
|
return self.box.keypress(self.loop.screen_size, "down")
|
||||||
|
post = self.get_focus_post()
|
||||||
|
if post != self.thread["reply_count"]:
|
||||||
|
self.goto_post(post + 1)
|
||||||
|
|
||||||
|
|
||||||
|
def header_jump_previous(self):
|
||||||
|
if self.mode == "index":
|
||||||
|
return self.box.keypress(self.loop.screen_size, "up")
|
||||||
|
post = self.get_focus_post()
|
||||||
|
if post != 0:
|
||||||
|
self.goto_post(post - 1)
|
||||||
|
|
||||||
|
|
||||||
def goto_post(self, number):
|
def goto_post(self, number):
|
||||||
if self.mode != "thread":
|
if self.mode != "thread":
|
||||||
return
|
return
|
||||||
|
|
||||||
size = self.loop.screen_size
|
size = self.loop.screen_size
|
||||||
new_pos = number*5
|
new_pos = number * 5
|
||||||
cur_pos = self.box.get_cursor_coords(size)[0]
|
cur_pos = self.box.get_focus_path()[0]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.box.change_focus(
|
self.box.change_focus(
|
||||||
|
@ -1477,6 +1500,12 @@ class ActionBox(urwid.ListBox):
|
||||||
elif key == "ctrl l":
|
elif key == "ctrl l":
|
||||||
wipe_screen()
|
wipe_screen()
|
||||||
|
|
||||||
|
elif key == ">":
|
||||||
|
app.header_jump_next()
|
||||||
|
|
||||||
|
elif key == "<":
|
||||||
|
app.header_jump_previous()
|
||||||
|
|
||||||
elif keyl in ["h", "left"]:
|
elif keyl in ["h", "left"]:
|
||||||
app.back()
|
app.back()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue