mirror of
https://github.com/makeworld-the-better-one/amfora.git
synced 2024-09-11 14:55:51 +03:00
✨ Tab can enter link selecting mode - fixes #48
This commit is contained in:
parent
a9c7908675
commit
aa4edc4344
@ -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
|
||||
- <kbd>Tab</kbd> now also enters link selecting mode, like <kbd>Enter</kbd> (#48)
|
||||
|
||||
### Fixed
|
||||
- You can't change link selection while the page is loading
|
||||
|
||||
|
@ -80,11 +80,12 @@ Features in *italics* are in the master branch, but not in the latest release.
|
||||
- [ ] Full mouse support
|
||||
- [ ] Table of contents for pages
|
||||
- [ ] Full client certificate UX within the client
|
||||
- *I will be waiting for some spec changes/recommendations to happen before implementing this*
|
||||
- Create transient and permanent certs within the client, per domain
|
||||
- Manage and browse them
|
||||
- Similar to [Kristall](https://github.com/MasterQ32/kristall)
|
||||
- https://lists.orbitalfox.eu/archives/gemini/2020/001400.html
|
||||
- [ ] Subscribe to RSS and Atom feeds and display them
|
||||
- Subscribing to page changes, similar to how Spacewalk works, will also be supported
|
||||
- [ ] Support Markdown rendering
|
||||
- [ ] History browser
|
||||
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"github.com/makeworld-the-better-one/amfora/display"
|
||||
)
|
||||
|
||||
var version = "1.3.0"
|
||||
var version = "1.4.0-unreleased"
|
||||
|
||||
func main() {
|
||||
// err := logger.Init()
|
||||
|
@ -22,7 +22,7 @@ spacebar|Open bar at the bottom - type a URL, link number, search term.
|
||||
|You can also type two dots (..) to go up a directory in the URL.
|
||||
|Typing new:N will open link number N in a new tab
|
||||
|instead of the current one.
|
||||
Enter|On a page this will start link highlighting.
|
||||
Enter, Tab|On a page this will start link highlighting.
|
||||
|Press Tab and Shift-Tab to pick different links.
|
||||
|Press Enter again to go to one, or Esc to stop.
|
||||
Shift-NUMBER|Go to a specific tab.
|
||||
|
@ -76,28 +76,29 @@ func makeNewTab() *tab {
|
||||
currentSelection := tabs[tab].view.GetHighlights()
|
||||
numSelections := len(tabs[tab].page.Links)
|
||||
|
||||
if key == tcell.KeyEnter {
|
||||
if len(currentSelection) > 0 {
|
||||
// A link was selected, "click" it and load the page it's for
|
||||
bottomBar.SetLabel("")
|
||||
linkN, _ := strconv.Atoi(currentSelection[0])
|
||||
tabs[tab].page.Selected = tabs[tab].page.Links[linkN]
|
||||
tabs[tab].page.SelectedID = currentSelection[0]
|
||||
followLink(tabs[tab], tabs[tab].page.Url, tabs[tab].page.Links[linkN])
|
||||
return
|
||||
} else {
|
||||
// They've started link highlighting
|
||||
tabs[tab].page.Mode = structs.ModeLinkSelect
|
||||
if key == tcell.KeyEnter && 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])
|
||||
tabs[tab].page.Selected = tabs[tab].page.Links[linkN]
|
||||
tabs[tab].page.SelectedID = currentSelection[0]
|
||||
followLink(tabs[tab], tabs[tab].page.Url, tabs[tab].page.Links[linkN])
|
||||
return
|
||||
}
|
||||
if len(currentSelection) <= 0 && (key == tcell.KeyEnter || key == tcell.KeyTab) {
|
||||
// They've started link highlighting
|
||||
tabs[tab].page.Mode = structs.ModeLinkSelect
|
||||
|
||||
tabs[tab].view.Highlight("0").ScrollToHighlight()
|
||||
// Display link URL in bottomBar
|
||||
bottomBar.SetLabel("[::b]Link: [::-]")
|
||||
bottomBar.SetText(tabs[tab].page.Links[0])
|
||||
tabs[tab].saveBottomBar()
|
||||
tabs[tab].page.Selected = tabs[tab].page.Links[0]
|
||||
tabs[tab].page.SelectedID = "0"
|
||||
}
|
||||
} else if len(currentSelection) > 0 {
|
||||
tabs[tab].view.Highlight("0").ScrollToHighlight()
|
||||
// Display link URL in bottomBar
|
||||
bottomBar.SetLabel("[::b]Link: [::-]")
|
||||
bottomBar.SetText(tabs[tab].page.Links[0])
|
||||
tabs[tab].saveBottomBar()
|
||||
tabs[tab].page.Selected = tabs[tab].page.Links[0]
|
||||
tabs[tab].page.SelectedID = "0"
|
||||
}
|
||||
|
||||
if len(currentSelection) > 0 {
|
||||
// There's still a selection, but a different key was pressed, not Enter
|
||||
|
||||
index, _ := strconv.Atoi(currentSelection[0])
|
||||
|
Loading…
Reference in New Issue
Block a user