Coder Social home page Coder Social logo

Comments (7)

jeffkaufman avatar jeffkaufman commented on July 18, 2024

I've replicated the behavior you describe with python2. That's because we treat the input as a sequence of bytes, and wrapping a unicode character in the middle of a byte doesn't work well.

With python3 we have a different problem, where text goes off the screen. That's because we expect all characters to be the same width and that we can fit $COLUMNS of them on the screen at once.

from icdiff.

jeffkaufman avatar jeffkaufman commented on July 18, 2024

I've fixed the character width issue with 908af2f (1.2.2), where fullwidth characters were being treated as single width.

For now at least, icdiff works on bytes if run under python2 and utf8 characters if run under python3, so support for fullwidth characters is python3 only.

from icdiff.

xiaket avatar xiaket commented on July 18, 2024

Hi, @jeffkaufman , this issue not completely fixed.

I switch to python3 and used the same test case as I've provided. Indeed there is no breaking of Chinese characters now, but the text rendering is faulty. Chinese characters are double-width characters, and they should take the space of two ascii characters instead of one. when the current version of icdiff renders the diff output, it would be like(for a console width of 124 characters):

2014-12-09 10 32 22

which is not desirable, for the content is not properly wrapped.

For the icdiff version, I'm using 1.3.1.

from icdiff.

jeffkaufman avatar jeffkaufman commented on July 18, 2024

I'm testing with:

CHARS='测试行abc测试测试行abc测试测试行abc测试测试行abc测试测试行abc测试测试行abc测试测试行abc测试测试行abc测试测试行abc测试'
icdiff <(echo "$CHARS") <(echo "$CHARS" | tr c d)

And you're right, this isn't working.

from icdiff.

jeffkaufman avatar jeffkaufman commented on July 18, 2024

Fixed in a9b26aa.

from icdiff.

xiaket avatar xiaket commented on July 18, 2024

great job, thanks.

from icdiff.

jeffkaufman avatar jeffkaufman commented on July 18, 2024

with 93cffff this should work on python2 as well

from icdiff.

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.