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

Highlighting does not work for files having a space in the name #1883

Closed
Maximus5 opened this issue Jul 31, 2015 · 7 comments
Closed

Highlighting does not work for files having a space in the name #1883

Maximus5 opened this issue Jul 31, 2015 · 7 comments

Comments

@Maximus5
Copy link
Owner

Originally reported on Google Code with ID 1884

Required information!
OS version: Win7/SP1/x64
ConEmu version: 150119a

*Bug description*
I just noticed that the highlight feature does not detect files that have a space in
the name. See the attached screenshot "foobar.txt" can be clicked "foo bar.txt" does
not.

Reported by pfeiffer@tzi.de on 2015-01-27 19:59:49


- _Attachment: ConEmu-1.png
![ConEmu-1.png](https://storage.googleapis.com/google-code-attachments/conemu-maximus5/issue-1884/comment-0/ConEmu-1.png)_
@Maximus5
Copy link
Owner Author

It is. And must not I believe.
Otherwise how do you think detector must behave in TEXT FILES. Checking whole line?

Reported by ConEmu.Maximus5 on 2015-01-27 20:28:03

@Maximus5
Copy link
Owner Author

Ah ok, I understand you want to avoid false detections within text files. It would be
very convenient if files having a space in their names would be clickable as well.

I guess that you currently check any substring (\w|\.)+ and if that matches to an existing
file in the current path the string will be highlighted as file link.

If it is an option to check the whole line maybe parsing from wide to narrow would
allow to detect files having a space in the name also. This may work in text files
too.

Example:

123 Bytes    foo bar.txt
C:\_

Take whitespace as delimitter and check from left to right the existence of the filename
using the concatenated tokens from wide to narrow:

Pseudo-Code to be applied for each line:

for (int i = 0; i < maxTokens; i++) {
  for (int j = maxTokens - 1; j >= i; j--) {
    if (fileExists(join(tokens, i, j)) {
      -> highlight as filelink
    }
  }
}

Example:

i=0,j=3 : "123 Bytes    foo bar.txt" -> false
i=0,j=2 : "123 Bytes    foo" -> false
i=0,j=1 : "123 Bytes" -> false
i=0,j=0 : "123" -> false

i=1,j=3 : "Bytes    foo bar.txt" -> false
i=1,j=2 : "Bytes    foo" -> false
i=1,j=1 : "Bytes" -> false

i=2,j=3 : "foo bar.txt" -> true

Reported by pfeiffer@tzi.de on 2015-01-28 15:05:00

@Maximus5
Copy link
Owner Author

BTW: Currently I use  ...

#cmd.exe /c "%3"

... and this even can launch pdf or doc files in the appropriate application.

This is such a powerful feature! :-)

Reported by pfeiffer@tzi.de on 2015-01-28 15:10:19

@Maximus5
Copy link
Owner Author

That is bad suggestion.

First, detector must be able to seek backward from mouse position. And what will happens
for line

Bla bla bla bla bla bla ...
?

Second. Searching for files gives large overhead. Suggested method will increase lags
exponentially.

Reported by ConEmu.Maximus5 on 2015-01-28 15:14:22

@Maximus5
Copy link
Owner Author

#cmd.exe /c "%3"

added to dropdown list

Reported by ConEmu.Maximus5 on 2015-01-28 15:19:09

@Maximus5
Copy link
Owner Author

Ok I see, there are too many possible permutations which can not be handled in a reasonable
way. I really like this feature, seems that we have to use less spaces within document
filenames. ;-)

Reported by pfeiffer@tzi.de on 2015-01-28 15:21:06

@Maximus5
Copy link
Owner Author

Exactly. It may be possible to detect spaces if the filename itself is doublequoted...
But the feature would be useless because very small amount of apps can print them quoted.
So...

Reported by ConEmu.Maximus5 on 2015-01-28 15:27:00

  • Status changed: WontFix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant