From b6ed2c739846b421041c6eaa9fc7c04023cf822c Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 28 Feb 2025 17:30:17 +0800 Subject: [PATCH] fix cursor overlay in sh1107 display mode --- libs/ux-api/src/wordwrap.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/ux-api/src/wordwrap.rs b/libs/ux-api/src/wordwrap.rs index 5d7006a5d..e0057a89e 100644 --- a/libs/ux-api/src/wordwrap.rs +++ b/libs/ux-api/src/wordwrap.rs @@ -173,6 +173,12 @@ impl ComposedType { } else { blitstr2::xor_glyph_2x(rawbuf, (maybe_x, maybe_y), glyph, glyph.invert ^ invert, cr); } + // Platform-dependent cursor inversion because the color scheme for sh1107 doesn't comply + // to precursor norms + #[cfg(any(feature = "board-baosec", feature = "hosted-baosec"))] + let curse_invert = true; + #[cfg(not(any(feature = "board-baosec", feature = "hosted-baosec")))] + let curse_invert = invert; if glyph.insert { // log::info!("insert at {},{}", glyph.ch, strpos - 1); // draw the insertion point after the glyph's position @@ -183,8 +189,9 @@ impl ComposedType { Point::new(maybe_x as isize - 1, maybe_y as isize + glyph.high as isize), ), Some(clip_rect), - invert, + curse_invert, ); + frbuf.put_pixel(Point::new(2, 2), 0.into()); } } }