Skip to content

[ZEPPELIN-6214] Fix new web app to handling carriage return #4986

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shmruin
Copy link
Contributor

@shmruin shmruin commented Jul 18, 2025

What is this PR for?

Fix an issue where the new Angular UI (zeppelin-web-angular) does not correctly handle carriage return (\r) characters.
This causes outputs like progress bars(#) or status updates that use \r to overwrite lines to appear ugly and unnecessarily long.

This implementation is a direct port of the previous logic from the classic UI (zeppelin-web), specifically based on the original implementation in result.controller.js and result.js.

Additionally, this update changes the behavior of the carriage return (\r) character to better emulate standard terminal functionality.

Instead of clearing the entire line, the \r character now moves the cursor to the beginning of the line and overwrites the existing text. This "terminal-like" partial overwrite behavior is more accurate and what most interpreters expect.

This enhancement has been applied to both the classic and new UIs for consistent, standards-compliant output.

What type of PR is it?

Bug Fix

Todos

What is the Jira issue?

[ZEPPELIN-6214]

How should this be tested?

  • Any zeppelin notebook paragraph that generating progress bar (#) is the easiest to test this change.
  • Or you can reproduce the Jira Issue ticket's situation by running the code. Installing conda, set your own conda env, and set path in zeppelin is required.
  • For testing terminal-like CR behavior - you can run the code like below in zeppelin notebook with shell interpreter.
printf 'Initializing system, please wait...\rLoading components...\n'
printf 'Progress: [25%%]\rProgress: [50%%]\rProgress: [100%%]\n'

Screenshots (if appropriate)

  • Current Version
CR_Current
  • Fixed Version (with supporting terminal-like carriage return)
1_CR_new

Questions:

  • Does the license files need to update? N
  • Is there breaking changes for older versions? N
  • Does this needs documentation? N

Reamer
Reamer previously approved these changes Jul 21, 2025
Copy link
Contributor

@Reamer Reamer left a comment

Choose a reason for hiding this comment

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

LGTM, but I'm no frontend developer. More opinions are welcome.

@tbonelee
Copy link
Contributor

Thanks for porting the carriage return handling form the classic UI!

Just a quick note. The current implementation replaces the whole line with only the last part after \r, so something like Hello World\rDone ends up as Done.
But in most REPLs or terminal-like environments, \r usually acts as a partial overwrite. So the expected output would be Doneo World, since only the beginning of the line gets overwritten and the rest stays as is.

Since interpreters are writing output with that behavior in mind, I think it might make sense to handle it that way in the new UI too. What do you think?

@shmruin
Copy link
Contributor Author

shmruin commented Jul 23, 2025

Thanks for porting the carriage return handling form the classic UI!

Just a quick note. The current implementation replaces the whole line with only the last part after \r, so something like Hello World\rDone ends up as Done.

But in most REPLs or terminal-like environments, \r usually acts as a partial overwrite. So the expected output would be Doneo World, since only the beginning of the line gets overwritten and the rest stays as is.

Since interpreters are writing output with that behavior in mind, I think it might make sense to handle it that way in the new UI too. What do you think?

Thanks for your review. I agree with your suggestion and will test that feature. But doesn't the classic UI reflect this feature? Would it be better to fix both classic and new UI?

@tbonelee
Copy link
Contributor

I also prefer fixing both the classic and new UI so they stay consistent.
Just wanted to check, @Reamer. I don't think this would break anything, but is there any chance someone might rely on the current behavior?

Probably not, but figured I'd ask just in case.
If it sounds good, maybe we could update both to match.

@Reamer
Copy link
Contributor

Reamer commented Jul 23, 2025

I am not aware of anything like this. The new implementation is then simply not backported. This allows us to make breaking changes.

… terminal-like CR for classic and new web app
@shmruin
Copy link
Contributor Author

shmruin commented Jul 24, 2025

@tbonelee I fix the code to support terminal-like carriage return. Now \r correctly move to the front, and overwrite the output. This feature is applied to both classic and new angular UI, as they are not so different.

I tested this in shell interpreter. (+ python interpreter, also)

%sh
printf 'Initializing system, please wait...\rLoading components...\n'
printf 'Progress: [25%%]\rProgress: [50%%]\rProgress: [100%%]\n'
1_CR_new 1_CR_classic

Copy link
Contributor

@tbonelee tbonelee left a comment

Choose a reason for hiding this comment

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

LGTM. I'm just asking to be sure, but didn’t @Reamer’s comment suggest that it might be better not to backport this to the Classic UI?
If that's the case, then I guess there's no need to modify zeppelin-web, so I wanted to check.

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

Successfully merging this pull request may close these issues.

3 participants