Tab can enter link selecting mode - fixes #48

This commit is contained in:
makeworld 2020-07-19 11:09:33 -04:00
parent a9c7908675
commit aa4edc4344
5 changed files with 29 additions and 24 deletions

View File

@ -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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Added
- <kbd>Tab</kbd> now also enters link selecting mode, like <kbd>Enter</kbd> (#48)
### Fixed ### Fixed
- You can't change link selection while the page is loading - You can't change link selection while the page is loading

View File

@ -80,11 +80,12 @@ Features in *italics* are in the master branch, but not in the latest release.
- [ ] Full mouse support - [ ] Full mouse support
- [ ] Table of contents for pages - [ ] Table of contents for pages
- [ ] Full client certificate UX within the client - [ ] 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 - Create transient and permanent certs within the client, per domain
- Manage and browse them - Manage and browse them
- Similar to [Kristall](https://github.com/MasterQ32/kristall)
- https://lists.orbitalfox.eu/archives/gemini/2020/001400.html - https://lists.orbitalfox.eu/archives/gemini/2020/001400.html
- [ ] Subscribe to RSS and Atom feeds and display them - [ ] 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 - [ ] Support Markdown rendering
- [ ] History browser - [ ] History browser

View File

@ -8,7 +8,7 @@ import (
"github.com/makeworld-the-better-one/amfora/display" "github.com/makeworld-the-better-one/amfora/display"
) )
var version = "1.3.0" var version = "1.4.0-unreleased"
func main() { func main() {
// err := logger.Init() // err := logger.Init()

View File

@ -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. |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 |Typing new:N will open link number N in a new tab
|instead of the current one. |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 Tab and Shift-Tab to pick different links.
|Press Enter again to go to one, or Esc to stop. |Press Enter again to go to one, or Esc to stop.
Shift-NUMBER|Go to a specific tab. Shift-NUMBER|Go to a specific tab.

View File

@ -76,28 +76,29 @@ func makeNewTab() *tab {
currentSelection := tabs[tab].view.GetHighlights() currentSelection := tabs[tab].view.GetHighlights()
numSelections := len(tabs[tab].page.Links) numSelections := len(tabs[tab].page.Links)
if key == tcell.KeyEnter { if key == tcell.KeyEnter && len(currentSelection) > 0 {
if len(currentSelection) > 0 { // A link is selected and enter was pressed: "click" it and load the page it's for
// A link was selected, "click" it and load the page it's for bottomBar.SetLabel("")
bottomBar.SetLabel("") linkN, _ := strconv.Atoi(currentSelection[0])
linkN, _ := strconv.Atoi(currentSelection[0]) tabs[tab].page.Selected = tabs[tab].page.Links[linkN]
tabs[tab].page.Selected = tabs[tab].page.Links[linkN] tabs[tab].page.SelectedID = currentSelection[0]
tabs[tab].page.SelectedID = currentSelection[0] followLink(tabs[tab], tabs[tab].page.Url, tabs[tab].page.Links[linkN])
followLink(tabs[tab], tabs[tab].page.Url, tabs[tab].page.Links[linkN]) return
return }
} else { if len(currentSelection) <= 0 && (key == tcell.KeyEnter || key == tcell.KeyTab) {
// They've started link highlighting // They've started link highlighting
tabs[tab].page.Mode = structs.ModeLinkSelect tabs[tab].page.Mode = structs.ModeLinkSelect
tabs[tab].view.Highlight("0").ScrollToHighlight() tabs[tab].view.Highlight("0").ScrollToHighlight()
// Display link URL in bottomBar // Display link URL in bottomBar
bottomBar.SetLabel("[::b]Link: [::-]") bottomBar.SetLabel("[::b]Link: [::-]")
bottomBar.SetText(tabs[tab].page.Links[0]) bottomBar.SetText(tabs[tab].page.Links[0])
tabs[tab].saveBottomBar() tabs[tab].saveBottomBar()
tabs[tab].page.Selected = tabs[tab].page.Links[0] tabs[tab].page.Selected = tabs[tab].page.Links[0]
tabs[tab].page.SelectedID = "0" tabs[tab].page.SelectedID = "0"
} }
} else if len(currentSelection) > 0 {
if len(currentSelection) > 0 {
// There's still a selection, but a different key was pressed, not Enter // There's still a selection, but a different key was pressed, not Enter
index, _ := strconv.Atoi(currentSelection[0]) index, _ := strconv.Atoi(currentSelection[0])