Joachim Breitner's Homepage
Copying HTML from gnome-terminal
One of the first things that I worked on here at DebConf11 is supporting the HTML target in gnome-terminal. This means that if you copy a part of the screen and paste it into some application that handles HTML (such as evolution or my blog’s edit field), attributes such as color and boldness are preserved. Here are some examples:
A man page
MAN(1) Manual pager utils MAN(1)
NAME
man - an interface to the on-line reference manuals
SYNOPSIS
man [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-m
system[,...]] [-M path] [-S list] [-e extension] [-i|-I] [--regex|--wildcard]
[--names-only] [-a] [-u] [--no-subpages] [-P pager] [-r prompt] [-7] [-E
encoding] [--no-hyphenation] [--no-justification] [-p string] [-t]
[-T[device]] [-H[browser]] [-X[dpi]] [-Z] [[section] page ...] ...
man -k [apropos options] regexp ...
man -K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ...
man -f [whatis options] page ...
man -l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale]
[-P pager] [-r prompt] [-7] [-E encoding] [-p string] [-t] [-T[device]]
[-H[browser]] [-X[dpi]] [-Z] file ...
man -w|-W [-C file] [-d] [-D] page ...
man -c [-C file] [-d] [-D] page ...
man [-hV]
DESCRIPTION
man is the system's manual pager. Each page argument given to man is normally
the name of a program, utility or function. The manual page associated with
each of these arguments is then found and displayed. A section, if provided,
Manual page man(1) line 1 (press h for help or q to quit)
A coloured diff from git
commit 55c514ae6a714abcfa818c33f00a2c051412c3d9 Author: Joachim Breitner <mail@joachim-breitner.de> Date: Thu Jul 21 12:08:56 2011 +0200 Refactor vte_terminal_determine_colors_internal to work on VteCellAttr instead of VteCell, and use it in vte_terminal_cellattr_to_html. diff --git a/src/vte.c b/src/vte.c index 8bcc95d..7d4a6f1 100644 --- a/src/vte.c +++ b/src/vte.c @@ -6532,19 +6532,18 @@ swap (guint *a, guint *b) static void vte_terminal_determine_colors_internal(VteTerminal *terminal, - const VteCell *cell, + const VteCellAttr *attr, gboolean selected, gboolean cursor, guint *pfore, guint *pback) { guint fore, back;
Midnight commander
Links Datei Befehl Optionen Rechts ┌<─ ~/build/gnome-terminal/vte ───────────.[^]>┐┌<─ ~/build/gnome-terminal/vte ────────────.[^]>┐ │'n Name │ Größe │Modifikations││'n Name │ Größe │Modifikations│ │/.. │ÜBERVZ.│20. Jul 18:23││/.. │ÜBERVZ.│20. Jul 18:23│ │/.git │ 4096│22. Jul 12:42││/.git │ 4096│22. Jul 12:42│ │/autom4te.cache │ 4096│22. Jul 11:20││/autom4te.cache │ 4096│22. Jul 11:20│ │/doc │ 4096│22. Jul 11:20││/doc │ 4096│22. Jul 11:20│ │/glade │ 4096│22. Jul 11:20││/glade │ 4096│22. Jul 11:20│ │/gnome-pty-helper │ 4096│22. Jul 09:47││/gnome-pty-helper │ 4096│22. Jul 09:47│ │/perf │ 4096│22. Jul 11:20││/perf │ 4096│22. Jul 11:20│ │/po │ 4096│22. Jul 11:20││/po │ 4096│22. Jul 11:20│ │/src │ 12288│22. Jul 12:41││/src │ 12288│22. Jul 12:41│ │/termcaps │ 4096│22. Jul 11:20││/termcaps │ 4096│22. Jul 11:20│ │ .gitignore │ 935│22. Jul 11:20││ .gitignore │ 935│22. Jul 11:20│ │ AUTHORS │ 41│20. Jul 18:25││ AUTHORS │ 41│20. Jul 18:25│ │ COPYING │ 35068│22. Jul 11:11││ COPYING │ 35068│22. Jul 11:11│ │ ChangeLog.pre-git │ 433051│20. Jul 18:25││ ChangeLog.pre-git │ 433051│20. Jul 18:25│ │ HACKING │ 905│20. Jul 18:25││ HACKING │ 905│20. Jul 18:25│ │ MAINTAINERS │ 118│20. Jul 18:25││ MAINTAINERS │ 118│20. Jul 18:25│ │ Makefile │ 30512│22. Jul 11:20││ Makefile │ 30512│22. Jul 11:20│ │ Makefile.am │ 1247│22. Jul 11:11││ Makefile.am │ 1247│22. Jul 11:11│ │ Makefile.in │ 28812│22. Jul 11:20││ Makefile.in │ 28812│22. Jul 11:20│ │ NEWS │ 43910│20. Jul 18:25││ NEWS │ 43910│20. Jul 18:25│ │ README │ 496│20. Jul 18:25││ README │ 496│20. Jul 18:25│ │ aclocal.m4 │ 377874│22. Jul 11:20││ aclocal.m4 │ 377874│22. Jul 11:20│ │*autogen.sh │ 610│20. Jul 18:25││*autogen.sh │ 610│20. Jul 18:25│ ├──────────────────────────────────────────────┤├───────────────────────────────────────────────┤ │ÜBERVZ. ││ÜBERVZ. │ └────────────────────────────── 10G/104G (9%) ─┘└─────────────────────────────── 10G/104G (9%) ─┘ Hint: To look at the output of a command in the viewer, use M-! ~/build/gnome-terminal/vte $ 1Hilfe 2Menü 3Ansicht 4Bear~ten 5Kopieren 6Ver~ben 7Mkdir 8Löschen 9Menüs 10Beenden
These changes are discussed in GNOME Bugzilla bug #365121 and can be downloaded in my git repository. Unfortunately, I later found out that I was not basing my work on the current development version, which has changed considerably, so we will see how and when my changes will actually make it into GNOME. Also note that my blog’s HTML editor actually modifies the HTML code, so looking at the source of this page does not give you the code that I generate.
Update: I ported my changes onto the vte-next branch, so they could be merged now. Please follow the bug report if you want to know more.
Comments
I could add spaces to the copied data to fill up the line, but then the spaces are not there and this might be a problem in other applications...
Do you have a good idea here? And feel free to discuss this in the bug report, there it is more likely to be found than here.
Have something to say? You can post a comment by sending an e-Mail to me at <mail@joachim-breitner.de>, and I will include it here.
The menu bar of Midnight Commander looks truncated. Do you intend to fix that?