Coder Social home page Coder Social logo

Comments (4)

shyndman avatar shyndman commented on August 14, 2024

I believe I've verified it is iTerm2's doing, not vim's.

Running this in my shell:

echo '\x1b[0;38;5;121mwidth\x1b[0m:\x1b[0;103m100%\x1b[0m;'

Gives me this back when copied:

�[0;38:5:121mwidth�[0m:�[0;111m100%�[0m;

I'm curious to hear what you think.

from ansi-regex.

Qix- avatar Qix- commented on August 14, 2024

Correct me if I'm wrong but this has nothing to do with the ansi-regex node.js package.

from ansi-regex.

shyndman avatar shyndman commented on August 14, 2024

Well, it might? Like I said, I'm not an expert. Is that valid ANSI or not? The regex doesn't match on it.

Is it or isn't it the purpose of this package to match on ANSI escape codes?

from ansi-regex.

Qix- avatar Qix- commented on August 14, 2024

It's just that you didn't provide any code to indicate you're even using this library.

> s ='\x1b[0;38;5;121mwidth\x1b[0m:\x1b[0;103m100%\x1b[0m;'
'\x1B[0;38;5;121mwidth\x1B[0m:\x1B[0;103m100%\x1B[0m;'
> r = new RegExp(pattern, 'g')
/[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)|(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))/g
> r.exec(s)
[
  '\x1B[0;38;5;121m',
  index: 0,
  input: '\x1B[0;38;5;121mwidth\x1B[0m:\x1B[0;103m100%\x1B[0m;',
  groups: undefined
]
> r.exec(s)
[
  '\x1B[0m',
  index: 18,
  input: '\x1B[0;38;5;121mwidth\x1B[0m:\x1B[0;103m100%\x1B[0m;',
  groups: undefined
]
> r.exec(s)
[
  '\x1B[0;103m',
  index: 23,
  input: '\x1B[0;38;5;121mwidth\x1B[0m:\x1B[0;103m100%\x1B[0m;',
  groups: undefined
]
> r.exec(s)
[
  '\x1B[0m',
  index: 35,
  input: '\x1B[0;38;5;121mwidth\x1B[0m:\x1B[0;103m100%\x1B[0m;',
  groups: undefined
]
> r.exec(s)
null

Seems like it works fine.

Can you show some code?

from ansi-regex.

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.