Compare commits

...

3 commits

Author SHA1 Message Date
dece 4da3081ef6 browser: avoid crash if mouse support is off 2021-05-31 17:43:37 +02:00
dece 115fd43f09 browser: support arrows and page {up,down} 2021-05-31 16:30:26 +02:00
dece 2ea8f60739 welcome: minor changes 2021-05-30 23:29:18 +02:00
3 changed files with 24 additions and 15 deletions

View file

@ -130,7 +130,9 @@ class Browser:
self.screen.clear() self.screen.clear()
self.screen.refresh() self.screen.refresh()
curses.mousemask(curses.ALL_MOUSE_EVENTS) mousemask = curses.mousemask(curses.ALL_MOUSE_EVENTS)
if mousemask == 0:
logging.error("Could not enable mouse support.")
curses.curs_set(0) curses.curs_set(0)
init_colors() init_colors()
@ -186,19 +188,19 @@ class Browser:
self.quick_command("") self.quick_command("")
elif char == ord("r"): elif char == ord("r"):
self.reload_page() self.reload_page()
elif char == ord("h"): elif char == ord("h") or char == curses.KEY_LEFT:
self.scroll_page_horizontally(-3) self.scroll_page_horizontally(-3)
elif char == ord("H"): elif char == ord("H"):
self.scroll_whole_page_left() self.scroll_whole_page_left()
elif char == ord("j"): elif char == ord("j") or char == curses.KEY_DOWN:
self.scroll_page_vertically(3) self.scroll_page_vertically(3)
elif char == ord("J"): elif char == ord("J") or char == curses.KEY_NPAGE:
self.scroll_whole_page_down() self.scroll_whole_page_down()
elif char == ord("k"): elif char == ord("k") or char == curses.KEY_UP:
self.scroll_page_vertically(-3) self.scroll_page_vertically(-3)
elif char == ord("K"): elif char == ord("K") or char == curses.KEY_PPAGE:
self.scroll_whole_page_up() self.scroll_whole_page_up()
elif char == ord("l"): elif char == ord("l") or char == curses.KEY_RIGHT:
self.scroll_page_horizontally(3) self.scroll_page_horizontally(3)
elif char == ord("L"): elif char == ord("L"):
self.scroll_whole_page_right() self.scroll_whole_page_right()
@ -233,7 +235,10 @@ class Browser:
elif curses.ascii.isdigit(char): elif curses.ascii.isdigit(char):
self.handle_digit_input(char) self.handle_digit_input(char)
elif char == curses.KEY_MOUSE: elif char == curses.KEY_MOUSE:
try:
self.handle_mouse(*curses.getmouse()) self.handle_mouse(*curses.getmouse())
except curses.error:
pass
elif char == curses.KEY_RESIZE: elif char == curses.KEY_RESIZE:
self.handle_resize() self.handle_resize()
elif char == curses.ascii.ESC: # Can be ESC or ALT char. elif char == curses.ascii.ESC: # Can be ESC or ALT char.

View file

@ -11,13 +11,13 @@ Keybinds using the SHIFT key are written uppercase. Keybinds using the ALT (or M
* colon: focus the command-line * colon: focus the command-line
* r: reload page * r: reload page
* h: scroll left a bit * h (or left): scroll left a bit
* j: scroll down a bit * j (or down): scroll down a bit
* k: scroll up a bit * k (or up): scroll up a bit
* l: scroll right a bit * l (or right): scroll right a bit
* H: scroll left a whole page * H: scroll left a whole page
* J: scroll down a whole page * J (or page down): scroll down a whole page
* K: scroll up a whole page * K (or page up): scroll up a whole page
* L: scroll right a whole page * L: scroll right a whole page
* M-h: scroll one column left * M-h: scroll one column left
* M-j: scroll one line down * M-j: scroll one line down

View file

@ -3,7 +3,7 @@
WELCOME_PAGE = """\ WELCOME_PAGE = """\
# Bebop # Bebop
Hi! Welcome to the Bebop browser! 🚀🎶 Welcome to the Bebop browser! 🚀
Press "?" or type ":help" and enter to see the keybinds, commands and more, \ Press "?" or type ":help" and enter to see the keybinds, commands and more, \
or visit the link below by pressing its link ID (1). To start browsing \ or visit the link below by pressing its link ID (1). To start browsing \
@ -14,4 +14,8 @@ right away, press "o", type an URL and press Enter.
You can configure which page to show up when starting Bebop instead of this \ You can configure which page to show up when starting Bebop instead of this \
one: set your home URL in the "home" key of your configuration file. one: set your home URL in the "home" key of your configuration file.
New to Gemini? Check out this catalog of capsules to get you started:
=> gemini://medusae.space/ medusae.space
""" """