eclipse.platform icon indicating copy to clipboard operation
eclipse.platform copied to clipboard

Debug console with command line history

Open laeubi opened this issue 2 years ago • 2 comments

Migrated from Bug 561001

We need a debug console with command line history.  The
current console does not provide this.  We are currently
using introspection to allow us to hook into ProcessConsole
to add command line history.  Pressing ctrl up arrow and 
ctrl down arrow allow us to navigate the history.

Introspection is a very fragile way of doing it.  Every time 
there is a new Eclipse release, we have to update our
code to track implementation changes in ProcessConsole.

We would like one of these

1) Provide a command line history in ProcessConsole.
or
2) Change ProcessConsole with supported API to allow
   developers to add a command line history.
   
Here is a high level overview of our fragile implementation
just to give you a sense of what is involved.

Given an IOConsoleViewer use intropsection to replace
the documentListener field with a new listener.  The
new listener will function like the original version
except that if text is being appended at the end of
the document, it will move the cursor there.  This works
even if the text being appended has no new-line inserted yet.

Given a process console, get the document, and replace the
partitioner.  The new partitioner functions exactly like 
the old one with the exception that when user input (a
command typed by the user, terminated with a newline)
is sent to the input stream, the user's command is also added
to the command history for the console's document.

Add handlers for ctrl up arrow and ctrl down arrow.  These
handlers grab the appropriate line in the history and stuff
it in to the console.  To stuff it into the console, we
call upone our improved document partitioner to do this.
The improved partitioner ensures the last partition is not
read only.  If it is, a new partition is created which is 
read write.  This last partition, newly created or not
is where history is inserted.  The last partition
may already be read write if the user has already started
typing a line.  In which case this partial line is replace
with the history line.

Our implementation makes simplifying assumptions about types
that we know to be true for our use case.

laeubi avatar Feb 22 '23 08:02 laeubi

I'd like to close this issue. Unfortunately I don't see an option to close it. (Perhaps because it was migrated by someone else.) There are two reasons to close it.

  • I found a better solution. Rather then using a console, my project at work should use a terminal. I came to that conclusion after a lot of experimenting with terminals.

  • The company I was working for, Coherent Logix, closed down.

chgenly avatar Jan 28 '24 02:01 chgenly

I just closed the pull request associated with this issue.

Thanks for all the support you've given me.

chgenly avatar Jan 28 '24 02:01 chgenly