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

[textinput] CTRL+T eats prompt label #10133

Closed
ferdymercury opened this issue Mar 16, 2022 · 1 comment · Fixed by #10142
Closed

[textinput] CTRL+T eats prompt label #10133

ferdymercury opened this issue Mar 16, 2022 · 1 comment · Fixed by #10142

Comments

@ferdymercury
Copy link
Contributor

Describe the bug

Type "abcdefgh" in ROOT prompt. Start then pressing repeatedly Ctrl+T (transpose two characters).
You will end up "removing" the root[1] label.

Expected behavior

It should stop before the root[1] label.

To Reproduce

  • Type "abcdefgh" in ROOT prompt without pressing Enter.
  • Start then pressing repeatedly Ctrl+T (transpose two characters).
  • You will end up "removing" the root[1] label.

Setup

   ------------------------------------------------------------------
  | Welcome to ROOT 6.27/01                        https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Jan 12 2022, 10:17:19                 |
  | From heads/master@v6-25-01-2870-gdac9b6398d                      |
  | With c++ (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0                     |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

Additional context

#10121 (comment)

@couet
Copy link
Member

couet commented Mar 16, 2022

In addtition, doing that on Mac, I get the same character repeated.

root [2] abcdef

Then the first ctrl T gives:

root [2] abcdfe

Then an few ctrl T later I get:

root [2] eeeeee

jalopezg-git added a commit to jalopezg-git/root that referenced this issue Mar 16, 2022
This editor command (usually binded to Ctrl+T), transposes the character located
at the cursor and the one to its left.
However, its behavior was incorrect if the cursor was at end of the line,
invoking `std::string::operator[]()` passing an index that is out of bounds.

In that case, as per GNU Readline behavior, it should swap the two last
characters.

Closes root-project#10133.
@jalopezg-git jalopezg-git removed this from the 6.28/00 milestone Mar 16, 2022
jalopezg-git added a commit that referenced this issue Mar 16, 2022
This editor command (usually binded to Ctrl+T), transposes the character located
at the cursor and the one to its left.
However, its behavior was incorrect if the cursor was at end of the line,
invoking `std::string::operator[]()` passing an index that is out of bounds.

In that case, as per GNU Readline behavior, it should swap the two last
characters.

Closes #10133.
Neel-Shah-29 pushed a commit to Neel-Shah-29/root-1 that referenced this issue Apr 6, 2022
This editor command (usually binded to Ctrl+T), transposes the character located
at the cursor and the one to its left.
However, its behavior was incorrect if the cursor was at end of the line,
invoking `std::string::operator[]()` passing an index that is out of bounds.

In that case, as per GNU Readline behavior, it should swap the two last
characters.

Closes root-project#10133.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants