Git Product home page Git Product logo

Comments (1)

Travmatth avatar Travmatth commented on May 28, 2024

21sh currently moves left/right with the termcaps commands le and nd. We can similarly move up/down with the commands up and do.

Using these commands will lead to unwanted behavior in several different scenarios:

  • Moving left past the beginning of a line
    -- we can guard against this by checking if the line index would be negative before moving
  • Moving right past the end of a line
    -- guard against this by checking if the next index would be past the size of the line, or the next newline
  • Moving up past the first line of a command
    -- we can guard against this by checking the current index has a newline preceding it
  • Moving down past the last line of a command
    -- we can guard against this by checking the current index has a newline following it
  • Moving up when next line ends before current column
    -- we can guard against this by finding the current relative index (current column on screen), and moving left until we're on the first column. then move up one row, and move right until we encounter the next newline or reach the current relative index
    --If we're on the first line, need to consider the space the prompt occupies (if no preceding newline, move up then left for size of prompt before calculating indexes)
  • Moving down when next line ends before current column
    -- we can guard against this by finding the current relative index (current column on screen), and moving left until we're on the first column. then move down one row, and move right until we encounter the next newline or reach the current relative index

from 21sh.

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.