Skip to content

Linux specificTheXtermDebuggerTerminal

dghart edited this page Jun 22, 2017 · 2 revisions

In recent CodeLite versions on Linux, the terminal used to show any output from the debugged program is xterm. While this does work, it's not everyone's idea of a modern gui program; in particular by default it has no scrollbar, and standard keyboard shortcuts for Copy/Cut/Paste/SelectAll etc don't work.

Fortunately xterm is highly configurable. Some distros have started this process: debian, openSUSE and fedora use black-on-white colouration rather than the default 1980s white-on-black, and openSUSE and fedora also have a basic scrollbar.

It's not hard to make further improvements. All you have to do is to put appropriate settings into a ~/.Xresources file. I've created the following one:

XTerm*VT100.translations: #override \n\
        <Key>Prior:       scroll-back(1,page) \n\
        <Key>Next:        scroll-forw(1,page) \n\
        Ctrl<Key>Home:    scroll-back(1000,page) \n\
        Ctrl<Key>End:     scroll-forw(1000,page) \n\
        <Btn1Up>:         select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0) \n

! Make the scrollbar behave as it should in a modern gui
XTerm*VT100.scrollbar.translations:#override \n\
     <Btn5Down>:StartScroll(Forward) \n\
     <Btn1Down>:StartScroll(Continuous) MoveThumb() NotifyThumb() \n\
     <Btn4Down>:StartScroll(Backward) \n\
     <Btn1Motion>:MoveThumb() NotifyThumb() \n\
     <BtnUp>:  NotifyScroll(Proportional) EndScroll()

! white text on black background
XTerm.VT100*color0: white
XTerm.VT100*color15: black
! Probably unnecessary, but to be safe:
XTerm*foreground: rgb:FF/FF/FF
XTerm*background: rgb:00/00/00

! Scrollbar on the right
XTerm*rightScrollBar: true
XTerm*ScrollBar: true

! Prevent entering more text from causing a scroll-to-end
XTerm*scrollTtyOutput: false

! Allow 5000 lines of history, rather than the default 64!
XTerm*savelines: 5000

!Triple-click selects the whole history
XTerm.vt100.on3Clicks: all

!Use a nice and modern font
xterm*faceName: Monospace:size=12:antialias=true

It won't take effect immediately unless you run the command:

$> xrdb -merge ~/.Xresources

This gives you:

  • White on black output; if you don't like that, change the appropriate section.
  • A scrollbar on the right, which behaves in the way a modern one does.
  • 5000 lines of scroll-back.
  • Useful shortcuts: ** Prior (Page-Up) scrolls back one page. ** Next scrolls forward one page ** Ctrl-Home scrolls to the start of the output ** Ctrl-End scrolls to the end of the output

The Btn1Up line makes the selection go both to the Primary selection and to the Clipboard.

I've not bothered with a Cut shortcut, which is unlikely to be useful in this situation. However I've so far failed to make Ctrl-A do Select-All (if you find a way, please let me know). Instead the XTerm.vt100.on3Clicks: all line makes Select-All happen for a mouse left triple-click.

There are plenty more options that you can set if you wish; see the xterm man page and many other places that your favourite search-engine will find for you.

Clone this wiki locally