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 spaces to be entered in URL fields #149

Merged
merged 1 commit into from
Sep 2, 2020
Merged

Conversation

bptato
Copy link
Contributor

@bptato bptato commented Sep 1, 2020

For some reason the space key previously triggered filename completion when typed into the location field (command GOTO), so the only way of using spaces in URLs I found was to type %20 instead. Which is still highly inconvenient when using urimethodmap with a search engine, for example.

With this patch the space key actually does what one would expect it to do (insert spaces), and the old behavior can still be enabled in the options menu.

…ion, old behavior can be toggled via options
@tats
Copy link
Owner

tats commented Sep 1, 2020

The patch looks acceptable to me. Will be merged soon.

the only way of using spaces in URLs I found was to type %20 instead

The current way is to type Ctrl-v or Ctrl-q (quoting like Bash or Emacs)
and then type space, but it's inconvenient when copy/pasting.

@tats tats merged commit 0a7c4b6 into tats:master Sep 2, 2020
@tats
Copy link
Owner

tats commented Sep 2, 2020

Merged, thanks for your contribution.

@DNied
Copy link

DNied commented Sep 2, 2020

I don't get it: when is a URL allowed to contain spaces?

@tats
Copy link
Owner

tats commented Sep 2, 2020

URL containing spaces is not allowed, so w3m encodes space to %20.

@DNied
Copy link

DNied commented Sep 3, 2020

OK, but then why are we allowed (by this patch) to enter spaces in URL fields?

@tats
Copy link
Owner

tats commented Sep 3, 2020

why are we allowed (by this patch) to enter spaces in URL fields?

The new behavior helps users to access flie/directory names with spaces easily.
The new behavior is similar to other web browsers, such as Firefox, Chromium.
The input field is just a user interface, not a URL validator.

I'm not yet convinced allowing spaces in the input field is bad.
Please tell me if the new behavior causes real problemes.

@DNied
Copy link

DNied commented Sep 3, 2020

I'm not saying it's bad: if it's useful for local files then OK! But I would probably adopt a different approach. Since I found out that the Tab key also performs completion, we could just have the space key input a space and not have an option for that (IMO the option page is already too long).

I'm working on a w3m fork that also tracks commits to this repository, but in this case I'll probably follow the approach I just outlined.

@DNied
Copy link

DNied commented Sep 3, 2020

Which basically boils down to making this one simple change to the code (as it was after merging pull request #148) :

--- linein.c    2007-05-23 14:14:24+02  1.35
+++ linein.c    2020-09-03 22:03:25+02
@@ -184,7 +184,7 @@ inputLineHistSearch(char *prompt, char *
        cm_clear = TRUE;
        cm_disp_clear = TRUE;
        if (!i_quote &&
-           (((cm_mode & CPL_ALWAYS) && (c == CTRL_I || c == ' ')) ||
+           (((cm_mode & CPL_ALWAYS) && c == CTRL_I) ||
             ((cm_mode & CPL_ON) && (c == CTRL_I)))) {
            if (emacs_like_lineedit && cm_next) {
                _dcompl();

All of the above tested & working.

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.

None yet

3 participants