Giter Club home page Giter Club logo

Comments (4)

dimpolo avatar dimpolo commented on August 25, 2024 1

I had a similar problem so I went digging:

EditorBuilder::build_sync will send these bytes and expect a response indicating the terminal size

pub fn init() -> &'static [u8] {
// There is no command to request the size of the terminal window,
// so to probe the size we move the cursor way out of the screen
// and then request the position, because the cursor must be in
// the screen this gives us the size.
"\r\x1b[J\x1b7\x1b[6n\x1b[999;999H\x1b[6n\x1b8".as_bytes()
}

Your Console provides an invalid response which results in the error.

Btw, you should use self.0.pop() instead of self.0.last() in your Read impl.

from noline.

eivindbergem avatar eivindbergem commented on August 25, 2024

@Tim-Paik Sorry for not responding, I missed the github notification so I didn't see this before now.

Do you have a full example I can have a look at?

from noline.

Tim-Paik avatar Tim-Paik commented on August 25, 2024

@Tim-Paik Sorry for not responding, I missed the github notification so I didn't see this before now.

Do you have a full example I can have a look at?

You can execute the following command to reproduce my problem

cargo new nolinetest
cd nolinetest
cargo add noline --features alloc

Populate src/main.rs with the code from main.rs that I provided at the beginning, after that, you can use cargo run to run it

I had a similar problem so I went digging:

EditorBuilder::build_sync will send these bytes and expect a response indicating the terminal size

pub fn init() -> &'static [u8] {
// There is no command to request the size of the terminal window,
// so to probe the size we move the cursor way out of the screen
// and then request the position, because the cursor must be in
// the screen this gives us the size.
"\r\x1b[J\x1b7\x1b[6n\x1b[999;999H\x1b[6n\x1b8".as_bytes()
}

Your Console provides an invalid response which results in the error.

Btw, you should use self.0.pop() instead of self.0.last() in your Read impl.

Looks like you're making sense, since I'm not providing a terminal width, which noline definitely needs. But I don't know how should I provide the size of the terminal...

from noline.

eivindbergem avatar eivindbergem commented on August 25, 2024

Noline expects to be connected to an ANSI terminal. During init, noline probes the terminal using ANSI escape codes to get the size of the terminal. You can have a lock at here for an example of a mockterminal.

But, what is your use case here? Without an actual terminal, noline isn't of much use.

from noline.

Related Issues (14)

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.