feat(build): Add flag for drawing visible whitespace

This commit is contained in:
Michael Carlberg 2017-01-13 11:04:43 +01:00
parent a26a15d485
commit 6fb48c8e6f
6 changed files with 20 additions and 5 deletions

View File

@ -51,8 +51,13 @@ option(CXXLIB_GCC "Link against stdlibc++" OFF)
option(BUILD_IPC_MSG "Build ipc messager" ON)
option(BUILD_TESTS "Build testsuite" OFF)
option(DEBUG_LOGGER "Enable extra debug logging" OFF)
option(VERBOSE_TRACELOG "Enable verbose trace logs" OFF)
option(DEBUG_LOGGER_TRACE "Enable verbose trace logs" OFF)
option(DEBUG_HINTS "Enable hints rendering" OFF)
option(DEBUG_WHITESPACE "Enable whitespace debug" OFF)
if(NOT DEBUG_LOGGER AND DEBUG_LOGGER_TRACE)
set(DEBUG_LOGGER_TRACE OFF)
endif()
option(ENABLE_CCACHE "Enable ccache support" OFF)
option(ENABLE_ALSA "Enable alsa support" ON)

View File

@ -56,8 +56,9 @@ message(STATUS "--------------------------")
colored_option(STATUS " Build polybar-msg ${BUILD_IPC_MSG}" BUILD_IPC_MSG "32;1" "37;2")
colored_option(STATUS " Build testsuite ${BUILD_TESTS}" BUILD_TESTS "32;1" "37;2")
colored_option(STATUS " Debug logging ${DEBUG_LOGGER}" DEBUG_LOGGER "32;1" "37;2")
colored_option(STATUS " Verbose tracing ${VERBOSE_TRACELOG}" VERBOSE_TRACELOG "32;1" "37;2")
colored_option(STATUS " + Verbose tracing ${DEBUG_LOGGER_TRACE}" DEBUG_LOGGER_TRACE "32;1" "37;2")
colored_option(STATUS " Draw debug hints ${DEBUG_HINTS}" DEBUG_HINTS "32;1" "37;2")
colored_option(STATUS " Draw whitespace ${DEBUG_WHITESPACE}" DEBUG_WHITESPACE "32;1" "37;2")
colored_option(STATUS " Enable ccache ${ENABLE_CCACHE}" ENABLE_CCACHE "32;1" "37;2")
message(STATUS "--------------------------")
colored_option(STATUS " Enable alsa ${ENABLE_ALSA}" ENABLE_ALSA "32;1" "37;2")

View File

@ -40,7 +40,7 @@ class logger {
void trace(string message, Args... args) const {
output(loglevel::TRACE, message, args...);
}
#ifdef VERBOSE_TRACELOG
#ifdef DEBUG_LOGGER_TRACE
template <typename... Args>
void trace_x(string message, Args... args) const {
output(loglevel::TRACE, message, args...);

View File

@ -41,8 +41,9 @@
#cmakedefine XPP_EXTENSION_LIST @XPP_EXTENSION_LIST@
#cmakedefine DEBUG_LOGGER
#cmakedefine VERBOSE_TRACELOG
#cmakedefine DEBUG_LOGGER_TRACE
#cmakedefine DEBUG_HINTS
#cmakedefine DEBUG_WHITESPACE
static const size_t EVENT_SIZE = 64;

View File

@ -616,7 +616,7 @@ void bar::handle(const evt::expose& evt) {
* pseudo-transparent background when it changes
*/
void bar::handle(const evt::property_notify& evt) {
#ifdef VERBOSE_TRACELOG
#ifdef DEBUG_LOGGER_TRACE
string atom_name = m_connection.get_atom_name(evt->atom).name();
m_log.trace_x("bar: property_notify(%s)", atom_name);
#endif

View File

@ -1,5 +1,6 @@
#include <cassert>
#include "settings.hpp"
#include "components/parser.hpp"
#include "components/types.hpp"
#include "events/signal.hpp"
@ -165,6 +166,13 @@ void parser::codeblock(string&& data, const bar_settings& bar) {
* Process text contents
*/
size_t parser::text(string&& data) {
#ifdef DEBUG_WHITESPACE
string::size_type p;
while ((p = data.find(' ')) != string::npos) {
data.replace(p, 1, "-"s);
}
#endif
const uint8_t* utf{reinterpret_cast<const uint8_t*>(&data[0])};
// clang-format off