Commit c5d4df16 authored by gi1242's avatar gi1242

Add an option to truncate the start of tab titles if they are too long...

Add an option to truncate the start of tab titles if they are too long (non-xft only). Patch by Jim Diamond.
parent 938cb5b9
......@@ -587,7 +587,7 @@ option must be enabled.
.Bl -tag -width 4n
.
.It Fl aht
Automatically hide or show the tab bar depending on the number of tabs. On startup, the tabbar is shown only if there are more than one tabs present. If there is only one tab, and a new one is created, then the tabbar is shown. If there are two tabs and one is closed, then the tabbar is hidden. A keyboard shortcut used at any time to hide / show the tabbar.
Automatically hide or show the tab bar depending on the number of tabs. On startup, the tabbar is shown only if there are more than one tabs present. If there is only one tab, and a new one is created, then the tabbar is shown. If there are two tabs and one is closed, then the tabbar is hidden. A keyboard shortcut used at any time to hide / show the tabbar.
.Op Cm autohideTabbar
.BO at
Run command specified with
......@@ -605,10 +605,14 @@ macro is honored.
Show tabbar at bottom.
.Op Cm bottomTabbar
.
.BO ce
If a tab title is too long to fit in the space provided, then truncate the end (default). If this option is unset, then truncate the start. This only has effect when Xft is not used.
.Op Cm chopEnd
.
.It Fl e Op Ar arguments ...
Specifies the program (and its command line arguments) to be run in the
.Nm
window. By default this command is only run initially, and all tabs created after startup will run the default shell (or program supplied by
window. By default this command is only run initially, and all tabs created after startup will run the default shell (or program supplied by
.Fl profile Ns Ar %d Ns ). This behaviour can be overridden with the
.Fl at
option.
......@@ -1704,13 +1708,13 @@ pages instead of lines. If
.Ar amount
ends with
.Sq %%
then scroll
then scroll
.Ar amount
percent of a page. For example,
percent of a page. For example,
.Ar -50%%
would scroll backwards one half of the current page size. (Note, we need to use two percent signs, as macro arguments are percent interpolated. Thus putting only one percent sign, will work, but cause
would scroll backwards one half of the current page size. (Note, we need to use two percent signs, as macro arguments are percent interpolated. Thus putting only one percent sign, will work, but cause
.Nm
to print a warning about an unrecognized flag)
to print a warning about an unrecognized flag.)
.\" ------------------------------------------------------------
.It Ic Copy
Copy selection into clipboard (not implemented).
......
......@@ -354,8 +354,11 @@ typedef enum {
(Opt2_veryBold | Opt2_smartResize)
#endif
#define Opt3_chopEnd ((1LU<<2) | IS_OPTION3)
#define DEFAULT_OPTIONS3 \
(IS_OPTION3)
(Opt3_chopEnd | IS_OPTION3)
#define DEFAULT_OPTIONS4 \
(IS_OPTION4)
......
......@@ -540,8 +540,25 @@ draw_title (rxvt_t* r, int x, int y, int tnum, Region region)
* If % interpolation was not possible, or returned a 1 byte long
* string, then just copy the title over.
*/
STRNCPY( str, PVTS(r,tnum)->tab_title , r->TermWin.maxTabWidth );
str[r->TermWin.maxTabWidth] = '\0';
/*
* Change by Jim Diamond (2008/08/04):
* show the suffix of the title, not the prefix, if chopEnd
* was set to "start" in .mrxvtrc (or '-ce start' was given).
* This only affects the non-xft case.
*/
if( ISSET_OPTION( r, Opt3_chopEnd ) )
{
STRNCPY( str, PVTS(r,tnum)->tab_title , r->TermWin.maxTabWidth );
str[r->TermWin.maxTabWidth] = '\0';
}
else
{
int title_len = STRLEN(PVTS(r,tnum)->tab_title);
int excess = max(title_len - r->TermWin.maxTabWidth, 0);
STRNCPY( str, PVTS(r,tnum)->tab_title + excess,
r->TermWin.maxTabWidth + 1 ); /* + 1 ensures we get \0 */
}
}
......
......@@ -128,6 +128,8 @@ static const struct {
STRG(Rs_maxTabWidth, "maxTabWidth", "mtw", "number", "maximum (char) title width of all tabs", 0),
STRG(Rs_minVisibleTabs, "minVisibleTabs", "mvt", "number",
"minimum # of tabs to keep visible (requires xftpfn)", 0),
BOOL( "chopEnd", "ce", Opt3_chopEnd,
"Chop right end of tab titles. (If false, chop left end)" ),
BOOL( "highlightTabOnBell", "htb", Opt2_hlTabOnBell,
"highlighting inactive tabs only when bell sounds" ),
BOOL( "syncTabTitle", "stt", Opt2_syncTabTitle,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment