Skip to content

Commit

Permalink
feat: implement isterm (#87)
Browse files Browse the repository at this point in the history
* docs: notes about initial implementation

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* chore: partial impl of isterm

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* fix: restore original data echo, clear still breaks

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* fix: adjust incoming backspace so full line delete doesn't happen

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* fix: term size giving confusing clear issues

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* fix: handle wrapped text & detecting when output is under prompt

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* feat: add detection for if the cursor is in a suggestable position

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* fix: add resize handler

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* fix: bash initial prompt detection & clear conflict

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* feat: add better debugging logging support to isterm

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* refactor: use es private field syntax

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* test: isterm

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: update for node-pty

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: add pwsh prompt setup for testing

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* style: fix lint issue

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: try lf to fix issue

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: enforce lf via gitattributes

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: tweak config

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: rollback types upgrade

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: drop macos builds for now

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: disable logging

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* test: unix shells

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: use step conditions

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: use condition for pwsh setup

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* ci: disable isterm tests

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

---------

Signed-off-by: Chapman Pendery <cpendery@vt.edu>
  • Loading branch information
cpendery authored Nov 20, 2023
1 parent 0736ad8 commit 930381c
Show file tree
Hide file tree
Showing 14 changed files with 764 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
93 changes: 65 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,65 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ["16.x", "18.x", "20.x"]
steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- run: npm ci

- run: npm run lint

- run: npm test

- run: npm run build
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
strategy:
matrix:
os: ["windows-latest", "ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- run: npm ci

- run: npm run lint

- name: setup pwsh prompt
shell: pwsh
if: matrix.os == 'windows-latest'
run: |
New-Item -Path $profile -ItemType File -Force
Set-Content $profile 'function prompt {'
Add-Content $profile ' $prompt = "PS: $(get-date)> "'
Add-Content $profile ' return "`e]6973;PS`a$prompt`e]6973;PE`a"'
Add-Content $profile '}'
- name: setup powershell prompt
if: matrix.os == 'windows-latest'
shell: powershell
run: |
New-Item -Path $profile -ItemType File -Force
Set-Content $profile 'function prompt {'
Add-Content $profile ' $ESC = [char]27'
Add-Content $profile ' $BEL = [char]7'
Add-Content $profile ' $prompt = "PS: $(Get-Location)> "'
Add-Content $profile ' return "$ESC]6973;PS$BEL$prompt$ESC]6973;PE$BEL"'
Add-Content $profile '}'
- name: setup fish prompt
if: matrix.os != 'windows-latest'
shell: bash
run: |
mkdir -p ~/.config/fish/functions && touch ~/.config/fish/functions/fish_prompt.fish
echo "function fish_prompt -d \"Write out the prompt\"" >> ~/.config/fish/functions/fish_prompt.fish
echo " printf '\033]6973;PS\007%s@%s %s%s%s > \033]6973;PE\007' $USER $hostname (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)" >> ~/.config/fish/functions/fish_prompt.fish
echo "end" >> ~/.config/fish/functions/fish_prompt.fish
- name: setup zsh-autosuggestions
if: matrix.os != 'windows-latest'
shell: bash
run: |
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
echo "source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh" > ~/.zshrc
- run: npm test
- run: npm run build
41 changes: 40 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
"commander": "^11.0.0",
"find-process": "^1.4.7",
"ink": "^4.4.1",
"node-pty": "^1.0.0",
"react": "^18.2.0",
"wrap-ansi": "^8.1.0"
"wrap-ansi": "^8.1.0",
"xterm-headless": "^5.3.0"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.2",
Expand Down
Loading

0 comments on commit 930381c

Please sign in to comment.