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

FR: Double clicking on a word to highlight it #132

Open
haji-ali opened this issue Jul 24, 2022 · 3 comments
Open

FR: Double clicking on a word to highlight it #132

haji-ali opened this issue Jul 24, 2022 · 3 comments
Labels
feature request Requests for missing / new functionality in pdf-tools

Comments

@haji-ali
Copy link

Would it be possible to make it so that double-clicking on a word in the pdf document selects that word? This is the default in most modern pdf viewers (and is what double-clicking on a word does in an Emacs buffer by default).

Of course I would much rather have a way to navigate and selected text in a pdf using the keyboard, but I understand that's a difficult problem to solve.

@orgtre
Copy link
Contributor

orgtre commented Jul 28, 2022

Check out my fork https://github.com/orgtre/pdf-tools (pull request pending) which adds full keyboard navigation to pdf-tools. This is achieved either by rendering the cursor as a region in the page, which can be slow, or as a faster alternative, with pdf-keynav-pointer-as-cursor-minor-mode the mouse pointer is used as cursor.

As a side-effect one gets better mouse selection commands too. After you enable pdf-keynav-minor-mode, single-clicking selects letter, double-clicking selects word, triple-clicking (or shift clicking) selects sentence, shift double-clicking selects paragraph, and whatever you have bound to mark-whole-buffer selects the whole page.

@haji-ali
Copy link
Author

Thanks @orgtre, this looks nice and implements the features I am looking for (and more).

BTW, is there a way to select text with the keyboard? For example by setting a mark and moving the cursor similar to standard text in Emacs? Also I didn't think that the region cursor was slow, but it does disappear on some characters (weirdly this happens on moving forward while moving backward is much more consistent).

@orgtre
Copy link
Contributor

orgtre commented Jul 28, 2022

Sure, you can select text with the keyboard. Everything works pretty much like in a normal Emacs buffer, so you set mark and move with the standard keys you'd use for that (see pdf-keynav-minor-mode-map). However, transient-mark-mode is not activated by default as this again makes things slower. This means you don't see the region unless you copy or annotate it, or activate transient-mark-mode by toggling pdf-keynav-transient-mark-mode.

It would be very helpful if you report any issues with disappearing cursors or other things at https://github.com/orgtre/pdf-tools/issues, preferable with an example pdf and a reproducible description of when the issue occurs (I thought I had gotten rid of most).

@vedang vedang added the feature request Requests for missing / new functionality in pdf-tools label Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for missing / new functionality in pdf-tools
Projects
None yet
Development

No branches or pull requests

3 participants