mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-01 01:36:32 +03:00
fix: CJK text rendering issue where the input popup component overlaps with images (#879)
This commit is contained in:
parent
1b910ddc96
commit
0650affb76
@ -1,6 +1,6 @@
|
|||||||
use std::{io::{stderr, BufWriter}, sync::atomic::Ordering};
|
use std::{io::{stderr, BufWriter}, sync::atomic::Ordering};
|
||||||
|
|
||||||
use ratatui::{backend::{Backend, CrosstermBackend}, CompletedFrame};
|
use ratatui::{backend::{Backend, CrosstermBackend}, buffer::Buffer, CompletedFrame};
|
||||||
use yazi_plugin::elements::COLLISION;
|
use yazi_plugin::elements::COLLISION;
|
||||||
|
|
||||||
use crate::{app::App, lives::Lives, root::Root};
|
use crate::{app::App, lives::Lives, root::Root};
|
||||||
@ -61,16 +61,18 @@ impl App {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn patch(frame: CompletedFrame, cursor: Option<(u16, u16)>) {
|
fn patch(frame: CompletedFrame, cursor: Option<(u16, u16)>) {
|
||||||
let mut patches = vec![];
|
let mut new = Buffer::empty(frame.area);
|
||||||
for y in frame.area.top()..frame.area.bottom() {
|
for y in new.area.top()..new.area.bottom() {
|
||||||
for x in frame.area.left()..frame.area.right() {
|
for x in new.area.left()..new.area.right() {
|
||||||
let cell = frame.buffer.get(x, y);
|
let cell = frame.buffer.get(x, y);
|
||||||
if cell.skip {
|
if cell.skip {
|
||||||
patches.push((x, y, cell));
|
*new.get_mut(x, y) = cell.clone();
|
||||||
}
|
}
|
||||||
|
new.get_mut(x, y).set_skip(!cell.skip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let patches = frame.buffer.diff(&new);
|
||||||
let mut backend = CrosstermBackend::new(BufWriter::new(stderr().lock()));
|
let mut backend = CrosstermBackend::new(BufWriter::new(stderr().lock()));
|
||||||
backend.draw(patches.into_iter()).ok();
|
backend.draw(patches.into_iter()).ok();
|
||||||
if let Some((x, y)) = cursor {
|
if let Some((x, y)) = cursor {
|
||||||
|
@ -37,8 +37,8 @@ impl ratatui::widgets::Widget for Clear {
|
|||||||
|
|
||||||
ADAPTOR.image_erase(r).ok();
|
ADAPTOR.image_erase(r).ok();
|
||||||
COLLISION.store(true, Ordering::Relaxed);
|
COLLISION.store(true, Ordering::Relaxed);
|
||||||
for y in area.top()..area.bottom() {
|
for y in r.top()..r.bottom() {
|
||||||
for x in area.left()..area.right() {
|
for x in r.left()..r.right() {
|
||||||
buf.get_mut(x, y).set_skip(true);
|
buf.get_mut(x, y).set_skip(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user