1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Add strikethrough highlight method.

This commit is contained in:
Dave Davenport 2017-05-18 07:59:37 +02:00
parent bcea55c398
commit 72afc7b039
8 changed files with 50 additions and 29 deletions

View file

@ -101,6 +101,7 @@ AC_CHECK_FUNC([fcntl],, AC_MSG_ERROR("Could not find fcntl"))
AC_CHECK_FUNC([setlocale],,AC_MSG_ERROR("Could not find setlocale"))
AC_CHECK_FUNC([atexit],, AC_MSG_ERROR("Could not find atexit in c library"))
AC_CHECK_FUNC([glob],, AC_MSG_ERROR("Could not find glob in c library"))
AC_CHECK_FUNC([toupper],, AC_MSG_ERROR("Could not find toupper in c library"))
AC_CHECK_HEADER([math.h],, AC_MSG_ERROR("Could not find math.h header file"))
AC_SEARCH_LIBS([floor],[m],, AC_MSG_ERROR("Could not find floor in math library"))
@ -122,6 +123,9 @@ PKG_CHECK_MODULES([pango], [pango pangocairo])
PKG_CHECK_MODULES([cairo], [cairo cairo-xcb])
PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0 ])
dnl ---------------------------------------------------------------------
dnl check - Unit testing.
dnl ---------------------------------------------------------------------
AC_ARG_ENABLE([check], AS_HELP_STRING([--disable-check], [Build with checks using check library (default: enabled)]))
AS_IF([test "x${enable_check}" != "xno"], [ PKG_CHECK_MODULES([check],[check >= 0.11.0], [HAVE_CHECK=1]) ])

View file

@ -282,6 +282,7 @@ For example:
```
background: #FF0000;
foreground: rgba(0,0,1, 0.5);
text: SeaGreen;
```
## Text style

View file

@ -429,6 +429,7 @@ For example:
background: #FF0000;
foreground: rgba(0,0,1, 0\.5);
text: SeaGreen;
.
.fi
.

View file

@ -42,6 +42,8 @@ typedef enum
HL_BOLD = 1,
/** underline */
HL_UNDERLINE = 2,
/** strikethrough */
HL_STRIKETHROUGH = 16,
/** italic */
HL_ITALIC = 4,
/** color */

View file

@ -188,6 +188,7 @@ NONE "none"
BOLD "bold"
UNDERLINE "underline"
ITALIC "italic"
STRIKETHROUGH "strikethrough"
/* ANGLES */
@ -445,7 +446,7 @@ if ( queue == NULL ){
<PROPERTIES>{CMYK} { return T_COL_CMYK; }
/* Fluff */
<PROPERTIES>{S_T_PARENT_LEFT} { return T_PARENT_LEFT; }
<PROPERTIES>{S_T_PARENT_RIGHT} { return T_PARENT_RIGHT;}
<PROPERTIES>{S_T_PARENT_RIGHT} { return T_PARENT_RIGHT; }
<PROPERTIES>{COMMA} { return T_COMMA; }
<PROPERTIES>{FORWARD_SLASH} { return T_FORWARD_SLASH; }
/* Position */
@ -459,6 +460,7 @@ if ( queue == NULL ){
<PROPERTIES>{BOLD} { return T_BOLD; }
<PROPERTIES>{ITALIC} { return T_ITALIC; }
<PROPERTIES>{UNDERLINE} { return T_UNDERLINE; }
<PROPERTIES>{STRIKETHROUGH} { return T_STRIKETHROUGH; }
<PROPERTIES>{ANGLE_DEG} { return T_ANGLE_DEG; }
<PROPERTIES>{ANGLE_RAD} { return T_ANGLE_RAD; }

View file

@ -173,6 +173,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b)
%token T_BOLD "Bold"
%token T_ITALIC "Italic"
%token T_UNDERLINE "Underline"
%token T_STRIKETHROUGH "Strikethrough"
%token T_DASH "Dash"
%token T_SOLID "Solid"
@ -397,6 +398,7 @@ t_property_highlight_style
: T_NONE { $$ = HL_NONE; }
| T_BOLD { $$ = HL_BOLD; }
| T_UNDERLINE { $$ = HL_UNDERLINE; }
| T_STRIKETHROUGH { $$ = HL_STRIKETHROUGH; }
| T_ITALIC { $$ = HL_ITALIC; }
;

View file

@ -423,6 +423,12 @@ PangoAttrList *helper_token_match_get_pango_attr ( ThemeHighlight th, GRegex **t
pa->end_index = end;
pango_attr_list_insert ( retv, pa );
}
if ( th.style & HL_STRIKETHROUGH ) {
PangoAttribute *pa = pango_attr_strikethrough_new ( TRUE );
pa->start_index = start;
pa->end_index = end;
pango_attr_list_insert ( retv, pa );
}
if ( th.style & HL_ITALIC ) {
PangoAttribute *pa = pango_attr_style_new ( PANGO_STYLE_ITALIC );
pa->start_index = start;

View file

@ -169,6 +169,9 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p
if ( p->value.highlight.style & HL_UNDERLINE ) {
printf ( "underline " );
}
if ( p->value.highlight.style & HL_STRIKETHROUGH ) {
printf ( "strikethrough " );
}
if ( p->value.highlight.style & HL_ITALIC ) {
printf ( "italic " );
}