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

Cursor styles #2075

Closed
suhan-paradkar opened this issue May 21, 2021 · 2 comments
Closed

Cursor styles #2075

suhan-paradkar opened this issue May 21, 2021 · 2 comments

Comments

@suhan-paradkar
Copy link

Feature description

Well, the recent v0.113 did implement 'blinking cursor' ,well this is a request to add additional cursor options, like backslash cursor or underscore as a cursor.
I would like to contribute for this feature....

Reference implementation

Does another app/terminal emulator have this feature?
Provide links to more background information.

@agnostic-apollo
Copy link
Member

I thought about adding that, but it could already be done with .bashrc. Check TerminalTest.

  • block: echo -e "\033[2 q"
  • underline: echo -e "\033[4 q"
  • bar: echo -e "\033[6 q"

If we had to add that in termux app itself, then it would require

  • Defining a key and internal values, map, default value TerminalEmulator.DEFAULT_CURSOR_STYLE in TermuxPropertyConstants.
  • Add Integer getTerminalCursorStyleInternalPropertyValueFromValue(String value) and Integer getTerminalCursorStyle() methods in TermuxSharedProperties to get the value.
  • Add DEFAULT_CURSOR_STYLE = CURSOR_STYLE_BLOCK to TerminalEmulator.
  • Get that properties value in TerminalEmulator.reset() with the TerminalSessionClient mClient if mClient is not null. Ideally add TerminalEmulator.setCursorStyle() method and call it in reset().
  • Which would require adding the interface method Integer getTerminalCursorStyle() to TerminalSessionClient which returns an Integer, not an int.
  • Add default implementation to TermuxTerminalSessionClientBase which returns null (which TerminalEmulator should check to default to DEFAULT_CURSOR_STYLE).
  • Add termux actual implementation in TermuxTerminalSessionClient which returns mActivity.getProperties().getTerminalCursorStyle().

Hope that's clear enough. Check the previous commits to the files to see how it should be done, like 31298b8 or e4e638b. Make sure to add javadocs and also comments where appropriate.

@suhan-paradkar
Copy link
Author

suhan-paradkar commented May 21, 2021

@agnostic-apollo yeah I saw a few lines of code which indicated that it was a WIP..

AdamMickiewich pushed a commit to VolyaTeam/dzida-app that referenced this issue Aug 8, 2022
This `terminal-cursor-style` key can be used to set the terminal cursor style. The user can set a string value to `block` for `■`, `underline` for `_` or `bar` for `|` cursor style. The default value is still `block`. So adding an entry like `terminal-cursor-style=bar` to `termux.properties` file will allow users to change to the `bar` cursor style. After updating the value, termux must be restarted. You can also run `termux-reload-settings` command so that termux loads the updated value, but only new sessions will use the updated value, existing sessions will not be affected unless you Reset them from terminal's long hold options menu `More` -> `Reset` or restart termux activity after double back press to exit.

You can temporarily switch to different cursor styles with (or add to `.bashrc` but resetting will restore default `bar` style):

- block: `echo -e "\033[2 q"`
- underline: `echo -e "\033[4 q"`
- bar: ` echo -e "\033[6 q"`

Closes termux#2075
shrihankp pushed a commit to reisxd/termux-app that referenced this issue Oct 20, 2022
This `terminal-cursor-style` key can be used to set the terminal cursor style. The user can set a string value to `block` for `■`, `underline` for `_` or `bar` for `|` cursor style. The default value is still `block`. So adding an entry like `terminal-cursor-style=bar` to `termux.properties` file will allow users to change to the `bar` cursor style. After updating the value, termux must be restarted. You can also run `termux-reload-settings` command so that termux loads the updated value, but only new sessions will use the updated value, existing sessions will not be affected unless you Reset them from terminal's long hold options menu `More` -> `Reset` or restart termux activity after double back press to exit.

You can temporarily switch to different cursor styles with (or add to `.bashrc` but resetting will restore default `bar` style):

- block: `echo -e "\033[2 q"`
- underline: `echo -e "\033[4 q"`
- bar: ` echo -e "\033[6 q"`

Closes termux#2075
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

2 participants