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

Allow special chars as word seperators #231

Closed
wants to merge 1 commit into from
Closed

Allow special chars as word seperators #231

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 23, 2017

... numbers are also "words" ...

@calleluks
Copy link
Collaborator

Hey @DBOTW, thanks for the PR!

The implementation looks good to me.

I haven't been able to find a standard definition of the ALTWERASE mode. The GNU libc documentation mentions also counting underscores as word characters and it seems like the handling built into linux also does this: https://github.com/torvalds/linux/blob/2acf097f16abba684012cca670a61d94178bd1ab/drivers/tty/n_tty.c#L998

Do you know more about ALTWERASE, @mptre?

@ghost
Copy link
Author

ghost commented Aug 23, 2017

For me an underscore seperates words (like a "visible blank"), I don't care about ALTWERASE ... ;-)

@mptre
Copy link
Owner

mptre commented Aug 24, 2017

The OpenBSD kernel also treats underscore as a word character. I would
propose us doing something as follows:

#define	ISWORD(c)	(isalnum((c)) || (c) == '_')

The macro is not necessary if the line with the conditional doesn't get
excessively long.

@mptre
Copy link
Owner

mptre commented Aug 24, 2017

The manual must be updated as well:

diff --git pick.1 pick.1
index 0d5104e..efc1c84 100644
--- pick.1
+++ pick.1
@@ -74,8 +74,10 @@ Delete one character to the left of the cursor in the search query input field.
 .It Ic Delete | Ctrl-D
 Delete the character under the cursor in the search query input field.
 .It Ic Ctrl-W
-Delete to the beginning of the closest word to the left in the search query
-input field.
+Delete the word to the left of the cursor.
+A word is recognized as a sequence of characters for which either
+.Xr isalnum 3
+is true or the character is an underscore.
 .It Ic Ctrl-U
 Delete to the beginning of the line in the search query input field.
 .It Ic Ctrl-K

@mptre
Copy link
Owner

mptre commented Aug 27, 2017

@DBOTW are you up for the task of finishing this PR with respect to the
feedback above? Otherwise, no worries; I will go ahead and fix it.

@ghost
Copy link
Author

ghost commented Aug 27, 2017

Of course @mptre ... done ...

@calleluks
Copy link
Collaborator

Thanks, @DBOTW! This looks good to me.

@mptre
Copy link
Owner

mptre commented Aug 28, 2017

This have to wait until v1.8.0 is out. I would also like to make
some final adjustment.

mptre added a commit that referenced this pull request Aug 28, 2017
This is equivalent to the ALTWERASE algorithm.

Based on previous work done by Jenz Guenther in PR #231 but further
enhanced to support UTF-8.
@mptre
Copy link
Owner

mptre commented Aug 28, 2017

Closing in favor of #234.

@mptre mptre closed this Aug 28, 2017
mptre added a commit that referenced this pull request Aug 30, 2017
This is equivalent to the ALTWERASE algorithm.

Based on previous work done by Jenz Guenther in PR #231 but further
enhanced to support UTF-8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants