mirror of
https://github.com/makeworld-the-better-one/amfora.git
synced 2024-08-17 02:30:39 +03:00
🚸 Support numpad enter key
This commit is contained in:
parent
73bd071753
commit
4b78a13140
@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
### Added
|
||||
- Support numpad enter key (#123)
|
||||
|
||||
### Changed
|
||||
- Updated [go-gemini](https://github.com/makeworld-the-better-one/go-gemini) to v0.9.1 to support CN-only wildcard certs
|
||||
- Preformatted text is now light yellow by default
|
||||
|
@ -10,4 +10,5 @@ Thank you to the following contributors, who have helped make Amfora great. FOSS
|
||||
- Timur Ismagilov (@bouncepaw)
|
||||
- Matt Caroll (@ohiolab)
|
||||
- Patryk Niedźwiedziński (@pniedzwiedzinski)
|
||||
- Trevor Slocum (@tsclocum)
|
||||
- Trevor Slocum (@tsclocum)
|
||||
- Cole Helbling (@cole-h)
|
||||
|
@ -115,7 +115,7 @@ func Init() {
|
||||
|
||||
//nolint:exhaustive
|
||||
switch key {
|
||||
case tcell.KeyEnter:
|
||||
case tcell.KeyEnter, KeyNumpadEnter:
|
||||
// Figure out whether it's a URL, link number, or search
|
||||
// And send out a request
|
||||
|
||||
|
@ -63,7 +63,7 @@ func Help() {
|
||||
func helpInit() {
|
||||
// Populate help table
|
||||
helpTable.SetDoneFunc(func(key tcell.Key) {
|
||||
if key == tcell.KeyEsc || key == tcell.KeyEnter {
|
||||
if key == tcell.KeyEsc || key == tcell.KeyEnter || key == KeyNumpadEnter {
|
||||
tabPages.SwitchToPage(strconv.Itoa(curTab))
|
||||
App.SetFocus(tabs[curTab].view)
|
||||
App.Draw()
|
||||
|
@ -76,7 +76,7 @@ func makeNewTab() *tab {
|
||||
currentSelection := tabs[tab].view.GetHighlights()
|
||||
numSelections := len(tabs[tab].page.Links)
|
||||
|
||||
if key == tcell.KeyEnter && len(currentSelection) > 0 {
|
||||
if (key == tcell.KeyEnter || key == KeyNumpadEnter) && len(currentSelection) > 0 {
|
||||
// A link is selected and enter was pressed: "click" it and load the page it's for
|
||||
bottomBar.SetLabel("")
|
||||
linkN, _ := strconv.Atoi(currentSelection[0])
|
||||
@ -85,7 +85,7 @@ func makeNewTab() *tab {
|
||||
followLink(tabs[tab], tabs[tab].page.URL, tabs[tab].page.Links[linkN])
|
||||
return
|
||||
}
|
||||
if len(currentSelection) == 0 && (key == tcell.KeyEnter || key == tcell.KeyTab) {
|
||||
if len(currentSelection) == 0 && (key == tcell.KeyEnter || key == KeyNumpadEnter || key == tcell.KeyTab) {
|
||||
// They've started link highlighting
|
||||
tabs[tab].page.Mode = structs.ModeLinkSelect
|
||||
|
||||
|
@ -5,12 +5,15 @@ import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/spf13/viper"
|
||||
"gitlab.com/tslocum/cview"
|
||||
)
|
||||
|
||||
// This file contains funcs that are small, self-contained utilities.
|
||||
|
||||
const KeyNumpadEnter = tcell.KeyCtrlJ
|
||||
|
||||
// escapeMeta santizes a META string for use within a cview modal.
|
||||
func escapeMeta(meta string) string {
|
||||
return cview.Escape(strings.ReplaceAll(meta, "\n", ""))
|
||||
|
Loading…
Reference in New Issue
Block a user