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

Add keep selection feature #230

Closed
wants to merge 5 commits into from

Conversation

Sixeight
Copy link
Contributor

@Sixeight Sixeight commented Mar 1, 2015

peco-keep-selection

Brief

I propose keep selection feature.
Merge this patch then selection is kept when applied new query.
Thus we select multi line with incremental search.

Use case

  1. Open multi file from huge git ls-file result.
  2. Select multi language from gibo -l result (simonwhitaker/gibo)
  3. Open more than one directories in separated pane with tmux.

thank you.

@Sixeight Sixeight changed the title Add keep selection feature [WIP] Add keep selection feature Mar 1, 2015
@Sixeight Sixeight changed the title [WIP] Add keep selection feature Add keep selection feature Mar 1, 2015
@@ -497,7 +498,13 @@ func (m *CustomMatcher) Line(quit chan struct{}, q string, buffer []Line) []Line
for {
b, _, err := buf.ReadLine()
if len(b) > 0 {
iter <- NewMatchedLine(string(b), m.enableSep, nil)
for i, line := range lines[idx:] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コードを細かく見てないんですが、このループの効率の悪さが若干気になります…
他に方法はないものでしょうか

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

指摘ありがとうございます!
いい方法がぱっと思いつかなくて苦し紛れでした…。
なにか妙案がないか考えてみてますが、いまの Custom Matcher のときの選択のロジックから元の行数を得るのはなかなか難しそうな気がしています。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

子供と風呂に入りながら「ああ、そういうことだな」と気づきましたw>CustomMatcher
仕様変えないと難しそうですね

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

もともとの仕様はシンプルで CustomMatcher 作りやかったので、余計なことをしてしまったかもしれません 😲
といいつつ絞り込みつつ選択していくのはべんりだと思っているのでいい塩梅になるといいのですが。

@lestrrat
Copy link
Contributor

lestrrat commented Mar 1, 2015

これ、僕の元の選択されてるバッファを作るところの質がいけてないんですよねぇ。
リファクタリングを優先すべきか、機能を優先すべきか悩むな…

@lestrrat lestrrat mentioned this pull request Mar 13, 2015
3 tasks
lestrrat added a commit that referenced this pull request Mar 13, 2015
By default this feature is disabled, keeping backward compatibiity.
This should fix #230
@lestrrat lestrrat closed this in b848c6c Mar 17, 2015
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

2 participants