Skip to content

JLine3 Status Bar Vertical Resize Bug #1526

@Abdelilah-AIT-HAMOU

Description

@Abdelilah-AIT-HAMOU

used AI to summarize the issue :

Summary

When a terminal with a JLine3 Status bar is resized vertically, the old status bar content remains visible at the old position until the next user input (keystroke). This creates a visual artifact where multiple status bars appear to be present.

Expected Behavior

On vertical terminal resize, the Status bar should:

  1. Clear from its old position
  2. Immediately appear at the new bottom position
  3. No visual artifacts should remain

Actual Behavior

On vertical terminal resize:

  1. New status bar appears at the correct new position
  2. Old status bar content remains visible at the old position
  3. Old status bar only disappears when user presses a key or types

Reproducible Test Case

MinimalStatusBarBug.java

Minimal test using standard JLine3 APIs following official documentation. This demonstrates the bug with vanilla JLine3 - no custom code or workarounds.

Compile:

javac -cp "jline3/terminal/target/jline-terminal-3.30.4.jar:jline3/reader/target/jline-reader-3.30.4.jar" MinimalStatusBarBug.java

Run:

java -cp ".:jline3/terminal/target/jline-terminal-3.30.4.jar:jline3/reader/target/jline-reader-3.30.4.jar" MinimalStatusBarBug

Steps to reproduce:

  1. Run the program
  2. Observe status bar at bottom showing "Status Bar - Resize the terminal vertically to see the bug"
  3. Resize terminal vertically (drag window taller or shorter)
  4. BUG: Old status bar remains visible at old position
  5. Press Enter - the old status bar disappears
  6. Type quit to exit

##code :

// Source code is decompiled from a .class file using FernFlower decompiler (from Intellij IDEA).
import java.io.IOException;
import java.util.Collections;
import org.jline.reader.LineReader;
import org.jline.reader.LineReaderBuilder;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
import org.jline.utils.AttributedString;
import org.jline.utils.Status;

public class MinimalStatusBarBug {
   public MinimalStatusBarBug() {
   }

   public static void main(String[] var0) throws IOException {
      Terminal var1 = TerminalBuilder.builder().system(true).build();
      LineReader var2 = LineReaderBuilder.builder().terminal(var1).appName("MinimalTest").build();
      Status var3 = Status.getStatus(var1, true);
      var3.update(Collections.singletonList(new AttributedString("Status Bar - Resize the terminal vertically to see the bug")));
      System.out.println("=== Minimal JLine3 Status Bar Bug Reproduction ===");
      System.out.println();
      System.out.println("Bug reproduction steps:");
      System.out.println("1. You should see a status bar at the bottom");
      System.out.println("2. Resize the terminal vertically (make it taller or shorter)");
      System.out.println("3. BUG: The old status bar stays at its old position");
      System.out.println("4. Press Enter - the old status bar disappears");
      System.out.println();
      System.out.println("Type 'quit' to exit");
      System.out.println();

      while(true) {
         String var4 = var2.readLine("> ");
         if (var4 == null || "quit".equalsIgnoreCase(var4.trim())) {
            var3.update(Collections.emptyList());
            var1.close();
            return;
         }

         System.out.println("Input: " + var4);
      }
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions