Fix/be respectful of special characters like exclamation marks in highlight phrases since they are also word boundaries (#1890)

* Add missing includes

We would normally have these included in another file already, or even
the precompiled headers, but having the files included here too makes
testing single parts easier.

* Modify the regex building of highlight phrases for non-regex phrases

For phrases like !test, the word boundary checking we did before was not
enough, so we now check for either a word boundary, a whitespace
character, or the line start/end.

* Add tests for ensuring I haven't fully broken the highlight system

* Add changelog entry
This commit is contained in:
pajlada
2020-08-22 09:37:03 -04:00
committed by GitHub
parent 17b26ef59c
commit 0cbddf7e9b
7 changed files with 222 additions and 7 deletions
+9 -3
View File
@@ -6,11 +6,11 @@ include_directories(src)
set(chatterino_SOURCES
src/common/UsernameSet.cpp
src/controllers/highlights/HighlightPhrase.cpp
)
find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5 5.9.0 REQUIRED COMPONENTS
Core
Core Widgets
)
# set(CMAKE_AUTOMOC ON)
@@ -25,12 +25,18 @@ if (BUILD_TESTS)
tests/src/main.cpp
tests/src/UsernameSet.cpp
tests/src/HighlightPhrase.cpp
)
target_link_libraries(chatterino-test Qt5::Core)
target_link_libraries(chatterino-test Qt5::Core Qt5::Widgets)
target_link_libraries(chatterino-test gtest gtest_main)
set(BUILD_TESTS OFF)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/lib/serialize PajladaSerialize)
target_link_libraries(chatterino-test PajladaSerialize)
gtest_discover_tests(chatterino-test)
else()
message(FATAL_ERROR "This cmake file is only intended for tests right now. Use qmake to build chatterino2")