From f992e0e21a66b5de4725b07fcf618b81fd486d12 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sun, 5 Nov 2017 12:56:41 +0100 Subject: [PATCH] Add the prompt colon to the default theme. - Fix dumping of theme localization of the decimal-point. Force it to be always a '.'. --- doc/default_theme.rasi | 9 ++++++++- doc/old-theme-convert-output.rasi | 9 ++++++++- lexer/theme-lexer.l | 1 - source/theme.c | 12 ++++++++++-- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/doc/default_theme.rasi b/doc/default_theme.rasi index ebf9bbbb..0838d7e2 100644 --- a/doc/default_theme.rasi +++ b/doc/default_theme.rasi @@ -116,9 +116,10 @@ button selected { text-color: @selected-normal-foreground; } inputbar { - spacing: 3px ; + spacing: 0px ; text-color: @normal-foreground; padding: 1px ; + children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; } case-indicator { spacing: 0; @@ -132,3 +133,9 @@ prompt { spacing: 0; text-color: @normal-foreground; } +textbox-prompt-colon { + expand: false; + str: ":"; + margin: 0px 0.3000em 0.0000em 0.0000em ; + text-color: inherit; +} diff --git a/doc/old-theme-convert-output.rasi b/doc/old-theme-convert-output.rasi index fb2c578d..77c00ebf 100644 --- a/doc/old-theme-convert-output.rasi +++ b/doc/old-theme-convert-output.rasi @@ -116,9 +116,10 @@ button selected { text-color: @selected-normal-foreground; } inputbar { - spacing: 3px ; + spacing: 0px ; text-color: @normal-foreground; padding: 1px ; + children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; } case-indicator { spacing: 0; @@ -132,3 +133,9 @@ prompt { spacing: 0; text-color: @normal-foreground; } +textbox-prompt-colon { + expand: false; + str: ":"; + margin: 0px 0.3000em 0.0000em 0.0000em ; + text-color: inherit; +} diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index e7430355..de53f546 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -167,7 +167,6 @@ STRING \"{UANYN}*\" HEX [[:xdigit:]] NUMBER [[:digit:]] PNNUMBER [-+]?[[:digit:]]+ -REAL [-+]?[[:digit:]]+(\.[[:digit:]]+)? PX (px) EM (em) CH (ch) diff --git a/source/theme.c b/source/theme.c index e0a5dfbb..fa7203c3 100644 --- a/source/theme.c +++ b/source/theme.c @@ -139,16 +139,24 @@ void rofi_theme_free ( ThemeWidget *widget ) /** * print */ +inline static void printf_double ( double d ) +{ + char buf[G_ASCII_DTOSTR_BUF_SIZE]; + g_ascii_formatd ( buf, G_ASCII_DTOSTR_BUF_SIZE,"%.4lf", d ); + fputs ( buf, stdout ); +} static void rofi_theme_print_distance ( RofiDistance d ) { if ( d.type == ROFI_PU_PX ) { printf ( "%upx ", (unsigned int) d.distance ); } else if ( d.type == ROFI_PU_PERCENT ) { - printf ( "%f%% ", d.distance ); + printf_double ( d.distance ); + fputs ( "%% ", stdout ); } else { - printf ( "%fem ", d.distance ); + printf_double ( d.distance ); + fputs ( "em ", stdout ); } if ( d.style == ROFI_HL_DASH ) { printf ( "dash " );