From bf41302862edba33c12e0524455f88a9ad9a9657 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sun, 18 Jul 2021 19:36:08 -0400 Subject: [PATCH] Added logic to ensure that text highlighting always has coloring preference over other coloring options (activitiy coloring, ROM coloring, etc). --- src/drivers/Qt/HexEditor.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/drivers/Qt/HexEditor.cpp b/src/drivers/Qt/HexEditor.cpp index 65e43fdb..b6a9ebbc 100644 --- a/src/drivers/Qt/HexEditor.cpp +++ b/src/drivers/Qt/HexEditor.cpp @@ -3676,6 +3676,7 @@ void QHexEdit::paintEvent(QPaintEvent *event) int x, y, w, h, row, col, nrow, addr; int c, cx, cy, ca, l, recty; int pxCharWidth3; + int colHlgtStart = -1, colHlgtEnd = -1; char txt[32]; QString asciiTxt; QPainter painter(this); @@ -3788,6 +3789,8 @@ void QHexEdit::paintEvent(QPaintEvent *event) for ( row=0; row < nrow; row++) { + colHlgtStart = -1; colHlgtEnd = -1; + l = lineOffset + row; x = pxXoffset - pxLineXScroll; @@ -3806,19 +3809,23 @@ void QHexEdit::paintEvent(QPaintEvent *event) if ( l == txtHlgtStartLine ) { hlgtXs = txtHlgtStartChar*3; + colHlgtStart = txtHlgtStartChar; } else { hlgtXs = 0; + colHlgtStart = 0; } if ( l == txtHlgtEndLine ) { hlgtXe = (txtHlgtEndChar+1)*3; + colHlgtEnd = txtHlgtEndChar+1; } else { hlgtXe = 16*3; + colHlgtEnd = 16; } hlgtXd = hlgtXe - hlgtXs; @@ -3906,7 +3913,12 @@ void QHexEdit::paintEvent(QPaintEvent *event) } else { - if ( viewMode == MODE_NES_ROM ) + if ( txtHlgtSet && (col >= colHlgtStart) && (col < colHlgtEnd) ) + { + // Background is already colored by highlight + painter.setPen( fgColor ); + } + else if ( viewMode == MODE_NES_ROM ) { QColor romBgColor, romFgColor;