Coder Social home page Coder Social logo

Comments (5)

bernhard-herzog avatar bernhard-herzog commented on June 3, 2024 1

With a debug build I get a more maningful error and backtrace:

3: difft::display::side_by_side::SourceDimensions::new
          at ./src/display/side_by_side.rs:185:31

That's

        let lhs_total_width = (terminal_width - SPACER.len()) / 2;

When running in eshell, terminal_width is 0 and SPACER.len() is
positive, hence the overflow.

AFAICT, terminal_width is 0, because in detect_display_width
in ./src/options.rs:864 there's

    if let Ok((columns, _rows)) = crossterm::terminal::size() {

When running in eshell, crossterm::terminal::size() returns Ok, but
with colums and rows both 0.

So the cause is that crossterm cannot correctly determine the size of
the terminal in eshell. The best fix is probably to fix crossterm, but
as a workaround, difftastic could check for a 0 width here and fall back
on e.g. looking at the COLUMNS environment variable which is set
correctly in eshell or the default value of 80.

from difftastic.

Wilfred avatar Wilfred commented on June 3, 2024

Could you share the files that caused this issue?

from difftastic.

sunlin7 avatar sunlin7 commented on June 3, 2024

Hi @Wilfred
I attach a.el and b.el which will lead a crash message in my local with eshell inside emacs.
test.TGZ

$ emacs -nw -q # and start eshell
/tmp $ difft a.el b.el
b.el --- Emacs Lisp
File permissions changed from 100664 to 100600.
memory allocation of 9223372036854775804 bytes failed
aborted

from difftastic.

Wilfred avatar Wilfred commented on June 3, 2024

Reported upstream: crossterm-rs/crossterm#891

from difftastic.

sunlin7 avatar sunlin7 commented on June 3, 2024

Thank you all for the great works!

from difftastic.

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.