Skip to content

JLine 3: resolve status of history and h? commands #12268

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

Open
SethTisue opened this issue Mar 5, 2020 · 8 comments
Open

JLine 3: resolve status of history and h? commands #12268

SethTisue opened this issue Mar 5, 2020 · 8 comments
Labels
Milestone

Comments

@SethTisue
Copy link
Member

commented-out code in the PR:

    // TODO maybe just drop these commands, as jline subsumes them -- before reenabling, finish scala.tools.nsc.interpreter.jline.HistoryAdaptor
     //historyCommand,
     //cmd("h?", "<string>", "search the history", searchHistory),
@lrytz

This comment has been minimized.

@SethTisue
Copy link
Member Author

control-R already works for searching history. (this was true in JLine 2 as well.)

@dwijnand

This comment has been minimized.

@hvesalai
Copy link

emacs-sbt-mode uses the history commands as well and also expects the commands run from emacs to be there (i.e. when jline is off, I guess)

@SethTisue SethTisue changed the title JLine 3: resolve status of edit and history commands JLine 3: resolve status of history command Mar 10, 2020
@SethTisue
Copy link
Member Author

I've made this ticket history-only, labeled it a blocker, and moved the edit stuff to a new ticket (#700)

@SethTisue SethTisue changed the title JLine 3: resolve status of history command JLine 3: resolve status of history and h? commands Mar 25, 2020
@SethTisue
Copy link
Member Author

SethTisue commented Mar 25, 2020

now that I take a second, slower look at this I see that :history shows the history (optional numeric argument of how many entries to show) and :h? is for searching it:

scala 2.13.1> 2 + 2
res0: Int = 4

scala 2.13.1> 3 + 4
res1: Int = 7

scala 2.13.1> 5 + 6
res2: Int = 11

scala 2.13.1> :history
  1  2 + 2
  2  3 + 4
  3  5 + 6
  4  :history

scala 2.13.1> :h? 5
3 5 + 6
5 :h? 5

scala 2.13.1> :history 2
  5  :h? 5
  6  :history 2

@SethTisue
Copy link
Member Author

@hvesalai I see that emacs-sbt-mode reads ~/.scala_history; note that we're changing it to ~/.scala_history_jline3

you write "uses the history commands as well" and I'm puzzled about that. I'm looking in the sbt-emacs-mode source code and I see that it uses :completions, but I do not see that it uses either :history or :h?

based on my observations, I'm removing the "blocker" label from this, but I can add it back if you can confirm that it's specifically :history and/or :h? that you want/need

@SethTisue
Copy link
Member Author

SethTisue commented Mar 25, 2020

Another thing I hadn't understood before: in JLine 3, history search is connected to up-arrow. So if you type e.g. pr and then hit up arrow, it starts cycling through previous entries that begin with pr. Dotty and Ammonite both support this. It doesn't make :h? useless, I guess, but the need for it to exist is now less.

It already works in our PR, too. (Perhaps not perfectly?)

@SethTisue SethTisue transferred this issue from scala/scala-dev Dec 8, 2020
@SethTisue SethTisue added the repl label Dec 8, 2020
@SethTisue SethTisue added this to the Backlog milestone Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants