Skip to content

[textinput] advance cursor when typing in overwrite mode - #23328

Merged
dpiparo merged 4 commits into
root-project:masterfrom
ferdymercury:patch-24
Sep 12, 2026
Merged

[textinput] advance cursor when typing in overwrite mode#23328
dpiparo merged 4 commits into
root-project:masterfrom
ferdymercury:patch-24

Conversation

@ferdymercury

@ferdymercury ferdymercury commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

This Pull request:

Changes or fixes:

as in bash. fyi @amadio

Fixes #21457

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 21h 28m 36s ⏱️
 3 879 tests  3 878 ✅ 0 💤 1 ❌
79 904 runs  79 900 ✅ 2 💤 2 ❌

For more details on these failures, see this check.

Results for commit c5c15ec.

♻️ This comment has been updated with latest results.

@ferdymercury
ferdymercury requested a review from linev September 10, 2026 09:43
@ferdymercury ferdymercury added skip code analysis Skip the code analysis CI steps for this PR, including verifying clang-formatting and running Ruff. and removed skip code analysis Skip the code analysis CI steps for this PR, including verifying clang-formatting and running Ruff. labels Sep 10, 2026
@dpiparo

dpiparo commented Sep 10, 2026

Copy link
Copy Markdown
Member

Thanks for this change!! I am not sure it's possible to do at all, and the PR could be merged as is, but have you thought about a way to test this, in order not to encounter the problem ever again?

@dpiparo dpiparo self-assigned this Sep 10, 2026
@ferdymercury

ferdymercury commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

but have you thought about a way to test this, in order not to encounter the problem ever again?

This should do it, but I do not know if this is cross platform (not gonna work for Windows?) nor where it should go within the roottests.

echo -e "ab\033[D\033[D\033[2~.q\n" | root -b -l
// Simulates writing ab, two left-arrow presses, Ins press, and then writing .q

Before:

input_line_9:2:3: error: use of undeclared identifier 'qb'
 (qb)
  ^~
Error in <HandleInterpreterException>: Error evaluating expression (qb)
Execution of your code was aborted.

After: ROOT exits fine without errors.

@dpiparo

dpiparo commented Sep 11, 2026

Copy link
Copy Markdown
Member

Very nice. What about re-casting this in roottest?

diff --git a/roottest/root/rint/21457_input.txt b/roottest/root/rint/21457_input.txt
new file mode 100644
index 00000000000..af6c96d89ed
--- /dev/null
+++ b/roottest/root/rint/21457_input.txt
@@ -0,0 +1,4 @@
+ab
+\033[D\033[D\033[2~
+.q
+
diff --git a/roottest/root/rint/CMakeLists.txt b/roottest/root/rint/CMakeLists.txt
index 2e8e85aa471..5e5c80ed27a 100644
--- a/roottest/root/rint/CMakeLists.txt
+++ b/roottest/root/rint/CMakeLists.txt
@@ -54,3 +54,9 @@ ROOTTEST_ADD_TEST(missingSymbol
 ROOTTEST_ADD_TEST(macroCalledMain
                   COPY_TO_BUILDDIR main.cpp
                   MACRO main.cpp)
+
+# issue 21457
+ROOTTEST_ADD_TEST(inskey
+                  COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/driveTabCom.py
+                  INPUT 21457_input.txt
+                  FAILREGEX "Execution of your code was aborted.")

@ferdymercury

ferdymercury commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

What about re-casting this in roottest?

sounds good! added

@dpiparo

dpiparo commented Sep 11, 2026

Copy link
Copy Markdown
Member

I stopped the run, there is a piece missing.

got exit code 124 but expected 0

I think it's fair to expect it

@ferdymercury

ferdymercury commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

It seems it hangs there since the test takes 270.01 sec to run
so it's somehow not understanding the InsKey input encoding and sends just each character one by one?
But then not sure why it's not spitting out an error.
Maybe an issue with the python driver script?

@dpiparo

dpiparo commented Sep 11, 2026

Copy link
Copy Markdown
Member

It could be. On my local system it worked though. Let me check once again this PR locally.

@dpiparo

dpiparo commented Sep 11, 2026

Copy link
Copy Markdown
Member

my apologies. The input txt file should look like

ab\033[D\033[D\033[2~
.q

That mimics what we are trying to achieve. If not, I confirm the previous proposal leads to a timeout. Apologies for the mistake.

Without the newline, the Python driver does not process the InsKey instantly

fix by dpiparo
@dpiparo

dpiparo commented Sep 11, 2026

Copy link
Copy Markdown
Member

Last stretch: the test ought to be excluded from the battery for Windows...

2026-09-11T12:54:33.6634342Z Traceback (most recent call last):
2026-09-11T12:54:33.6635369Z   File "C:\ROOT-CI\src\roottest\root\rint\driveTabCom.py", line 4, in <module>
2026-09-11T12:54:33.6635679Z     import pty
2026-09-11T12:54:33.6635872Z   File "C:\Python314\Lib\pty.py", line 12, in <module>
2026-09-11T12:54:33.6636095Z     import tty
2026-09-11T12:54:33.6636281Z   File "C:\Python314\Lib\tty.py", line 5, in <module>
2026-09-11T12:54:33.6636509Z     from termios import *
2026-09-11T12:54:33.6636706Z ModuleNotFoundError: No module named 'termios'
@dpiparo

dpiparo commented Sep 11, 2026

Copy link
Copy Markdown
Member

Thanks and sorry for the pickiness

@dpiparo
dpiparo merged commit 5783e76 into root-project:master Sep 12, 2026
36 of 39 checks passed
@dpiparo

dpiparo commented Sep 12, 2026

Copy link
Copy Markdown
Member

/backport to 6.40

@root-project-bot

Copy link
Copy Markdown

Preparing to backport PR #23328 to branch 6.40 requested by dpiparo

@root-project-bot

Copy link
Copy Markdown

Something went wrong with the creation of the PR to backport to 6.40: @dpiparo please see the logs

@ferdymercury
ferdymercury deleted the patch-24 branch September 12, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ROOT interpreter doesn't handle <Insert> key properly at the prompt

3 participants