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

improve presentation of matching results and related #451

Merged
merged 8 commits into from
Feb 12, 2024

Conversation

lifenjoiner
Copy link
Collaborator

#83, #117 and more. See the descriptions of each commit.

"move":
* column in editors may be different if there are tabs
* short
* avoids confusion with position or offset
* added for notepad++, UltraEdit and Notepad2
* removed CodeWright due to fade out of the stage
* Notepad2: match only current line highlighted
* refactor to reduce codes
and move `linePositions` from public into the function
* `%30s` adds space prefix if the length < 30, remove width specification
* show the match with a prefix context, in case of at a long line end,
  even offset > 259
* in content mode, show content starting from the line pointed to
* increase the max picked length to 50
now we have the 2nd indicator "move" (offset in the line) and highlight
@lifenjoiner lifenjoiner changed the title improve matching results and related improve presentation of matching results and related Feb 10, 2024
@stefankueng
Copy link
Owner

why do you call it "move"? Isn't this the column of the line?

@lifenjoiner
Copy link
Collaborator Author

why do you call it "move"? Isn't this the column of the line?

Many people take \t as indentations. And how many columns a \t counts is decided by the editor they use.
For example, :

	int i = 0;

Here we can only say int starts from the 2nd char. In an editor, if the \t width is defined 4, then it is the 5th column; if 8, it is the 9th column.

BTW:
Scintilla based editors, Sublime Text, UltraEdit and Vim, that I checked, works in this way.
MS Notepad is the only one that I know of counting \t as 1 column but display it with 8 columns.

@lifenjoiner
Copy link
Collaborator Author

I called it "column" at first.
"Position" has been used as posMatch in SearchFile.
"Offset", in many scenarios, is defined beginning from the start of the file.
They both give me the impression that from the start of the file.
Finally, "move" came into my mind, represents the times of caret moves.

@stefankueng
Copy link
Owner

while "caret move" would be better than just "move", I don't think either is good. It's not a common term for what it is used for. I myself had no idea what this "move" should be before checking the source code.
So this has to be changed to "column" or "line offset", anything but "move"...

@lifenjoiner
Copy link
Collaborator Author

None is perfect. I don't have a better one. So, it will be changed back to "column", and with explanation "line offset".

* "move" is not common, just "column" with "in line offset" as explanation
* the columns that a `\t` counts depends on editors. We take it as 1.
@stefankueng stefankueng merged commit 939fb0b into stefankueng:main Feb 12, 2024
1 check passed
@lifenjoiner lifenjoiner deleted the matches branch February 13, 2024 00:51
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