Fix underline interruption with empty cells
Since completely empty cells are not reported by the renderable cells iterator, the line renderer has incorrectly assumed that these cells did not cause any change in cell state, leading to underlines spanning empty cells. Instead of assuming that the line state is unchanged, the line calculation now correctly interprets a jump in the renderable cells column as an interruption of the line. This fixes #1960.
This commit is contained in:
parent
f1bc6802e1
commit
9ffaac8ee7
|
@ -13,11 +13,11 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::term::{ SizeInfo, RenderableCell};
|
|
||||||
use crate::term::cell::Flags;
|
|
||||||
use crate::renderer::Rect;
|
use crate::renderer::Rect;
|
||||||
use font::Metrics;
|
use crate::term::cell::Flags;
|
||||||
|
use crate::term::{RenderableCell, SizeInfo};
|
||||||
use crate::Rgb;
|
use crate::Rgb;
|
||||||
|
use font::Metrics;
|
||||||
|
|
||||||
/// Lines for underline and strikeout.
|
/// Lines for underline and strikeout.
|
||||||
pub struct Lines<'a> {
|
pub struct Lines<'a> {
|
||||||
|
@ -70,20 +70,24 @@ impl<'a> Lines<'a> {
|
||||||
*start_cell = match *start_cell {
|
*start_cell = match *start_cell {
|
||||||
// Check for end if line is present
|
// Check for end if line is present
|
||||||
Some(ref mut start) => {
|
Some(ref mut start) => {
|
||||||
|
let last_cell = self.last_cell.unwrap();
|
||||||
|
|
||||||
// No change in line
|
// No change in line
|
||||||
if cell.line == start.line && cell.flags.contains(flag) && cell.fg == start.fg {
|
if cell.line == start.line
|
||||||
|
&& cell.flags.contains(flag)
|
||||||
|
&& cell.fg == start.fg
|
||||||
|
&& cell.column == last_cell.column + 1
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.inner.push(
|
self.inner.push(create_rect(
|
||||||
create_rect(
|
&start,
|
||||||
&start,
|
&last_cell,
|
||||||
&self.last_cell.unwrap(),
|
flag,
|
||||||
flag,
|
&self.metrics,
|
||||||
&self.metrics,
|
&self.size,
|
||||||
&self.size,
|
));
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Start a new line if the flag is present
|
// Start a new line if the flag is present
|
||||||
if cell.flags.contains(flag) {
|
if cell.flags.contains(flag) {
|
||||||
|
|
Loading…
Reference in New Issue