Skip to content

Conversation

@hvesalai
Copy link
Contributor

This functionality is better provided by jline through the ~/.inputrc or other file pointed to by -Djline.inputrc

The content of the file needs to just include the line

set editing-mode vi # alternatively emacs

The current implementation doesn't check whether the terminal can support vi or emacs modes, and hence it causes problems to, for example, emacs users running the REPL in comint buffer

@scala-jenkins scala-jenkins added this to the 2.13.15 milestone Mar 15, 2024
@SethTisue
Copy link
Member

@lrytz @som-snytt wdyt? I've tentatively milestoned it for 2.13.14.

if there is past history around this particular piece of code, I don't remember it. It came in in the big 2.13.12 JLine PR by Som (#8036)

@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Mar 15, 2024
@SethTisue SethTisue modified the milestones: 2.13.15, 2.13.14 Mar 15, 2024
@SethTisue
Copy link
Member

@ckipp01 are you a good person to ask about the vi side of this...?

@ckipp01
Copy link
Member

ckipp01 commented Mar 15, 2024

@ckipp01 are you a good person to ask about the vi side of this...?

meh, not really as I really don't use the REPL often. The reasoning here seems to make sense though.

@som-snytt
Copy link
Contributor

som-snytt commented Mar 15, 2024

I'm agnostic on SHELLOPTS but why remove support for

  -Xjline:<mode>                   Select JLine mode. Default: `emacs`, `help` to list choices.

drudgery of "run it again with this other option"...

➜  ~ scala -Xjline:help
Usage: -Xjline:<mode> where <mode> choices are emacs, vi, off (default: emacs).
  emacs  emacs key bindings.
  vi     vi key bindings
  off    No JLine editing.

I see that works and is the reason I haven't had vi bindings in a while.

My "to do" list from Feb 20 says "learn more about using jline more effectively." Oh, that was Feb 20, 2016.

Edit: there is a PR about "where to put REPL files" and previous ticket(s) about "provide .rc or .inputrc support". It would be more of a clear win if there were a "private" .inputrc in the REPL-specific directory. Without knowing much about it, I'm wary of the global config problem.

Edit: I see the linked PR (which was finally merged at pandemic lockdown) links to the .inputrc support which was merged a year later. So maybe indeed just remove all the options. -D is my least favorite way of supplying config, however.

@hvesalai
Copy link
Contributor Author

Good catch on the -Xjline. I'll review how it has been implemented.

I would remove even that since there is no point in having scala-specific way of configuring JLine.

Using the .inputrc is supported also by sbt.

I think the input mode should be personal and thus there is no reason to make it project-specific. It should be user specific and thus ~/.inputrc is the correct place to define it.

@hvesalai
Copy link
Contributor Author

While we could return back the -Jline it should not have a default value. If not defined, it would not change the way JLine defines its keymapping.

Note that -Jline:off is not the solution for emacs users since it turns jline completely off. This means that also wanted features, such as history, are turned off.

If @som-snytt you think that the -Jline option is needed for some reason, I can rework my PR to support it (with no default instead of having emacs as the default), but personally I think it should be completely removed for the reasons I've discussed above.

This functionality is better provided by jline through the `~/.inputrc` or other file pointed to by `-Djline.inputrc`

The content of the file needs to just include the line

```
set editing-mode vi # or emacs
```
@hvesalai hvesalai changed the title Remove SHELLOPTS=vi support Remove SHELLOPTS=vi and -Xjline support, reinstate -Xnojline Mar 15, 2024
@hvesalai
Copy link
Contributor Author

Pushed a new version with -Jline deprecated and -Jnoline reinstated (although I don't know who would need it)

Copy link
Contributor

@som-snytt som-snytt left a comment

Choose a reason for hiding this comment

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

Approving on assumption that using standard underlying mechanism is preferable.

@SethTisue SethTisue added the prio:hi high priority (used only by core team, only near release time) label Mar 21, 2024
@SethTisue SethTisue removed the prio:hi high priority (used only by core team, only near release time) label Apr 8, 2024
@SethTisue SethTisue merged commit 1776aec into scala:2.13.x Apr 8, 2024
@SethTisue SethTisue changed the title Remove SHELLOPTS=vi and -Xjline support, reinstate -Xnojline Remove SHELLOPTS=vi and -Xjline support; reinstate -Xnojline Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes worth highlighting in next release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants