Clear screen command in Java

Hello.
I am writing an application for school, when executing the application on the command line, I want to clear the screen. (CLS in DOS)
Would someone tell the format of the command to issue DOS Coomand through Java?
Thanks

FJSeminario wrote:
Hello.
I am writing an application for school, when executing the application on the command line, I want to clear the screen. (CLS in DOS)
Would someone tell the format of the command to issue DOS Coomand through Java?
ThanksIf you only need to clear the screen once before running the Java program you could put the CLS and the java command in a .bat file and execute the batch file at the command line.

Similar Messages

  • "clear screen" command exits sqlplus

    Hi,
    I am running a 10gR2 database. when I issue "clear screen" command at the sqlplus prompt, it throws me out of the sqlplus. there are no error messages.
    anybody having the resolution ?
    thanks.

    I got it ... its a bug in 10.2.0.1, the version which I m using
    bug 4595395      CLEAR SCREEN causes SQLPLUS command line to dump
    this is resolved in 10.2.0.2 patchset. Note: 358749.1
    thanks.

  • Run Clear Case command from java and save the out put in to a file.

    Can any one help me out ...
    I want to execute Clear case command from a java and want to save the out put of this command to a file.
    I am naot able to find out how to start..
    Message was edited by:
    chandra_verma

    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Clear Screen, Sql plus Error, in release 10.2.0.1.0

    Hi there,
    I'm having problem in using clear screen command in SQLPlus utility of Oracle Release 10.2.0.1.0. When executing clear screen in SQL Plus ( in command prompt) in windows machine, suddenly a dialogue box opens and saying that "SQLPlus encountered an error and sorry for inconvenience "
    Is this the problem with OS or Oracle Client?
    Could anyone please help me in resolving this issue?
    Thanks
    Raja

    So that is the problem with Oracle client only, not with the OS configuration and all.... shall i assume?

  • Clear screen from sql file

    at sqlplus prompt, I can type either HOST CLS or CLEAR SCREEN and both work..
    but when I put either of them in an .sql file and run it from sql with @c:\file.sql
    both commands error with:
    ORA-06550
    PLS-00103 encountered 'CLS' or 'SCREEN'
    OS IS Windows 7 with Oracle 11.1.0.6 client
    my goal is to run a dbms_output line while in a loop
    so the data shows on the screen and refreshes when it is changed
    without clearing the screen, it just shows over and over and scrolls by a list of them very fast

    Merlin128 wrote:
    at sqlplus prompt, I can type either HOST CLS or CLEAR SCREEN and both work..
    but when I put either of them in an .sql file and run it from sql with @c:\file.sql
    both commands error with:
    ORA-06550
    PLS-00103 encountered 'CLS' or 'SCREEN'
    OS IS Windows 7 with Oracle 11.1.0.6 clientThe SQL*Plus CLEAR SCREEN command works for me.
    my goal is to run a dbms_output line while in a loop
    so the data shows on the screen and refreshes when it is changed
    without clearing the screen, it just shows over and over and scrolls by a list of them very fastSorry, I don't think you can do that.
    Dbms_output does not display anything while the PL/SQL code is running. In fact, it doesn't actually display anything, ever. Dbms_output merely puts text to be displayed into a buffer. When control returns to SQL*Plus, then SQL*Plus displays all of the buffered text together. So if your PL/SQL block consists of a loop that takes 10 seconds per iteration, and you go through the loop 6 times, you will wait a full 60 seconds before seeing any output, and then see all 6 lines as quickly as PL/SQL can display them.

  • Clear Screen in command interpreter

    Hello, can anyone please tell me how I can clear the command prompt from all outputs?
    for instance, if "Hello" was printed on screen and I would like to input another string afterwards, can I clear Hello and then input as if no output appeared prior to the input statement?
    Thanks,
    Batzi
    Edited by: Batzi on 23/12/2009 01:36 ?

    its giving error
    java.io.IOException: Cannot run program "cls": CreateProcess error=2, The system cannot find the file specified
         at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
         at java.lang.Runtime.exec(Runtime.java:593)
         at java.lang.Runtime.exec(Runtime.java:431)
         at java.lang.Runtime.exec(Runtime.java:328)
         at com.ClearCmdPrmt.clear(ClearCmdPrmt.java:12)
         at com.ClearCmdPrmt.main(ClearCmdPrmt.java:29)
    Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
         at java.lang.ProcessImpl.create(Native Method)
         at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
         at java.lang.ProcessImpl.start(ProcessImpl.java:30)
         at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)

  • Clear screen in "Run SQL Command Line" causes the utility to dump in Window

    Just for your notice... I have not checked if i can reproduce this on Linux platform or on second node running Windows XP Pro.
    But if I use "Run SQL Command Line" utility and do
    clear screen
    The utility dumps, (not the database though only the utlility)
    Maybe some other people could confirm if this findings is a bug or not and if it is a port specific issue with Windows XP only.
    Kindly Rgds
    /Ulf, Kentor IT Sweden

    Tracking info is in
    Re: SQL*Plus generated Program Error
    -- cj

  • Cls command in java

    Hi
    Is there any command that can do a clear screen rather than using the for-loop with a blank "" or revoking a dos command from Java 1.3.
    Thanks

    http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A31&qt=clear+screen&x=0&y=0

  • What is function to clear screen ??

    hi,
    What i s function to clear screen .. for example in C-languse we use clrscr();
    like that what is function in java to clear screen.. that is in command prompt window clear

    I dont thik u can do this...
    since u are writing to a stream. so what ever is written is written...
    but if u have any ur own component developed u can do this.
    regards,
    Karthik

  • Execute dos commands through java

    Hi,
    Im trying to execute dos commands through java like
              try {
                   java.lang.Runtime.getRuntime().exec("cmd /c cls");
              }catch(IOException e){
                   System.out.println(e.getMessage());
              }Not sure if its possible? however
    open notepad would work
              try {
                   java.lang.Runtime.getRuntime().exec("notepad");
              }catch(IOException e){
                   System.out.println(e.getMessage());
              }Im trying to execute a cls commands to clear screen but without luck.

    The question is, which shell do you want to clear?
    I don't really know, but it could be that Runtime.exec executes its command in a new shell window...

  • Executing UNIX command in Java

    I am having problems executing a command in Java. Here's the code I have for executing:
    Process p = Runtime.getRuntime().exec(cmd);
                                            BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
         while((display = input.readLine()) != null)
                             num_1 = Double.parseDouble(display);
                             percent = (num_1 * 100) / (50000000);
                        flip = 1;
                        catch(IOException e)
                        e.printStackTrace();     
                        System.exit(1);
    Now, when I run the script, I receive the following errors:
    Exception occurred during event dispatching:
    java.security.AccessControlException: access denied (java.io.FilePermission /Netadmin/UCDSNMP/bin/snmpdelta execute)
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.fillInStackTrace(Compiled Code)
    at java.lang.Throwable.<init>(Compiled Code)
    at java.lang.Exception.<init>(Compiled Code)
    at java.lang.RuntimeException.<init>(RuntimeException.java:47)
    at java.lang.SecurityException.<init>(SecurityException.java:39)
    at java.security.AccessControlException.<init>(AccessControlException.java:57)
    at java.security.AccessControlContext.checkPermission(Compiled Code)
    at java.security.AccessController.checkPermission(Compiled Code)
    at java.lang.SecurityManager.checkPermission(Compiled Code)
    at java.lang.SecurityManager.checkExec(SecurityManager.java:789)
    at java.lang.Runtime.exec(Compiled Code)
    at java.lang.Runtime.exec(Compiled Code)
    at java.lang.Runtime.exec(Runtime.java:152)
    at snmp.actionPerformed(Compiled Code)
    at java.awt.Button.processActionEvent(Button.java:308)
    at java.awt.Button.processEvent(Button.java:281)
    at java.awt.Component.dispatchEventImpl(Compiled Code)
    at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.EventQueue.dispatchEvent(Compiled Code)
    at java.awt.EventDispatchThread.pumpOneEvent(Compiled Code)
    at java.awt.EventDispatchThread.pumpEvents(Compiled Code)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
    The user is entering the parameters for the UNIX command from a Java applet. Everything looks right, but I can't seem to run the file? Please help! All is appreciated.
    Jason Banks
    Northeastern University

    Sorry, this is a bug that I've reported -- see Sun's response and my original report (along with how to get around the problem) shown below:
    Hi Vira Van.,
    The bug you have reported is a duplicate of Bug ID: 4522533.
    Thank you for providing us with additional information
    that can be used in the resolution of this bug.
    This bug can be monitored via the the Java Developer
    Connection Bug Parade at:
    http://developer.java.sun.com/developer/bugParade/index.jshtml
    The Java Developer Connection is a free channel that is
    maintained by staff here at Sun.  Access this web page to join:
    http://developer.java.sun.com/servlet/RegistrationServlet
    The home page for the JDC is:
    http://java.sun.com/jdc
    Regards,
    Girish
    ----------------- Original Bug Report-------------------
    category : java
    release : 1.4
    subcategory : jar
    type : bug
    synopsis : signed applet: bad major version number on NN4.79 and ClassNotFound in IE5.5
    description : FULL PRODUCT VERSION :
    java version "1.4.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
    Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
    FULL OPERATING SYSTEM VERSION : Windows 98 [Version
    4.10.2222]
    ADDITIONAL OPERATING SYSTEMS :
    BROWSERS: Netscape Navigator 4.79
            : Internet Explorer 5.5
    EXTRA RELEVANT SYSTEM CONFIGURATION :
    Applet failed to start in Netscape, the following error
    message appeared in the Java Console:
    Netscape Communications Corporation -- Java 1.1.5
    Type '?' for options.
    Symantec Java! ByteCode Compiler Version 210.065
    Copyright (C) 1996-97 Symantec Corporation
    # Applet exception: error: java.lang.ClassFormatError: Bad
    major version number
    java.lang.ClassFormatError: Bad major version number
      at java.lang.ClassLoader.defineClass(Compiled Code)
      at netscape.applet.AppletClassLoader.findClass(Compiled
    Code)
      at netscape.applet.AppletClassLoader.loadClass1(Compiled
    Code)
    * at netscape.applet.AppletClassLoader.loadClass(Compiled
    Code)
      at netscape.applet.AppletClassLoader.loadClass(Compiled
    Code)
      at
    netscape.applet.DerivedAppletFrame$LoadAppletEvent.dispatch(
    Compiled Code)
      at
    java.awt.EventDispatchThread$EventPump.dispatchEvents(Compil
    ed Code)
      at java.awt.EventDispatchThread.run(Compiled Code)
      at
    netscape.applet.DerivedAppletFrame$AppletEventDispatchThread
    .run(Compiled Code)
    The same applet
    A DESCRIPTION OF THE PROBLEM :
    Unable to run signed applet with Netscape 4.79 and IE5.5
    native JVM.
    REGRESSION.  Last worked in version 1.3.1
    STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
    1.compile program and copy class files to a temp directory
    2.sign the applet for Netscape as follows:
    signtool -k aok -d \progra~1\netscape\users\viravan -Z
    FIO.jar temp
    3.sign the applet for Internet Explorer as follows:
    cabarc -p n FileIO.cab FileIO*.class
    setreg 1 true
    makecert -sk aok -n "CN=aok" aok.cer
    cert2spc aok.cer aok.spc
    signcode -j javasign.dll -jp LOWX -spc aok.spc -k aok
    FileIO.cab
    Run the applet with the following HTML file:
    <html><head><Title>Self-Signed Applet</Title>
    <script>
    document.layers ? parm=1 : parm=0;
    </script>
    <body>
    This file I/O applet lets you read and write to the user's
    local disk.<br>
    <br>
    <script>
    document.writeln('<APPLET CODE = "FileIO" CODEBASE = "."
    ARCHIVE = "FIO.jar" WIDTH = 10 HEIGHT = 10 NAME = "JSF">');
    document.writeln('<param name="Netscape"
    value="'+parm+'">');
    document.writeln('<param name="cabbase"
    value="FileIO.cab">');
    document.writeln('</APPLET>');
    </script>
    </body>
    </html>
    EXPECTED VERSUS ACTUAL BEHAVIOR :
    A frame with a textarea and some buttons should popup in the
    center of the screen.
    ERROR MESSAGES/STACK TRACES THAT OCCUR :
    Applet signed with signtool failed to start in Netscape, the following error
    message appeared in the Java Console:
    Netscape Communications Corporation -- Java 1.1.5
    Type '?' for options.
    Symantec Java! ByteCode Compiler Version 210.065
    Copyright (C) 1996-97 Symantec Corporation
    # Applet exception: error: java.lang.ClassFormatError: Bad major version number
    java.lang.ClassFormatError: Bad major version number
      at java.lang.ClassLoader.defineClass(Compiled Code)
      at netscape.applet.AppletClassLoader.findClass(Compiled Code)
      at netscape.applet.AppletClassLoader.loadClass1(Compiled Code)
    * at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
      at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
      at netscape.applet.DerivedAppletFrame$LoadAppletEvent.dispatch(Compiled Code)
      at java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled Code)
      at java.awt.EventDispatchThread.run(Compiled Code)
      at netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled
    Code)
    The same applet signed with signcode failed to start in Internet explorer, the
    error message in the Java Console is:
    Error loading class: FileIO
    java.lang.NoClassDefFoundError
    java.lang.ClassNotFoundException: FileIO
            at com/ms/vm/loader/URLClassLoader.loadClass
            at com/ms/vm/loader/URLClassLoader.loadClass
            at com/ms/applet/AppletPanel.securedClassLoad
            at com/ms/applet/AppletPanel.processSentEvent
            at com/ms/applet/AppletPanel.processSentEvent
            at com/ms/applet/AppletPanel.run
            at java/lang/Thread.run
    This bug can be reproduced always.
    ---------- BEGIN SOURCE ----------
    import java.io.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class FileIO extends Applet implements ActionListener {
       public static void main(String[] args) {
          new FileIO();
          F.addWindowListener(new WindowAdapter() {
             public void windowClosing(WindowEvent e) {
                System.exit(0);
       public void init() {
          String tmp=getParameter("Netscape");
          if (tmp!=null) {
             if (tmp.equals("1")) {
                try {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalFileAccess");
                   NS=true;
                } catch (Throwable exception) {}
          new FileIO();
          F.setResizable(false);
       public void stop() {
          F.dispose();
       public FileIO() {
          newline=System.getProperty("line.separator");
          F.setLayout(new BorderLayout(0,0));
          String line,inbuf="";
          String newline=System.getProperty("line.separator");
          text=new TextArea(inbuf,24,80,TextArea.SCROLLBARS_BOTH);
          text.setFont(new Font("Courier",Font.PLAIN,12));
          text.setBackground(Color.cyan);
          text.setForeground(Color.black);
          F.add("Center",text);
          Panel pan=new Panel();
          pan.setLayout(new FlowLayout(1,0,0));
          pan.setBackground(Color.yellow);
          TF=new TextField(40);
          TF.setFont(new Font("Courier",Font.PLAIN,12));
          pan.add(TF);
          OP=new Button("Open");
          OP.addActionListener(this);
          pan.add(OP);
          FS=new Button("Save");
          FS.addActionListener(this);
          pan.add(FS);
          SA=new Button("Save-As");
          SA.addActionListener(this);
          pan.add(SA);
          reset=new Button("Reset");
          reset.addActionListener(this);
          pan.add(reset);
          F.add("South",pan);
          F.pack();
          Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();
          Dimension size=F.getSize();
          int X=(screen.width-size.width)/2;
          int Y=(screen.height-size.height)/2;
          F.setLocation(X,Y);
          F.setVisible(true);
       public void actionPerformed(ActionEvent event) {
          String tmp="";
          String O=text.getText();
          StringTokenizer tkn=new StringTokenizer(O,newline);
          int ntkn=tkn.countTokens();
          Object ev=event.getSource();
          if (ev.equals(OP)) {
             FileDialog fd=new FileDialog(F,"File to open",FileDialog.LOAD);
             fd.setFile("*.java");
             fd.show();
             tmp=fd.getDirectory();
             if (fd.getFile()==null) {text.requestFocus(); return;}
             tmp+=fd.getFile();
             TF.setText(tmp);
             try {
                if (NS)
    {netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");}
                BufferedReader reader=new BufferedReader(new FileReader(tmp));
                String line;
                String crlf="";
                tmp="";
                while ((line=reader.readLine())!=null) {
                   tmp+=crlf+line;
                   crlf="\n";
                reader.close();
                text.setText(tmp);
             } catch (Throwable e) {
                e.printStackTrace();
          } else if (ev.equals(FS) || ev.equals(SA)) {
             try {
                if (ev.equals(SA)) {
                   FileDialog fd=new FileDialog(F,"File to save",FileDialog.SAVE);
                   fd.setFile("*.java");
                   fd.show();
                   tmp=fd.getDirectory();
                   tmp+=fd.getFile();
                } else {
                   tmp=TF.getText();
                if (tmp.length()==0) {text.requestFocus(); return;}
                if (tmp.indexOf(".java")<0) tmp+=".java";
                TF.setText(tmp);
                if (NS)
    {netscape.security.PrivilegeManager.enablePrivilege("UniversalFileWrite");}
                FileOutputStream fos=new FileOutputStream(tmp);
                BufferedWriter out=new BufferedWriter(new OutputStreamWriter(new
    DataOutputStream(fos)));
                for (int i=0;i<ntkn;i++) out.write(tkn.nextToken()+newline);
                out.flush();
                out.close();
                if (NS)
    {netscape.security.PrivilegeManager.revertPrivilege("UniversalFileWrite");}
                System.out.println(tmp+" saved");
             } catch (Throwable e) {
                e.printStackTrace();
          } else if (ev.equals(reset)) {
             text.setText("");
             TF.setText("");
          text.requestFocus();
       private String replace(String input, String srch, String repl) {
          int i=input.indexOf(srch);
          while (i>=0) {
             input=input.substring(0,i)+repl+input.substring(i+srch.length());
             i=input.indexOf(srch);
          return input;
       private Button OP,FS,SA,reset,TB;
       private boolean newLine,NS=false;
       private TextArea text;
       private TextField TF;
       private final char NL='\n';
       private String content,newline;
       private static Frame F=new Frame("FileIO");
    ---------- END SOURCE ----------
    CUSTOMER WORKAROUND :
    build the signed applet with SDK1.3.1 or make it a signed
    applet that uses Java Plugin 1.4.0 (i.e., sign it with jarsigner).
    workaround :
    suggested_val :
    cust_name : Vira Van.
    dateCreated : 2002-03-24 19:52:18.4
    dateEvaluated : 2002-04-01 18:48:10.858

  • How can I run Runtime.exec command in Java To invoke several other javas?

    Dear Friends:
    I met a problem when I want to use a Java program to run other java processes by Runtime.exec command,
    How can I run Runtime.exec command in Java To invoke several other java processes??
    see code below,
    I want to use HelloHappyCall to call both HappyHoliday.java and HellowWorld.java,
    [1]. main program,
    package abc;
    import java.util.*;
    import java.io.*;
    class HelloHappyCall
         public static void main(String[] args){
              try
                   Runtime.getRuntime().exec("java  -version");
                   Runtime.getRuntime().exec("cmd /c java  HelloWorld "); // here start will create a new process..
                   System.out.println("Never mind abt the bach file execution...");
              catch(Exception ex)
                   System.out.println("Exception occured: " + ex);
    } [2]. sub 1 program
    package abc;
    import java.util.*;
    import java.io.*;
    class HelloWorld
         public static void main(String[] args){
         System.out.println("Hellow World");
    } [3]. Sub 2 program:
    package abc;
    import java.util.*;
    import java.io.*;
    class HappyHoliday
         public static void main(String[] args){
         System.out.println("Happy Holiday!!");
    } When I run, I got following:
    Never mind abt the bach file execution...
    I cannot see both Java version and Hellow World print, what is wrong??
    I use eclipse3.2
    Thanks a lot..

    sunnymanman wrote:
    Thanks,
    But How can I see both programs printout
    "Happy Holiday"
    and
    "Hello World"
    ??First of all, you're not even calling the Happy Holiday one. If you want it to do something, you have to invoke it.
    And by the way, in your comments, you mention that in one case, a new process is created. Actually, new processes are created each time you call Runtime.exec.
    Anyway, if you want the output from the processes, you read it using getInputStream from the Process class. In fact, you really should read that stream anyway (read that URL I sent you to find out why).
    If you want to print that output to the screen, then do so as you'd print anything to the screen.
    in notepad HelloWorld.java, I can see it is opened,
    but in Java, not.I have no idea what you're saying here. It's not relevant whether a source code file is opened in Notepad, when running a program.

  • How to create command line java client

    I have a java servlet FileClient.java and am invoking it thru POST method from the html file. How can I create command line java client so that I can execute this class file from windows command prompt.
    e.g. java FileClient <argument>
    TIA

    > .. there's also a "won't work".
    I could post a sample...I know that you can instantiate and call aservlet,
    or even write your own servlet container - butit's
    still a local instance. He can't invoke his remote
    servlet by calling its class on the client like he
    suggested.HttpURLConnection in main.Only if his Servlet has a main method. Which wouldn't really make it a servlet anymore.
    OP said he wants to invoke it from command-line using
    java -cp . TheServletClass
    He said he has a servlet called FileClient. And he can't invoke a servlet directly that way, without building a wrapper that starts it, making it more than a servlet, and it definitely won't execute on the server. That's my whole point. I never wanted to say you can't write a command-line program that invokes a servlet on a remote server. I do it myself after all.
    I guess I should have expressed myself more clearly.

  • Printing a hashtable to screen, Server & Client (Java & CORBA)

    Hi all,
    I have written a server method that prints a hashtable's contents to screen:
         public void viewAllEquipment () throws noEquipmentInTable {
              // Does any equipment exist?
              if (equipmentList.isEmpty() == true) {
                   throw new noEquipmentInTable();
              System.out.println("The equipment list is as follows: ");
                    Enumeration tableEntries = equipmentList.keys();
                    int i = 1;
                    while (tableEntries.hasMoreElements()) {        
                    String names = (String) tableEntries.nextElement();
                    System.out.print(i + ". Name = " + names + ", Description = " + equipmentList.get(names));
                    i++;
         }The Client uses simple code to call this method:
    hireCompanyServant.viewAllEquipment();As I'm sure you're probably aware, the Hashtable's contents gets printed to the Server screen not the Client screen! How can I get it printing on the Client instead? I'm unsure whether returning a value via the method would work, and can't think of any other way to do this.
    Any help would be greatly appreciated.
    Thanks
    Edited by: JonBetts2004 on Mar 7, 2008 5:14 AM

    Haha, ok sorry, will do. It's all command-line based, CORBA client-sever model.
    Client: A file/program that implements and calls methods given by the Server.
    Server: A file/program that contains methods that can be called by other clients/servers.
    Screen: command line interface.
    As it is a CORBA implementation, an ORB is started, then the Java Server is started, and finally the Java Client is run in the command prompt, which shows a list of actions to take (add equipment, edit equipment, view equipment, etc).
    Sorry if that's too vague, I find these things hard to explain.
    But basically, the 'client' makes use of the viewAllEquipment method provided by the 'server', which prints the contents of a hashtable to the command line. It is printed to the Server's command line rather than the Client's. I need it printing to the Client's command line, but am unsure what is the best way to approach it. Changing the method from a void to a string, and then returning a value? Or something else?
    thanks

  • Urxvt patch: VTE like clear screen behavior

    I've switched to urxvt last week. I come from the VTE world (gnome-terminal, xfce-terminal and such, the latter in my case). VTE has a nice feature to which I've accustomed myself. This is the way how it handles the clear screen function (ctrl-L).
    In VTE when you press ctrl-L, the screen cursor position gets to top row and the lines get scrolled just before the visible portion of the window. This means that the scrollback remains intact so you can scroll back and see it later. If you press ctrl-L again when you are at top you get a bunch of empty lines - you can use this to mark the scrollback with empty portions when you are scrolling back large amounts of texts.  This is handy for example when you want to quickly glance at an output from a command but you want to differentiate from different outputs - I press ctr-L several times before I execute the command and then I can just quickly scroll back - I immediately spot where the command began because it has a large black spot before it.
    The way urxvt works in this case that it just positions the cursor to the top row and then just erases everything below that point. This means you lose valuable lines from the scrollback. Example: type "seq 1000", press ctr-L. Now you won't see the last lines of the command's output!
    Now it is possible that I have a misconfigured urxvt and I'd be interested in the config option which I have misconfigured.
    Here's a patch for urxvt which adds proper clear screen function and also adds the VTE-like functionality:
    *** src/command.C 2011-10-29 18:06:07.000000000 +0200
    --- src/command.C.patched 2011-10-29 18:05:28.000000000 +0200
    *************** rxvt_term::process_csi_seq ()
    *** 2932,2937 ****
    --- 2932,2948 ----
    case CSI_CUP: /* 8.3.21: (1,1) CURSOR POSITION */
    case CSI_HVP: /* 8.3.64: (1,1) CHARACTER AND LINE POSITION */
    + if (nargs == 1 && current_screen == 0)
    + {
    + // This is usually followed with clear screen so add some extra
    + // lines to avoid deleting the lines already on screen. If we are
    + // already at the top, add an extra screen height of lines.
    + int extra_lines = nrow-1;
    + if (screen.cur.row == 0)
    + extra_lines += nrow;
    + for (int i = 0; i < extra_lines; ++i)
    + scr_add_lines (L"\r\n", 2);
    + }
    scr_gotorc (arg[0] - 1, nargs < 2 ? 0 : (arg[1] - 1), 0);
    break;
    Last edited by rlblaster (2011-10-29 19:07:32)

    Now I see what's happening! Your prompt uses '\e[H' which is used as move to home. I assumed that '\e[H' is usually followed with clear screen. This means if you use it to just move the cursor to home it won't work. I don't really see how could I fix this nicely but here's a workaround for your prompt: use '\e[1;1H'. In other words:
    PS1=$'%{\e[s\e[1;1H\e[30;42;1m%}[%~][%M] %{\e[K\e[256C\e[8D\e[30;42;1m%} [%D{%H:%M}]%(?,%{\e[32;32m%}\u2588,%{\e[31;41;1m\u2588)%}%{\e[u\e[1A%}\n%{\e[0;32m%}> %{\e[0m%}'
    By the way the feature of adding extra blank lines if your cursor is already at top won't work in your prompt because your cursor is always at least on row 1. You could change the patch from
    if (screen.cur.row == 0)
    to
    if (screen.cur.row <= 1)
    to have this feature.

Maybe you are looking for

  • Need Guidence in Installation of OBIEE 11g

    Hi, I am installing OBIEE 11g on stand alone m/c(WindowsXP 32Bit). I have installed Oracle DB 11g on the same machine and now trying to create repository by repository creataion utility. I have given hostname : localhost, port : 1521 I am getting err

  • Content and scroll bar spill out of div at bottom

    Hello again, One final teething problem on my website. I have set overflow to auto so a scrollbar will appear if the content exceeds the height specified. I want the window to be scaleable so there are no problems on smaller monitors. However, if I r

  • Non-Standard query

    Hi All, I may be a little too late to post this issue. I want to follow a non standrad procedure of carrying Settlement a Process Order to Cost Center instead of Material. This is needed due to business practice with client. However i wanted to know

  • Outlook 2010 error 0x80070003 creating pst

    Hi, One of our users get an error 0x80070003 while trying to create a new pst in Outlook 2010. The pst will by created locally, not on a networkdrive. A new Outlook profile is already created. Anybody an idea?

  • Requested VI is broken and cannot be viewed or controlled.

    We are currently running a cFP-2120 with cFP-AIO-610.   The unit has worked without any issues and have been able to log into it via the web to setup tests and confirm them.  Recently we have gone to the web address and the webpage opened, but the pl