feat: don't show tooltips for chapters that only end a range (#153)
Chapters that end a chapter range and are matched by something other then `.*` are now not shown when hovering over that chapter, unless that chapter is also used to start another range.
This commit is contained in:

committed by
GitHub

parent
7224760820
commit
a4b32e4edc
@@ -152,6 +152,10 @@ default_directory=~/
|
|||||||
# They only need to occur in a title, not match it completely.
|
# They only need to occur in a title, not match it completely.
|
||||||
# Matching is case insensitive.
|
# Matching is case insensitive.
|
||||||
#
|
#
|
||||||
|
# Chapters that end a range and got matched by an `end_pattern` other then `.*`
|
||||||
|
# will not be shown on hover, unless that chapter is also used to start another
|
||||||
|
# range.
|
||||||
|
#
|
||||||
# `color` is a `bbggrr` hexadecimal color code.
|
# `color` is a `bbggrr` hexadecimal color code.
|
||||||
# `opacity` is a float number from 0 to 1.
|
# `opacity` is a float number from 0 to 1.
|
||||||
#
|
#
|
||||||
|
@@ -1750,8 +1750,10 @@ function render_timeline(this)
|
|||||||
for i = #state.chapters, 1, -1 do
|
for i = #state.chapters, 1, -1 do
|
||||||
local chapter = state.chapters[i]
|
local chapter = state.chapters[i]
|
||||||
if hovered_seconds >= chapter.time then
|
if hovered_seconds >= chapter.time then
|
||||||
chapter_title = chapter.title_wrapped
|
if not chapter.is_end_only then
|
||||||
chapter_title_width = chapter.title_wrapped_width
|
chapter_title = chapter.title_wrapped
|
||||||
|
chapter_title_width = chapter.title_wrapped_width
|
||||||
|
end
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2801,6 +2803,7 @@ for _, definition in ipairs(split(options.chapter_ranges, ' *,+ *')) do
|
|||||||
-- If there is already a range started, should we append or overwrite?
|
-- If there is already a range started, should we append or overwrite?
|
||||||
-- I chose overwrite here.
|
-- I chose overwrite here.
|
||||||
current_range = {['start'] = chapter}
|
current_range = {['start'] = chapter}
|
||||||
|
chapter.is_end_only = false
|
||||||
end
|
end
|
||||||
|
|
||||||
local function end_range(chapter)
|
local function end_range(chapter)
|
||||||
@@ -2821,8 +2824,12 @@ for _, definition in ipairs(split(options.chapter_ranges, ' *,+ *')) do
|
|||||||
|
|
||||||
-- Is ending check and handling
|
-- Is ending check and handling
|
||||||
if chapter_range.end_patterns then
|
if chapter_range.end_patterns then
|
||||||
|
chapter.is_end_only = false
|
||||||
for _, end_pattern in ipairs(chapter_range.end_patterns) do
|
for _, end_pattern in ipairs(chapter_range.end_patterns) do
|
||||||
is_end = is_end or lowercase_title:find(end_pattern) ~= nil
|
if lowercase_title:find(end_pattern) then
|
||||||
|
is_end = true
|
||||||
|
chapter.is_end_only = chapter.is_end_only or end_pattern ~= '.*'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_end then
|
if is_end then
|
||||||
|
Reference in New Issue
Block a user