8000 Add separator when set before/after context · Issue #22 · Wilfred/deadgrep · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add separator when set before/after context #22

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

Closed
songsanli opened this issue Aug 17, 2018 · 3 comments
Closed

Add separator when set before/after context #22

songsanli opened this issue Aug 17, 2018 · 3 comments

Comments

@songsanli
Copy link

Hi Wilfred, thx for your work! Love the UI of *deadgrep* buffer.

I have a idea of enhancing and want to share it with you:

let's assume that we have a sample file "sample.js":

const A = () => {
  console.log("I'm function A");
};

const B = () => {
  console.log("I'm function B");
};

const C = () => {
  console.log("I'm function C");
};

I use deadgrep to search "console" and the result will be:

Search term: function change
Search type: string words regexp
Case: smart sensitive ignore
Context: none before after

Directory: ~/XXXX
Files: all type glob

sample.js
2    console.log("I'm function A");
6    console.log("I'm function B");
10   console.log("I'm function C");

Then I change both "before" and "after" context to 1, and I will get:

Search term: function change
Search type: string words regexp
Case: smart sensitive ignore
Context: none before:1 after:1

Directory: ~/XXXX
Files: all type glob

sample.js
1  const A = () => {
2    console.log("I'm function A");
3  };
5  const B = () => {
6    console.log("I'm function B");
7  };
9  const C = () => {
10   console.log("I'm function C");
11 };

It's hard to see the boundary of different result and I think a divider would help:

Search term: function change
Search type: string words regexp
Case: smart sensitive ignore
Context: none before:1 after:1

Directory: ~/XXXX
Files: all type glob

sample.js
1  const A = () => {
2    console.log("I'm function A");
3  };
...
5  const B = () => {
6    console.log("I'm function B");
7  };
...
9  const C = () => {
10   console.log("I'm function C");
11 };

To add a divider, I can see results with context in same file more clearly. What's your opinion?


M-x deadgrep-debug:

About your environment:
Platform: darwin
Emacs version: 26.1
Command: nil

Initial output from ripgrep:
nil

ripgrep version: 0.9.0.

@PuercoPop
Copy link

An alternative that would not take up more screen space would be to use the underline/overline property at the boundaries

@Wilfred
Copy link
Owner
Wilfred commented Aug 18, 2018

I think that's a good idea! Here's an example of the output:

Context: none before:1 after:2

Directory: ~/projects/deadgrep/
Files: all type glob

deadgrep.el
121  
122  (defun deadgrep--insert-output (output &optional finished)
123    "Propertize OUTPUT from rigrep and write to the current buffer."
124    ;; If we had an unfinished line from our last call, include that.
---
196  
197  (defun deadgrep--process-sentinel (process output)
198    "Update the deadgrep buffer associated with PROCESS as complete."
199    (let ((buffer (process-buffer process)))
---
218  
219  (defun deadgrep--process-filter (process output)
220    ;; Searches may see a lot of output, but it's really useful to have
221    ;; a snippet of output when debugging. Store the first output received.

Let me know what you think :)

@songsanli
Copy link
Author

Cool~

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

No branches or pull requests

3 participants
0