Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim Mode 2022 #439

Open
wants to merge 89 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
bdd0df1
Added new vimium.js with code taken from vimium
tobimensch Oct 7, 2018
ced1379
Created overlayVimMode function for displaying vim navigation state
tobimensch Oct 7, 2018
6bd4c96
gofmt code
tobimensch Oct 7, 2018
a78d98b
added command for links hints
tobimensch Oct 7, 2018
8b35a68
Set default DISPLAY environment variable for xclipboard functionality
tobimensch Oct 7, 2018
3c8afed
ignore manifest.json backup file
tobimensch Oct 7, 2018
a04bdac
ignore debug log in interfacer/ directory
tobimensch Oct 18, 2018
0d2dfee
Fixed typo in comment
tobimensch Oct 24, 2018
9329c9f
Added sessions permission
tobimensch Oct 29, 2018
c40c724
Added initial configuration for vim like keybindings.
tobimensch Oct 29, 2018
f730983
Added duplicate_tab, restore_tab commands.
tobimensch Oct 29, 2018
b78d896
Refactored code using switchToTab and added new features.
tobimensch Oct 29, 2018
052aecd
Added features needed for vim like navigation to the webextension.
tobimensch Oct 29, 2018
4099f51
Added vim like navigation. This is still in an early stage.
tobimensch Oct 29, 2018
721b2c8
Instead of adding 1 to Y coord, add 1 to height. This fixes an issues
tobimensch Oct 29, 2018
d037732
Merge branch 'master' of https://github.com/browsh-org/browsh into vi…
tobimensch Oct 29, 2018
61cd7e1
Prettified js files
tobimensch Oct 29, 2018
ae1df35
Fixed typo
tobimensch Oct 29, 2018
034d9c4
Update Go `dep` to v0.5.0
tombh Nov 6, 2018
11f746b
Newer NVM formats package.lock differently
tombh Nov 6, 2018
d17cb59
Update FF Marionette commands
tombh Nov 6, 2018
bf44f91
Update JS and Go deps. Bump Browsh to v1.5.0
tombh Nov 6, 2018
0bda8f1
Adds Golang clipboard dep
tombh Nov 9, 2018
6f998be
Refactors Vim code from tty.go into its own file
tombh Nov 9, 2018
e3568cd
Adds some Vim-specific integration tests
tombh Nov 9, 2018
3beeb76
Fixes tests for Vim mode
tombh Nov 11, 2018
26e9c61
Vim mode: convert unexported symbols to lowercase
tombh Nov 11, 2018
af487ae
Vim mode: Small updates from PR review
tombh Nov 12, 2018
15f541c
Travis CI: Bash timeout for integration tests
tombh Nov 13, 2018
565e6f4
Fixed bug where keyEvents variable was initialized wrongly. This led …
tobimensch Nov 13, 2018
9c668e8
Travis: upload logs to text host
tombh Nov 14, 2018
748bf9d
Gofmt: some minor capitalisation
tombh Nov 14, 2018
6882327
Allow for using Escape to leave input boxes
tobimensch Nov 15, 2018
fbb1cfc
Travis: upload logs to text host
tombh Nov 14, 2018
2bf920b
Gofmt: some minor capitalisation
tombh Nov 14, 2018
d034497
Merge branch 'vim-mode-experimental' of https://github.com/browsh-org…
tobimensch Nov 15, 2018
e10510f
Added vim feature for editing URL in new tab
tobimensch Nov 15, 2018
3449ec1
Fixed bug in key event handling between vim modes, where the same key…
tobimensch Nov 23, 2018
0c0b907
Merge branch 'vim-mode-experimental' of https://github.com/browsh-org…
tobimensch Nov 23, 2018
e88b42a
Create FUNDING.yml
tombh Jun 13, 2019
ffa586c
Merge remote-tracking branch 'origin/vim-mode-experimental'
Jun 15, 2019
76e7eb1
use test script from master
Jun 16, 2019
36ac818
move vim test into tty test seems helpful
Jun 17, 2019
f290601
Fix for Viper's lowercasing of config keys :/
tombh Jun 18, 2019
8363581
Merge remote-tracking branch 'origin/master' into vim-mode-experimental
Jun 19, 2019
a937e46
test
Jun 19, 2019
9797f40
clarify dev path
Jun 15, 2019
d9251ec
timestamp, wait for body
Jun 20, 2019
7a39926
add test delay for tab
Jun 23, 2019
0c57d3c
better logging and improve tab test stability
Jun 24, 2019
fae952b
Merge branch 'vim-mode-experimental' into localtest
Jun 24, 2019
b9b6270
merge vim mode code
Jun 24, 2019
fdf57cd
changed by prettier
Jun 24, 2019
bfdc1d1
get another version of prettier
Jun 24, 2019
a1bbf9b
Merge remote-tracking branch 'ed2k/vim-mode-experimental' into localtest
Jun 24, 2019
2206efb
get another version of prettier
Jun 24, 2019
ee1291b
Added new vimium.js with code taken from vimium
tobimensch Oct 7, 2018
3b246ff
Created overlayVimMode function for displaying vim navigation state
tobimensch Oct 7, 2018
baf808f
gofmt code
tobimensch Oct 7, 2018
ca30b77
added command for links hints
tobimensch Oct 7, 2018
dc95339
Set default DISPLAY environment variable for xclipboard functionality
tobimensch Oct 7, 2018
ebc8de9
ignore manifest.json backup file
tobimensch Oct 7, 2018
8fc15f3
ignore debug log in interfacer/ directory
tobimensch Oct 18, 2018
fac1af7
Fixed typo in comment
tobimensch Oct 24, 2018
c794f10
Added sessions permission
tobimensch Oct 29, 2018
631483b
Added initial configuration for vim like keybindings.
tobimensch Oct 29, 2018
86acac6
Added duplicate_tab, restore_tab commands.
tobimensch Oct 29, 2018
7b7e6bc
Refactored code using switchToTab and added new features.
tobimensch Oct 29, 2018
15c7b45
Added features needed for vim like navigation to the webextension.
tobimensch Oct 29, 2018
0b7d1dc
Added vim like navigation. This is still in an early stage.
tobimensch Oct 29, 2018
bd5c306
Instead of adding 1 to Y coord, add 1 to height. This fixes an issues
tobimensch Oct 29, 2018
d3fff67
Prettified js files
tobimensch Oct 29, 2018
49eebee
Fixed typo
tobimensch Oct 29, 2018
e039233
Refactors Vim code from tty.go into its own file
tombh Nov 9, 2018
eae72e9
Adds some Vim-specific integration tests
tombh Nov 9, 2018
59d2c31
Fixes tests for Vim mode
tombh Nov 11, 2018
8161ea3
Vim mode: convert unexported symbols to lowercase
tombh Nov 11, 2018
ed79db0
Vim mode: Small updates from PR review
tombh Nov 12, 2018
7a622b2
Fixed bug where keyEvents variable was initialized wrongly. This led …
tobimensch Nov 13, 2018
714cad8
Travis: upload logs to text host
tombh Nov 14, 2018
b780a79
Gofmt: some minor capitalisation
tombh Nov 14, 2018
9359837
Added vim feature for editing URL in new tab
tobimensch Nov 15, 2018
b2ade39
Fixed bug in key event handling between vim modes, where the same key…
tobimensch Nov 23, 2018
5dc678e
Merge branch 'vim-mode-experimental' into vim-mode-experimental
ed2k Jun 25, 2019
21081ad
merge vim_test into tty_test
Jun 25, 2019
5dbb731
Vim Mode 🥳
tombh Jul 21, 2022
ed2a7e0
Merge branch 'master' into vim-mode-2022
tombh Jul 26, 2022
889263a
Linting
tombh Jul 26, 2022
a075246
Merge branch 'master' into vim-mode-2022
tombh Feb 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes tests for Vim mode
Vim mode still needs a lot more tests
tombh authored and tobimensch committed Nov 13, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 3beeb76668f1887b9cb46854d307a7a8476146af
4 changes: 4 additions & 0 deletions interfacer/src/browsh/vim_mode.go
Original file line number Diff line number Diff line change
@@ -11,6 +11,9 @@ import (
"github.com/gdamore/tcell"
)

// TODO: A little description as to the respective responsibilties of this code versus the
// vimium.js code.

// TODO: Capitalised variables mean that developers can expect them to be publically availably
// as part of the API of the package. I don't think that is the intended case here.
type VimMode int
@@ -71,6 +74,7 @@ var (
linkHintWriteStringCalls *func()
)

// TODO: What's this for?
func init() {
setupLinkHints()
}
5 changes: 4 additions & 1 deletion interfacer/test/tty/setup.go
Original file line number Diff line number Diff line change
@@ -130,6 +130,9 @@ func GotoURL(url string) {
Keyboard(url)
SpecialKey(tcell.KeyEnter)
WaitForPageLoad()
// Hack to force text to be rerendered. Because there's a bug where text sometimes doesn't get
// rendered.
mouseClick(3, 3)
// TODO: Looking for the URL isn't optimal because it could be the same URL
// as the previous test.
gomega.Expect(url).To(BeInFrameAt(0, 1))
@@ -189,7 +192,7 @@ func GetBgColour(x, y int) [3]int32 {
}

func ensureOnlyOneTab() {
if len(browsh.Tabs) > 1 {
for len(browsh.Tabs) > 1 {
SpecialKey(tcell.KeyCtrlW)
}
}
33 changes: 15 additions & 18 deletions interfacer/test/tty/tty_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package test

import (
"browsh/interfacer/src/browsh"
"testing"

"github.com/gdamore/tcell"
@@ -13,7 +14,7 @@ func TestMain(t *testing.T) {
RunSpecs(t, "Integration tests")
}

var _ = Describe("Showing a basic webpage", func() {
var _ = Describe("Core functionality", func() {
BeforeEach(func() {
GotoURL(testSiteURL + "/smorgasbord/")
})
@@ -106,10 +107,10 @@ var _ = Describe("Showing a basic webpage", func() {

It("should enter multiple lines of text", func() {
Keyboard(`So here is a lot of text that will hopefully split across lines`)
Expect("So here is a lot of").To(BeInFrameAt(1, 3))
Expect("text that will").To(BeInFrameAt(1, 4))
Expect("hopefully split across").To(BeInFrameAt(1, 5))
Expect("lines").To(BeInFrameAt(1, 6))
Expect("So here is a lot of").To(BeInFrameAt(1, 2))
Expect("text that will").To(BeInFrameAt(1, 3))
Expect("hopefully split across").To(BeInFrameAt(1, 4))
Expect("lines").To(BeInFrameAt(1, 5))
})

It("should scroll multiple lines of text", func() {
@@ -120,37 +121,33 @@ var _ = Describe("Showing a basic webpage", func() {
for i := 1; i <= 6; i++ {
SpecialKey(tcell.KeyUp)
}
Expect("lines").To(BeInFrameAt(1, 6))
Expect("lines").To(BeInFrameAt(1, 5))
})
})
})

Describe("Tabs", func() {
BeforeEach(func() {
SpecialKey(tcell.KeyCtrlT)
})

AfterEach(func() {
ensureOnlyOneTab()
})

It("should create a new tab", func() {
Expect("New Tab").To(BeInFrameAt(21, 0))
SpecialKey(tcell.KeyCtrlT)
Expect(len(browsh.Tabs)).To(Equal(2))
})

It("should be able to goto a new URL", func() {
Keyboard(testSiteURL + "/smorgasbord/another.html")
SpecialKey(tcell.KeyEnter)
Expect("Another").To(BeInFrameAt(21, 0))
SpecialKey(tcell.KeyCtrlT)
GotoURL(testSiteURL + "/smorgasbord/another.html")
Expect("Another▄webpage").To(BeInFrameAt(1, 3))
})

It("should cycle to the next tab", func() {
Expect(" ").To(BeInFrameAt(0, 1))
SpecialKey(tcell.KeyCtrlL)
GotoURL(testSiteURL + "/smorgasbord/")
SpecialKey(tcell.KeyCtrlT)
GotoURL(testSiteURL + "/smorgasbord/another.html")
triggerUserKeyFor("tty.keys.next-tab")
URL := testSiteURL + "/smorgasbord/ "
Expect(URL).To(BeInFrameAt(0, 1))
Expect("Smörgåsbord").To(BeInFrameAt(0, 0))
})
})
})
3 changes: 2 additions & 1 deletion interfacer/test/tty/vim_test.go
Original file line number Diff line number Diff line change
@@ -41,9 +41,10 @@ var _ = Describe("Vim tests", func() {
})

It("should cycle to the next tab", func() {
GotoURL(testSiteURL + "/smorgasbord/")
Keyboard("t")
GotoURL(testSiteURL + "/smorgasbord/another.html")
Keyboard("gt")
Keyboard("J")
URL := testSiteURL + "/smorgasbord/ "
Expect(URL).To(BeInFrameAt(0, 1))
})