fanglingsu / vimb

Vimb - the vim like browser is a webkit based web browser that behaves like the vimperator plugin for the firefox and usage paradigms from the great editor vim. The goal of vimb is to build a completely keyboard-driven, efficient and pleasurable browsing-experience.
https://fanglingsu.github.io/vimb/
GNU General Public License v3.0
1.35k stars 100 forks source link

Adding regular expression searches #768

Open machinedgod opened 2 months ago

machinedgod commented 2 months ago

Hello, I'd like to add a feature to a search command so that it can do an extended regex search. I already have the test regex code prepped, and I think I know where to plug it into the Vimb (command.c:105 ?). Of course, some guidance/handholding would be very useful.

If this is a patch that'd be accepted upstream, then in order to prep it properly, I have few options on my mind, once I have it working, on how to have it in Vimb:

  1. as an option in config.h - makes all searches into extended regex
  2. as a set parameter
  3. as different, alternative command
  4. as some sort of flag in the search command

I can probably deal with first two on my own, but would need some guidance on last two.

Also, just to avoid XY problem, this is the context: today I wanted to select a piece of text from the webpage and store it in the clipboard, and realized that

If there's a way to easily select text just with keyboard, please let me know 🪦 I have already started working on this (as mentioned I have regex code ready) and have started ~crashing vimb~ tinkering with command_search.

machinedgod commented 2 months ago

P.S. I am simply using regex.h from glibc. This is what martanne/vis uses and it works pretty flawlessly.

Update: gonna pause this for tonight but after some more looking at the code, I realize that the search is a monolith coming from webkit, and their controller's options do not offer regex searches. This might mean I either hack this somehow with some ugly javascript command and eval, or I might :gulp: have to see if I can plug this into webkit.