Code Monkey home page Code Monkey logo

Comments (3)

raphamorim avatar raphamorim commented on May 13, 2024 1

Cannot reproduce anymore, closing this issue. Screenshot 2023-06-03 at 08 26 32

from rio.

niuez avatar niuez commented on May 13, 2024

It seems to be caused by rendering tab character \t. It can be fixed with replacing \t to single space .
I tried fixing it in create_sugar(), And it seems to work.

Sugar {
    content: if square.c == '\t' { ' ' } else { square.c },
    foreground_color,
    background_color,
    style,
    decoration: None,
}

There are problems...

  • I don't know why it breaks when rendering \t...
  • If this issue will be fixed by replacing, I don't know where in the code this should be corrected.

before
image
after
image

from rio.

raphamorim avatar raphamorim commented on May 13, 2024

Good finding @niuez ,

Yes now it make sense why it is failing, looked even how alacritty does and they also replace for ' ' https://github.com/alacritty/alacritty/blob/4b92388396c6da783809c7ce511b5cf6be8a0624/alacritty/src/renderer/text/mod.rs#L150C1-L153

fn draw_cell(
        &mut self,
        mut cell: RenderableCell,
        glyph_cache: &mut GlyphCache,
        size_info: &SizeInfo,
    ) {
        // Get font key for cell.
        let font_key = match cell.flags & Flags::BOLD_ITALIC {
            Flags::BOLD_ITALIC => glyph_cache.bold_italic_key,
            Flags::ITALIC => glyph_cache.italic_key,
            Flags::BOLD => glyph_cache.bold_key,
            _ => glyph_cache.font_key,
        };

        // Ignore hidden cells and render tabs as spaces to prevent font issues.
        let hidden = cell.flags.contains(Flags::HIDDEN);
        if cell.character == '\t' || hidden {
            cell.character = ' ';
        }

Would you mind adding a fix for it? You can add this logic in create_sugar since is our translation to the renderer.

Also would be good add the check flag.contains(Flag::HIDDEN) (we have same flag logic)

from rio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.