Xterm.js: [Discussion] Platform specific behaviour

Created on 12 Jul 2017  路  2Comments  路  Source: xtermjs/xterm.js

I would like to start a general discussion about making xterm.js behaviour platform dependant by default.

At the moment there are three features (that I know) that are platform dependent:

  1. Middle click paste: If the platform is linux, we will enable middle click paste. This is currently hard coded and not configurable. If I want middle-click paste for Mac, I'm out of luck.
  2. Copy selection: The line endings of the copied selection are terminated based on the platform (Unix: '\n', Windows: '\r\n')
  3. Unfocused cursor style: While currently the same for all platforms, there is a discussion if we should make it platform dependent (Windows cmd and powershell completely hide the cursor when inactive)

In my opinion:

  • Input/Output behaviour like middle click paste, keybindings and line endings should be platform dependent by default, but should be well documented and configurable.
  • Visual behaviour should be consistent across all platforms, and it is the responsibility of the implementor to change it if he wants to.

What are your thoughts?

Most helpful comment

If there is nothing else to add to this discussion, we can move on with creating issues to be implemented and close this 馃檪.

All 2 comments

I think these sorts of things need to be considered on a case-by-case basis.

Middle click paste is a special case where we tell the operating system there's a new selection, this works across apps as well. We simply cannot support this on Windows/macOS so this one can be removed from the discussion :smile:

On copy selection normalizing line endings we try to get native feeling behavior. Copying and pasting a chunk of text containing \r\n on Windows (the majority all files) simply does not work as expected. On Linux/macOS right now we behave as other terminal emulators do; inserting 2 lines. I think keeping this as is is probably the best approach, adding too many settings leads to bloat and makes the library more complicated and harder to use.

On unfocused cursor style, I think this is an ideal time to aim for consistency across platforms as it clearly gives benefit. Some windows terminals do show the cursor when unfocused such as the popular cmder.

So my rules are pretty similar to yours when I think about this sort of stuff for xterm.js and vscode:

  • Does it only ever make sense on a single platform? No option. Example: middle click on Linux
  • Is it the default on some OS but users may want to opt in on other platforms? Option. Example: Right click to select word, right click to copy/paste on Windows (terminal.integrated.rightClickCopyPaste in vscode).
  • Is there no clear default on the platform or is there a clear benefit to using a default that is not the OS default. Option. Example: Unfocused cursor style.

If there is nothing else to add to this discussion, we can move on with creating issues to be implemented and close this 馃檪.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

albinekb picture albinekb  路  4Comments

jestapinski picture jestapinski  路  3Comments

tandatle picture tandatle  路  3Comments

circuitry2 picture circuitry2  路  4Comments

parisk picture parisk  路  3Comments