mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-10 06:54:04 +09:00
fix: subtitles disappear with the notification; padding on subtitle block
This commit is contained in:
@@ -133,7 +133,12 @@ function displayFormattedLine(line) {
|
|||||||
|
|
||||||
let i = 0
|
let i = 0
|
||||||
let inBoldOrItalic = false
|
let inBoldOrItalic = false
|
||||||
|
|
||||||
|
// insert initial padding block
|
||||||
|
con.color_pair(0, 255)
|
||||||
|
con.prnch(0xDE)
|
||||||
|
con.color_pair(231, 0)
|
||||||
|
|
||||||
while (i < line.length) {
|
while (i < line.length) {
|
||||||
if (i < line.length - 2 && line[i] === '<') {
|
if (i < line.length - 2 && line[i] === '<') {
|
||||||
// Check for opening tags
|
// Check for opening tags
|
||||||
@@ -159,6 +164,11 @@ function displayFormattedLine(line) {
|
|||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// insert final padding block
|
||||||
|
con.color_pair(0, 255)
|
||||||
|
con.prnch(0xDD)
|
||||||
|
con.color_pair(231, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
function displaySubtitle(text, position = 0) {
|
function displaySubtitle(text, position = 0) {
|
||||||
@@ -214,24 +224,23 @@ function displaySubtitle(text, position = 0) {
|
|||||||
case 1: // bottom left
|
case 1: // bottom left
|
||||||
case 2: // center left
|
case 2: // center left
|
||||||
case 3: // top left
|
case 3: // top left
|
||||||
startCol = 2
|
startCol = 1
|
||||||
break
|
break
|
||||||
case 5: // top right
|
case 5: // top right
|
||||||
case 6: // center right
|
case 6: // center right
|
||||||
case 7: // bottom right
|
case 7: // bottom right
|
||||||
startCol = Math.max(1, 78 - getVisualLength(line))
|
startCol = Math.max(1, 78 - getVisualLength(line) - 2)
|
||||||
break
|
break
|
||||||
case 0: // bottom center
|
case 0: // bottom center
|
||||||
case 4: // top center
|
case 4: // top center
|
||||||
case 8: // dead center
|
case 8: // dead center
|
||||||
default:
|
default:
|
||||||
startCol = Math.max(1, Math.floor((80 - longestLineLength) / 2) + 1)
|
startCol = Math.max(1, Math.floor((80 - longestLineLength - 2) / 2) + 1)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
con.move(row, startCol)
|
con.move(row, startCol)
|
||||||
// TODO insert half-width pillars to cap the subtitle blocks
|
|
||||||
|
|
||||||
// Parse and display line with formatting tag support
|
// Parse and display line with formatting tag support
|
||||||
displayFormattedLine(line)
|
displayFormattedLine(line)
|
||||||
}
|
}
|
||||||
@@ -609,7 +618,8 @@ try {
|
|||||||
if (interactive) {
|
if (interactive) {
|
||||||
notifHideTimer += (t2 - t1)
|
notifHideTimer += (t2 - t1)
|
||||||
if (!notifHidden && notifHideTimer > (NOTIF_SHOWUPTIME + FRAME_TIME)) {
|
if (!notifHidden && notifHideTimer > (NOTIF_SHOWUPTIME + FRAME_TIME)) {
|
||||||
con.clear()
|
con.move(1, 1)
|
||||||
|
print(' '.repeat(79))
|
||||||
notifHidden = true
|
notifHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ static const int MP2_RATE_TABLE[] = {80, 128, 192, 256, 384};
|
|||||||
// from dataset of three videos with Q0..Q95: (real life video, low res pixel art, high res pixel art)
|
// from dataset of three videos with Q0..Q95: (real life video, low res pixel art, high res pixel art)
|
||||||
// 5 25 50 75 90 Claude Opus 4.1 (with data analysis)
|
// 5 25 50 75 90 Claude Opus 4.1 (with data analysis)
|
||||||
// 10 25 45 65 85 ChatGPT-5 (without data analysis)
|
// 10 25 45 65 85 ChatGPT-5 (without data analysis)
|
||||||
|
// 10 30 50 70 90 ChatGPT-5 (with data analysis)
|
||||||
static const int QUALITY_Y[] = {5, 18, 42, 63, 80};
|
static const int QUALITY_Y[] = {5, 18, 42, 63, 80};
|
||||||
static const int QUALITY_CO[] = {5, 18, 42, 63, 80};
|
static const int QUALITY_CO[] = {5, 18, 42, 63, 80};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user