summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2018-12-31 16:52:29 +0000
committerGitHub <noreply@github.com>2018-12-31 16:52:29 +0000
commit9ffaac8ee7c5586f0faa62401b9de76cff81130f (patch)
tree3f9e959c15e80b2203e1b8115bfd49eab3d1a337
parentf1bc6802e1d0d03feaa43e61c2bf465795a96da9 (diff)
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.
-rw-r--r--src/renderer/lines.rs30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/renderer/lines.rs b/src/renderer/lines.rs
index 130ffdda..99d1f28f 100644
--- a/src/renderer/lines.rs
+++ b/src/renderer/lines.rs
@@ -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) {