Git Product home page Git Product logo

prompt-sync-plus's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

prompt-sync-plus's Issues

Autocomplete 'SUGGEST' and 'HYBRID' have an issue with massive suggestion lists

The primary issue being: cleanup of displayed list + re-positioning of cursor doesn't work properly.

My suspicion here is that terminal cursor coordinates are relative to the terminal window view; if the number of suggested items is so high that its output causes the terminal to scroll, the x * y coordinates of the cursor just prior to the output are no longer correct. When this happens, search results that get pushed up above the "new" cursor position never get cleared out between keystrokes, leading to duplicate output.

A naïve fix I'd like to test is to save the cursor position prior to the output, then restore it after, but this is likely not going to work for the same reason mentioned above. (Bonus points: add up/down arrow key functionality to scroll through results)

Another thing I could try is truncating the list so it always only shows as many rows as can fit in the current terminal view (minus one row for a line indicating how many more are left off the screen).

Another question: can we detect terminal scroll events, and update our knowledge of the cursor position? Or is it subject to the same problem as the process.stdout.on("resize" () => {}) approach?

Another thought: add a maxRows option to automatically truncate the list to some pre-defined number of rows regardless of whether the results fit on the screen.

Issues with TypeScript

Unable to call the constructor without an argument

import axios from 'axios';
import psp from "prompt-sync-plus";
const prompt = psp(); // Expected 1 argument got 0
const prompt = psp({ sigint: true });

Here it tells me it requires ALL the options of the Config type

Looking at the type definitions, this is correct

declare type Config = {
    autocomplete: {
        behavior: AutocompleteBehavior;
        fill: boolean;
        searchFn?: (query: string) => string[];
        sticky: boolean;
        suggestColCount: number;
        triggerKey: Key;
    };
    echo: string;
    eot: boolean;
    defaultResponse: string;
    history?: PromptSyncHistoryObj;
    sigint: boolean;
};

declare function PromptSyncPlus(config: Config | undefined): PromptType;

Should instead be somthing like:

declare type Config = {
    autocomplete?: {
        behavior: AutocompleteBehavior;
        fill: boolean;
        searchFn?: (query: string) => string[];
        sticky: boolean;
        suggestColCount: number;
        triggerKey: Key;
    };
    echo?: string;
    eot?: boolean;
    defaultResponse?: string;
    history?: PromptSyncHistoryObj;
    sigint?: boolean;
};

declare function PromptSyncPlus(config?: Config): PromptType;

Input line if backspaced do not redraw in Windows Terminal

Greetings,

In Microsoft Windows Terminal, backspace do not delete character typed.

If let say I typed "one" and I backspaced once, the word maintain "one" but will be returned "on".

import psp from "promp-sync-plus;
const prompt = psp({sigint: true});

let testInput = prompt("Test input: ");

console.log(testInput)

Output:

PS C:\Users\Owner\Desktop> node test.js
Test input: one
on
PS C:\Users\Owner\Desktop>

Any help will be appreciated. Thank you.

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.