Skip to content

[cling] Replace usage of TextInput with LineEditor#16438

Merged
devajithvs merged 3 commits intoroot-project:masterfrom
devajithvs:dev.cling_textinput
Jan 19, 2026
Merged

[cling] Replace usage of TextInput with LineEditor#16438
devajithvs merged 3 commits intoroot-project:masterfrom
devajithvs:dev.cling_textinput

Conversation

@devajithvs
Copy link
Contributor

@devajithvs devajithvs commented Sep 16, 2024

This Pull request:

  • Replace all occurrences of TextInput with LLVM's LineEditor library in CLING. This moves the codebase closer to clang-repl and might help in future changes. This will help in removing this whole folder from CLING - https://github.com/root-project/cling/tree/master/lib/UserInterface/textinput
  • Corresponding replacement should also be made in ROOT for complete removal of TextInput. Not as straightforward as this
  • A couple of tests were adjusted to make the tests pass
  • Upstreamed LLVM patch adding setHistorySize

Changes or fixes:

Checklist:

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

This PR fixes #

@devajithvs devajithvs requested a review from hahnjo September 16, 2024 08:57
@devajithvs devajithvs self-assigned this Sep 16, 2024
@devajithvs devajithvs changed the title [cling] Replace all occurrences of TextInput with LineEditor [cling] Replace usage of TextInput with LineEditor Sep 16, 2024
@github-actions
Copy link

github-actions bot commented Sep 16, 2024

Test Results

    22 files      22 suites   3d 23h 28m 48s ⏱️
 3 809 tests  3 809 ✅ 0 💤 0 ❌
76 681 runs  76 681 ✅ 0 💤 0 ❌

Results for commit d0efa98.

♻️ This comment has been updated with latest results.

@devajithvs devajithvs marked this pull request as ready for review September 25, 2024 08:25
Copy link
Member

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

Pretty nice!

Copy link
Member

@hahnjo hahnjo left a comment

Choose a reason for hiding this comment

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

We need to decide what to do with CLING_HISTSIZE. If we want to support it, the necessary changes should be upstreamed to LLVM first and then backported to our fork. Note that it would be a first and prevent building against a vanilla LLVM!

@vgvassilev
Copy link
Member

We need to decide what to do with CLING_HISTSIZE. If we want to support it, the necessary changes should be upstreamed to LLVM first and then backported to our fork. Note that it would be a first and prevent building against a vanilla LLVM!

This was implemented to be able to set the history to 0 so that we do not get different pointers across gdb runs, iirc.

@devajithvs
Copy link
Contributor Author

We need to decide what to do with CLING_HISTSIZE. If we want to support it, the necessary changes should be upstreamed to LLVM first and then backported to our fork. Note that it would be a first and prevent building against a vanilla LLVM!

From yesterday's discussion, it seems that this does not align with the idea of using a prebuilt vanilla LLVM. I'm tending towards deprecating CLING_HISTSIZE. The functionality was added here: #11286

Regardless, I think the ability to set a history size would be a nice feature for all the tools using it. So, I will try to upstream this anyways. LineEditor hardcodes history size to 800:

::history(Data->Hist, &HE, H_SETSIZE, 800);

@hahnjo
Copy link
Member

hahnjo commented Sep 26, 2024

We need to decide what to do with CLING_HISTSIZE. If we want to support it, the necessary changes should be upstreamed to LLVM first and then backported to our fork. Note that it would be a first and prevent building against a vanilla LLVM!

This was implemented to be able to set the history to 0 so that we do not get different pointers across gdb runs, iirc.

Disabling the history can probably be implemented differently, maybe that's enough.

@devajithvs
Copy link
Contributor Author

We need to decide what to do with CLING_HISTSIZE. If we want to support it, the necessary changes should be upstreamed to LLVM first and then backported to our fork. Note that it would be a first and prevent building against a vanilla LLVM!

This was implemented to be able to set the history to 0 so that we do not get different pointers across gdb runs, iirc.

Disabling the history can probably be implemented differently, maybe that's enough.

LineEditor doesn't seem to provide a way to do it though. I've opened a PR here: llvm/llvm-project#110092

@devajithvs devajithvs marked this pull request as draft October 20, 2025 12:30
@devajithvs
Copy link
Contributor Author

This is marked draft because standalone cling repository will need textinput directory removed (which can go later but will need a separate commit in the standalone repository)

Copy link
Member

@hahnjo hahnjo left a comment

Choose a reason for hiding this comment

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

LGTM

@hahnjo hahnjo requested a review from vgvassilev November 7, 2025 12:38
Copy link
Member

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

Nice improvement!

@hahnjo
Copy link
Member

hahnjo commented Jan 13, 2026

@devajithvs this change is approved, can this go in?

@devajithvs devajithvs marked this pull request as ready for review January 13, 2026 09:59
@devajithvs
Copy link
Contributor Author

Yes, PR is ready (Ruff errors are unrelated to the changes). Will still need to remove TextInput completely from the standalone repository after merging this.

@devajithvs devajithvs added the clean build Ask CI to do non-incremental build on PR label Jan 15, 2026
- Update tests as errors/warnings will add a new line in TextInput
- Add `CLING_HISTSIZE` functionality with the newly added LLVM patch.
- Update `cling_history` test to match encoded libedit history
@devajithvs devajithvs merged commit 7848372 into root-project:master Jan 19, 2026
31 checks passed
@devajithvs devajithvs deleted the dev.cling_textinput branch January 19, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clean build Ask CI to do non-incremental build on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants