Coder Social home page Coder Social logo

Comments (4)

cronvel avatar cronvel commented on August 19, 2024

@laurent22 Not really, except if you want to erase from your actual cursor to the end of line (eraseLineAfter()).

More efficient: term.moveTo( 2 , 2 , ' ' ) ; or term.moveTo( 2 , 2 , ' '.repeat( 2 ) ) ;

Also it could be interesting to have a higher-level function for erasing region, but it would definitively do something similar behind the scene.

What is your use-case? You may want to use the ScreenBuffer.

from terminal-kit.

laurent22 avatar laurent22 commented on August 19, 2024

Great, thanks I missed that it was possible to do moveTo(x, y, chars).

A function like erase(x, y, width, height) would be quite convienent. I can provide a pull request if you're interested?

Also another question, the insert(x) function actually inserts space characters, is that right? Or does it take the character it's inserting from somewhere else? (It wasn't clear from the documentation)

Yes I had a look at ScreenBuffer but since what I want to do is quite custom (multiple scrollable lists and a text input below), I thought I'd try first with something lower level to have more flexibility. It's possible I'm reinventing the wheel though!

from terminal-kit.

cronvel avatar cronvel commented on August 19, 2024

@laurent22 Hi, as you can see, I have added the .eraseArea( x , y , [width] , [height] ) method that does exactly what you want.

For the .insert() method, it directly maps to a terminal capability. So I cannot tell you if it actually adds space characters, or if a terminal has an internal empty cell state. However since empty areas act as spaces when we copy/paste them, that's not really important.

from terminal-kit.

laurent22 avatar laurent22 commented on August 19, 2024

Brilliant, thanks a lot for the eraseArea function!

from terminal-kit.

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.