1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

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:
Christian Duerr 2018-12-31 16:52:29 +00:00 committed by GitHub
parent f1bc6802e1
commit 9ffaac8ee7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,11 +13,11 @@
// limitations under the License.
use std::collections::HashMap;
use crate::term::{ SizeInfo, RenderableCell};
use crate::term::cell::Flags;
use crate::renderer::Rect;
use font::Metrics;
use crate::term::cell::Flags;
use crate::term::{RenderableCell, SizeInfo};
use crate::Rgb;
use font::Metrics;
/// Lines for underline and strikeout.
pub struct Lines<'a> {
@ -70,20 +70,24 @@ impl<'a> Lines<'a> {
*start_cell = match *start_cell {
// Check for end if line is present
Some(ref mut start) => {
let last_cell = self.last_cell.unwrap();
// 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;
}
self.inner.push(
create_rect(
&start,
&self.last_cell.unwrap(),
flag,
&self.metrics,
&self.size,
)
);
self.inner.push(create_rect(
&start,
&last_cell,
flag,
&self.metrics,
&self.size,
));
// Start a new line if the flag is present
if cell.flags.contains(flag) {