@socketsecurity/cli-with-sentry 1.1.25 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -218
- package/README.md +41 -74
- package/dist/cli.js.bz +0 -0
- package/dist/cli.js.bz.sha256 +1 -0
- package/dist/index.js +2 -0
- package/package.json +31 -274
- package/bin/cli.js +0 -52
- package/bin/npm-cli.js +0 -29
- package/bin/npx-cli.js +0 -29
- package/bin/pnpm-cli.js +0 -29
- package/bin/yarn-cli.js +0 -29
- package/dist/cli.js +0 -14999
- package/dist/cli.js.map +0 -1
- package/dist/constants.js +0 -845
- package/dist/constants.js.map +0 -1
- package/dist/flags.js +0 -212
- package/dist/flags.js.map +0 -1
- package/dist/init.gradle +0 -250
- package/dist/instrument-with-sentry.js +0 -44
- package/dist/instrument-with-sentry.js.map +0 -1
- package/dist/npm-cli.js +0 -30
- package/dist/npm-cli.js.map +0 -1
- package/dist/npx-cli.js +0 -26
- package/dist/npx-cli.js.map +0 -1
- package/dist/pnpm-cli.js +0 -30
- package/dist/pnpm-cli.js.map +0 -1
- package/dist/shadow-npm-bin.js +0 -8
- package/dist/shadow-npm-bin.js.map +0 -1
- package/dist/shadow-npm-bin2.js +0 -102
- package/dist/shadow-npm-bin2.js.map +0 -1
- package/dist/shadow-npm-inject.js +0 -307
- package/dist/shadow-npm-inject.js.map +0 -1
- package/dist/shadow-npx-bin.js +0 -12
- package/dist/shadow-npx-bin.js.map +0 -1
- package/dist/shadow-pnpm-bin.js +0 -8
- package/dist/shadow-pnpm-bin.js.map +0 -1
- package/dist/shadow-pnpm-bin2.js +0 -300
- package/dist/shadow-pnpm-bin2.js.map +0 -1
- package/dist/shadow-yarn-bin.js +0 -96
- package/dist/shadow-yarn-bin.js.map +0 -1
- package/dist/tsconfig.dts.tsbuildinfo +0 -1
- package/dist/types/cli.d.mts +0 -3
- package/dist/types/cli.d.mts.map +0 -1
- package/dist/types/commands/analytics/cmd-analytics.d.mts +0 -10
- package/dist/types/commands/analytics/cmd-analytics.d.mts.map +0 -1
- package/dist/types/commands/analytics/fetch-org-analytics.d.mts +0 -8
- package/dist/types/commands/analytics/fetch-org-analytics.d.mts.map +0 -1
- package/dist/types/commands/analytics/fetch-repo-analytics.d.mts +0 -8
- package/dist/types/commands/analytics/fetch-repo-analytics.d.mts.map +0 -1
- package/dist/types/commands/analytics/handle-analytics.d.mts +0 -10
- package/dist/types/commands/analytics/handle-analytics.d.mts.map +0 -1
- package/dist/types/commands/analytics/output-analytics.d.mts +0 -29
- package/dist/types/commands/analytics/output-analytics.d.mts.map +0 -1
- package/dist/types/commands/audit-log/cmd-audit-log.d.mts +0 -10
- package/dist/types/commands/audit-log/cmd-audit-log.d.mts.map +0 -1
- package/dist/types/commands/audit-log/fetch-audit-log.d.mts +0 -15
- package/dist/types/commands/audit-log/fetch-audit-log.d.mts.map +0 -1
- package/dist/types/commands/audit-log/handle-audit-log.d.mts +0 -9
- package/dist/types/commands/audit-log/handle-audit-log.d.mts.map +0 -1
- package/dist/types/commands/audit-log/output-audit-log.d.mts +0 -22
- package/dist/types/commands/audit-log/output-audit-log.d.mts.map +0 -1
- package/dist/types/commands/ci/cmd-ci.d.mts +0 -9
- package/dist/types/commands/ci/cmd-ci.d.mts.map +0 -1
- package/dist/types/commands/ci/fetch-default-org-slug.d.mts +0 -4
- package/dist/types/commands/ci/fetch-default-org-slug.d.mts.map +0 -1
- package/dist/types/commands/ci/handle-ci.d.mts +0 -2
- package/dist/types/commands/ci/handle-ci.d.mts.map +0 -1
- package/dist/types/commands/config/cmd-config-auto.d.mts +0 -10
- package/dist/types/commands/config/cmd-config-auto.d.mts.map +0 -1
- package/dist/types/commands/config/cmd-config-get.d.mts +0 -9
- package/dist/types/commands/config/cmd-config-get.d.mts.map +0 -1
- package/dist/types/commands/config/cmd-config-list.d.mts +0 -9
- package/dist/types/commands/config/cmd-config-list.d.mts.map +0 -1
- package/dist/types/commands/config/cmd-config-set.d.mts +0 -10
- package/dist/types/commands/config/cmd-config-set.d.mts.map +0 -1
- package/dist/types/commands/config/cmd-config-unset.d.mts +0 -10
- package/dist/types/commands/config/cmd-config-unset.d.mts.map +0 -1
- package/dist/types/commands/config/cmd-config.d.mts +0 -3
- package/dist/types/commands/config/cmd-config.d.mts.map +0 -1
- package/dist/types/commands/config/discover-config-value.d.mts +0 -3
- package/dist/types/commands/config/discover-config-value.d.mts.map +0 -1
- package/dist/types/commands/config/handle-config-auto.d.mts +0 -7
- package/dist/types/commands/config/handle-config-auto.d.mts.map +0 -1
- package/dist/types/commands/config/handle-config-get.d.mts +0 -7
- package/dist/types/commands/config/handle-config-get.d.mts.map +0 -1
- package/dist/types/commands/config/handle-config-set.d.mts +0 -8
- package/dist/types/commands/config/handle-config-set.d.mts.map +0 -1
- package/dist/types/commands/config/handle-config-unset.d.mts +0 -7
- package/dist/types/commands/config/handle-config-unset.d.mts.map +0 -1
- package/dist/types/commands/config/output-config-auto.d.mts +0 -4
- package/dist/types/commands/config/output-config-auto.d.mts.map +0 -1
- package/dist/types/commands/config/output-config-get.d.mts +0 -4
- package/dist/types/commands/config/output-config-get.d.mts.map +0 -1
- package/dist/types/commands/config/output-config-list.d.mts +0 -6
- package/dist/types/commands/config/output-config-list.d.mts.map +0 -1
- package/dist/types/commands/config/output-config-set.d.mts +0 -3
- package/dist/types/commands/config/output-config-set.d.mts.map +0 -1
- package/dist/types/commands/config/output-config-unset.d.mts +0 -3
- package/dist/types/commands/config/output-config-unset.d.mts.map +0 -1
- package/dist/types/commands/fix/cmd-fix.d.mts +0 -10
- package/dist/types/commands/fix/cmd-fix.d.mts.map +0 -1
- package/dist/types/commands/fix/coana-fix.d.mts +0 -6
- package/dist/types/commands/fix/coana-fix.d.mts.map +0 -1
- package/dist/types/commands/fix/env-helpers.d.mts +0 -26
- package/dist/types/commands/fix/env-helpers.d.mts.map +0 -1
- package/dist/types/commands/fix/git.d.mts +0 -13
- package/dist/types/commands/fix/git.d.mts.map +0 -1
- package/dist/types/commands/fix/handle-fix.d.mts +0 -20
- package/dist/types/commands/fix/handle-fix.d.mts.map +0 -1
- package/dist/types/commands/fix/output-fix-result.d.mts +0 -3
- package/dist/types/commands/fix/output-fix-result.d.mts.map +0 -1
- package/dist/types/commands/fix/pull-request.d.mts +0 -31
- package/dist/types/commands/fix/pull-request.d.mts.map +0 -1
- package/dist/types/commands/fix/types.d.mts +0 -21
- package/dist/types/commands/fix/types.d.mts.map +0 -1
- package/dist/types/commands/install/cmd-install-completion.d.mts +0 -9
- package/dist/types/commands/install/cmd-install-completion.d.mts.map +0 -1
- package/dist/types/commands/install/cmd-install.d.mts +0 -3
- package/dist/types/commands/install/cmd-install.d.mts.map +0 -1
- package/dist/types/commands/install/handle-install-completion.d.mts +0 -2
- package/dist/types/commands/install/handle-install-completion.d.mts.map +0 -1
- package/dist/types/commands/install/output-install-completion.d.mts +0 -12
- package/dist/types/commands/install/output-install-completion.d.mts.map +0 -1
- package/dist/types/commands/install/setup-tab-completion.d.mts +0 -13
- package/dist/types/commands/install/setup-tab-completion.d.mts.map +0 -1
- package/dist/types/commands/json/cmd-json.d.mts +0 -9
- package/dist/types/commands/json/cmd-json.d.mts.map +0 -1
- package/dist/types/commands/json/handle-cmd-json.d.mts +0 -2
- package/dist/types/commands/json/handle-cmd-json.d.mts.map +0 -1
- package/dist/types/commands/json/output-cmd-json.d.mts +0 -2
- package/dist/types/commands/json/output-cmd-json.d.mts.map +0 -1
- package/dist/types/commands/login/apply-login.d.mts +0 -2
- package/dist/types/commands/login/apply-login.d.mts.map +0 -1
- package/dist/types/commands/login/attempt-login.d.mts +0 -6
- package/dist/types/commands/login/attempt-login.d.mts.map +0 -1
- package/dist/types/commands/login/cmd-login.d.mts +0 -10
- package/dist/types/commands/login/cmd-login.d.mts.map +0 -1
- package/dist/types/commands/logout/apply-logout.d.mts +0 -2
- package/dist/types/commands/logout/apply-logout.d.mts.map +0 -1
- package/dist/types/commands/logout/attempt-logout.d.mts +0 -2
- package/dist/types/commands/logout/attempt-logout.d.mts.map +0 -1
- package/dist/types/commands/logout/cmd-logout.d.mts +0 -9
- package/dist/types/commands/logout/cmd-logout.d.mts.map +0 -1
- package/dist/types/commands/manifest/cmd-manifest-auto.d.mts +0 -9
- package/dist/types/commands/manifest/cmd-manifest-auto.d.mts.map +0 -1
- package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts +0 -9
- package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +0 -1
- package/dist/types/commands/manifest/cmd-manifest-conda.d.mts +0 -9
- package/dist/types/commands/manifest/cmd-manifest-conda.d.mts.map +0 -1
- package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts +0 -9
- package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts.map +0 -1
- package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts +0 -9
- package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts.map +0 -1
- package/dist/types/commands/manifest/cmd-manifest-scala.d.mts +0 -9
- package/dist/types/commands/manifest/cmd-manifest-scala.d.mts.map +0 -1
- package/dist/types/commands/manifest/cmd-manifest-setup.d.mts +0 -9
- package/dist/types/commands/manifest/cmd-manifest-setup.d.mts.map +0 -1
- package/dist/types/commands/manifest/cmd-manifest.d.mts +0 -9
- package/dist/types/commands/manifest/cmd-manifest.d.mts.map +0 -1
- package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts +0 -8
- package/dist/types/commands/manifest/convert-conda-to-requirements.d.mts.map +0 -1
- package/dist/types/commands/manifest/convert_gradle_to_maven.d.mts +0 -7
- package/dist/types/commands/manifest/convert_gradle_to_maven.d.mts.map +0 -1
- package/dist/types/commands/manifest/convert_sbt_to_maven.d.mts +0 -8
- package/dist/types/commands/manifest/convert_sbt_to_maven.d.mts.map +0 -1
- package/dist/types/commands/manifest/detect-manifest-actions.d.mts +0 -13
- package/dist/types/commands/manifest/detect-manifest-actions.d.mts.map +0 -1
- package/dist/types/commands/manifest/generate_auto_manifest.d.mts +0 -9
- package/dist/types/commands/manifest/generate_auto_manifest.d.mts.map +0 -1
- package/dist/types/commands/manifest/handle-manifest-conda.d.mts +0 -9
- package/dist/types/commands/manifest/handle-manifest-conda.d.mts.map +0 -1
- package/dist/types/commands/manifest/handle-manifest-setup.d.mts +0 -2
- package/dist/types/commands/manifest/handle-manifest-setup.d.mts.map +0 -1
- package/dist/types/commands/manifest/output-manifest-setup.d.mts +0 -3
- package/dist/types/commands/manifest/output-manifest-setup.d.mts.map +0 -1
- package/dist/types/commands/manifest/output-requirements.d.mts +0 -6
- package/dist/types/commands/manifest/output-requirements.d.mts.map +0 -1
- package/dist/types/commands/manifest/run-cdxgen.d.mts +0 -6
- package/dist/types/commands/manifest/run-cdxgen.d.mts.map +0 -1
- package/dist/types/commands/manifest/setup-manifest-config.d.mts +0 -3
- package/dist/types/commands/manifest/setup-manifest-config.d.mts.map +0 -1
- package/dist/types/commands/npm/cmd-npm.d.mts +0 -10
- package/dist/types/commands/npm/cmd-npm.d.mts.map +0 -1
- package/dist/types/commands/npx/cmd-npx.d.mts +0 -9
- package/dist/types/commands/npx/cmd-npx.d.mts.map +0 -1
- package/dist/types/commands/oops/cmd-oops.d.mts +0 -9
- package/dist/types/commands/oops/cmd-oops.d.mts.map +0 -1
- package/dist/types/commands/optimize/add-overrides.d.mts +0 -20
- package/dist/types/commands/optimize/add-overrides.d.mts.map +0 -1
- package/dist/types/commands/optimize/apply-optimization.d.mts +0 -14
- package/dist/types/commands/optimize/apply-optimization.d.mts.map +0 -1
- package/dist/types/commands/optimize/cmd-optimize.d.mts +0 -10
- package/dist/types/commands/optimize/cmd-optimize.d.mts.map +0 -1
- package/dist/types/commands/optimize/deps-includes-by-agent.d.mts +0 -5
- package/dist/types/commands/optimize/deps-includes-by-agent.d.mts.map +0 -1
- package/dist/types/commands/optimize/get-dependency-entries.d.mts +0 -3
- package/dist/types/commands/optimize/get-dependency-entries.d.mts.map +0 -1
- package/dist/types/commands/optimize/get-overrides-by-agent.d.mts +0 -42
- package/dist/types/commands/optimize/get-overrides-by-agent.d.mts.map +0 -1
- package/dist/types/commands/optimize/handle-optimize.d.mts +0 -8
- package/dist/types/commands/optimize/handle-optimize.d.mts.map +0 -1
- package/dist/types/commands/optimize/lockfile-includes-by-agent.d.mts +0 -8
- package/dist/types/commands/optimize/lockfile-includes-by-agent.d.mts.map +0 -1
- package/dist/types/commands/optimize/ls-by-agent.d.mts +0 -13
- package/dist/types/commands/optimize/ls-by-agent.d.mts.map +0 -1
- package/dist/types/commands/optimize/output-optimize-result.d.mts +0 -9
- package/dist/types/commands/optimize/output-optimize-result.d.mts.map +0 -1
- package/dist/types/commands/optimize/shared.d.mts +0 -2
- package/dist/types/commands/optimize/shared.d.mts.map +0 -1
- package/dist/types/commands/optimize/types.d.mts +0 -9
- package/dist/types/commands/optimize/types.d.mts.map +0 -1
- package/dist/types/commands/optimize/update-lockfile.d.mts +0 -11
- package/dist/types/commands/optimize/update-lockfile.d.mts.map +0 -1
- package/dist/types/commands/optimize/update-manifest-by-agent.d.mts +0 -8
- package/dist/types/commands/optimize/update-manifest-by-agent.d.mts.map +0 -1
- package/dist/types/commands/organization/cmd-organization-dependencies.d.mts +0 -10
- package/dist/types/commands/organization/cmd-organization-dependencies.d.mts.map +0 -1
- package/dist/types/commands/organization/cmd-organization-list.d.mts +0 -10
- package/dist/types/commands/organization/cmd-organization-list.d.mts.map +0 -1
- package/dist/types/commands/organization/cmd-organization-policy-license.d.mts +0 -10
- package/dist/types/commands/organization/cmd-organization-policy-license.d.mts.map +0 -1
- package/dist/types/commands/organization/cmd-organization-policy-security.d.mts +0 -10
- package/dist/types/commands/organization/cmd-organization-policy-security.d.mts.map +0 -1
- package/dist/types/commands/organization/cmd-organization-policy.d.mts +0 -3
- package/dist/types/commands/organization/cmd-organization-policy.d.mts.map +0 -1
- package/dist/types/commands/organization/cmd-organization-quota.d.mts +0 -9
- package/dist/types/commands/organization/cmd-organization-quota.d.mts.map +0 -1
- package/dist/types/commands/organization/cmd-organization.d.mts +0 -3
- package/dist/types/commands/organization/cmd-organization.d.mts.map +0 -1
- package/dist/types/commands/organization/fetch-dependencies.d.mts +0 -12
- package/dist/types/commands/organization/fetch-dependencies.d.mts.map +0 -1
- package/dist/types/commands/organization/fetch-license-policy.d.mts +0 -8
- package/dist/types/commands/organization/fetch-license-policy.d.mts.map +0 -1
- package/dist/types/commands/organization/fetch-organization-list.d.mts +0 -20
- package/dist/types/commands/organization/fetch-organization-list.d.mts.map +0 -1
- package/dist/types/commands/organization/fetch-quota.d.mts +0 -8
- package/dist/types/commands/organization/fetch-quota.d.mts.map +0 -1
- package/dist/types/commands/organization/fetch-security-policy.d.mts +0 -8
- package/dist/types/commands/organization/fetch-security-policy.d.mts.map +0 -1
- package/dist/types/commands/organization/handle-dependencies.d.mts +0 -7
- package/dist/types/commands/organization/handle-dependencies.d.mts.map +0 -1
- package/dist/types/commands/organization/handle-license-policy.d.mts +0 -3
- package/dist/types/commands/organization/handle-license-policy.d.mts.map +0 -1
- package/dist/types/commands/organization/handle-organization-list.d.mts +0 -3
- package/dist/types/commands/organization/handle-organization-list.d.mts.map +0 -1
- package/dist/types/commands/organization/handle-quota.d.mts +0 -3
- package/dist/types/commands/organization/handle-quota.d.mts.map +0 -1
- package/dist/types/commands/organization/handle-security-policy.d.mts +0 -3
- package/dist/types/commands/organization/handle-security-policy.d.mts.map +0 -1
- package/dist/types/commands/organization/output-dependencies.d.mts +0 -8
- package/dist/types/commands/organization/output-dependencies.d.mts.map +0 -1
- package/dist/types/commands/organization/output-license-policy.d.mts +0 -4
- package/dist/types/commands/organization/output-license-policy.d.mts.map +0 -1
- package/dist/types/commands/organization/output-organization-list.d.mts +0 -4
- package/dist/types/commands/organization/output-organization-list.d.mts.map +0 -1
- package/dist/types/commands/organization/output-quota.d.mts +0 -4
- package/dist/types/commands/organization/output-quota.d.mts.map +0 -1
- package/dist/types/commands/organization/output-security-policy.d.mts +0 -4
- package/dist/types/commands/organization/output-security-policy.d.mts.map +0 -1
- package/dist/types/commands/package/cmd-package-score.d.mts +0 -10
- package/dist/types/commands/package/cmd-package-score.d.mts.map +0 -1
- package/dist/types/commands/package/cmd-package-shallow.d.mts +0 -17
- package/dist/types/commands/package/cmd-package-shallow.d.mts.map +0 -1
- package/dist/types/commands/package/cmd-package.d.mts +0 -3
- package/dist/types/commands/package/cmd-package.d.mts.map +0 -1
- package/dist/types/commands/package/fetch-purl-deep-score.d.mts +0 -51
- package/dist/types/commands/package/fetch-purl-deep-score.d.mts.map +0 -1
- package/dist/types/commands/package/fetch-purls-shallow-score.d.mts +0 -8
- package/dist/types/commands/package/fetch-purls-shallow-score.d.mts.map +0 -1
- package/dist/types/commands/package/handle-purl-deep-score.d.mts +0 -3
- package/dist/types/commands/package/handle-purl-deep-score.d.mts.map +0 -1
- package/dist/types/commands/package/handle-purls-shallow-score.d.mts +0 -6
- package/dist/types/commands/package/handle-purls-shallow-score.d.mts.map +0 -1
- package/dist/types/commands/package/output-purls-deep-score.d.mts +0 -5
- package/dist/types/commands/package/output-purls-deep-score.d.mts.map +0 -1
- package/dist/types/commands/package/output-purls-shallow-score.d.mts +0 -29
- package/dist/types/commands/package/output-purls-shallow-score.d.mts.map +0 -1
- package/dist/types/commands/package/parse-package-specifiers.d.mts +0 -9
- package/dist/types/commands/package/parse-package-specifiers.d.mts.map +0 -1
- package/dist/types/commands/patch/cmd-patch.d.mts +0 -10
- package/dist/types/commands/patch/cmd-patch.d.mts.map +0 -1
- package/dist/types/commands/patch/handle-patch.d.mts +0 -12
- package/dist/types/commands/patch/handle-patch.d.mts.map +0 -1
- package/dist/types/commands/patch/manifest-schema.d.mts +0 -34
- package/dist/types/commands/patch/manifest-schema.d.mts.map +0 -1
- package/dist/types/commands/patch/output-patch-result.d.mts +0 -5
- package/dist/types/commands/patch/output-patch-result.d.mts.map +0 -1
- package/dist/types/commands/pnpm/cmd-pnpm.d.mts +0 -10
- package/dist/types/commands/pnpm/cmd-pnpm.d.mts.map +0 -1
- package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts +0 -9
- package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts.map +0 -1
- package/dist/types/commands/raw-npm/run-raw-npm.d.mts +0 -2
- package/dist/types/commands/raw-npm/run-raw-npm.d.mts.map +0 -1
- package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts +0 -9
- package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts.map +0 -1
- package/dist/types/commands/raw-npx/run-raw-npx.d.mts +0 -2
- package/dist/types/commands/raw-npx/run-raw-npx.d.mts.map +0 -1
- package/dist/types/commands/repository/cmd-repository-create.d.mts +0 -10
- package/dist/types/commands/repository/cmd-repository-create.d.mts.map +0 -1
- package/dist/types/commands/repository/cmd-repository-del.d.mts +0 -10
- package/dist/types/commands/repository/cmd-repository-del.d.mts.map +0 -1
- package/dist/types/commands/repository/cmd-repository-list.d.mts +0 -10
- package/dist/types/commands/repository/cmd-repository-list.d.mts.map +0 -1
- package/dist/types/commands/repository/cmd-repository-update.d.mts +0 -10
- package/dist/types/commands/repository/cmd-repository-update.d.mts.map +0 -1
- package/dist/types/commands/repository/cmd-repository-view.d.mts +0 -10
- package/dist/types/commands/repository/cmd-repository-view.d.mts.map +0 -1
- package/dist/types/commands/repository/cmd-repository.d.mts +0 -3
- package/dist/types/commands/repository/cmd-repository.d.mts.map +0 -1
- package/dist/types/commands/repository/fetch-create-repo.d.mts +0 -16
- package/dist/types/commands/repository/fetch-create-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/fetch-delete-repo.d.mts +0 -8
- package/dist/types/commands/repository/fetch-delete-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/fetch-list-all-repos.d.mts +0 -10
- package/dist/types/commands/repository/fetch-list-all-repos.d.mts.map +0 -1
- package/dist/types/commands/repository/fetch-list-repos.d.mts +0 -15
- package/dist/types/commands/repository/fetch-list-repos.d.mts.map +0 -1
- package/dist/types/commands/repository/fetch-update-repo.d.mts +0 -16
- package/dist/types/commands/repository/fetch-update-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/fetch-view-repo.d.mts +0 -8
- package/dist/types/commands/repository/fetch-view-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/handle-create-repo.d.mts +0 -10
- package/dist/types/commands/repository/handle-create-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/handle-delete-repo.d.mts +0 -3
- package/dist/types/commands/repository/handle-delete-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/handle-list-repos.d.mts +0 -12
- package/dist/types/commands/repository/handle-list-repos.d.mts.map +0 -1
- package/dist/types/commands/repository/handle-update-repo.d.mts +0 -10
- package/dist/types/commands/repository/handle-update-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/handle-view-repo.d.mts +0 -3
- package/dist/types/commands/repository/handle-view-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/output-create-repo.d.mts +0 -4
- package/dist/types/commands/repository/output-create-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/output-delete-repo.d.mts +0 -4
- package/dist/types/commands/repository/output-delete-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/output-list-repos.d.mts +0 -5
- package/dist/types/commands/repository/output-list-repos.d.mts.map +0 -1
- package/dist/types/commands/repository/output-update-repo.d.mts +0 -4
- package/dist/types/commands/repository/output-update-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/output-view-repo.d.mts +0 -4
- package/dist/types/commands/repository/output-view-repo.d.mts.map +0 -1
- package/dist/types/commands/repository/types.d.mts +0 -2
- package/dist/types/commands/repository/types.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan-create.d.mts +0 -10
- package/dist/types/commands/scan/cmd-scan-create.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan-del.d.mts +0 -10
- package/dist/types/commands/scan/cmd-scan-del.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan-diff.d.mts +0 -10
- package/dist/types/commands/scan/cmd-scan-diff.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan-github.d.mts +0 -10
- package/dist/types/commands/scan/cmd-scan-github.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan-list.d.mts +0 -4
- package/dist/types/commands/scan/cmd-scan-list.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan-metadata.d.mts +0 -4
- package/dist/types/commands/scan/cmd-scan-metadata.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan-reach.d.mts +0 -10
- package/dist/types/commands/scan/cmd-scan-reach.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan-report.d.mts +0 -4
- package/dist/types/commands/scan/cmd-scan-report.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan-setup.d.mts +0 -9
- package/dist/types/commands/scan/cmd-scan-setup.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan-view.d.mts +0 -4
- package/dist/types/commands/scan/cmd-scan-view.d.mts.map +0 -1
- package/dist/types/commands/scan/cmd-scan.d.mts +0 -3
- package/dist/types/commands/scan/cmd-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/create-scan-from-github.d.mts +0 -12
- package/dist/types/commands/scan/create-scan-from-github.d.mts.map +0 -1
- package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts +0 -20
- package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts +0 -8
- package/dist/types/commands/scan/fetch-delete-org-full-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/fetch-diff-scan.d.mts +0 -8
- package/dist/types/commands/scan/fetch-diff-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/fetch-list-scans.d.mts +0 -18
- package/dist/types/commands/scan/fetch-list-scans.d.mts.map +0 -1
- package/dist/types/commands/scan/fetch-report-data.d.mts +0 -17
- package/dist/types/commands/scan/fetch-report-data.d.mts.map +0 -1
- package/dist/types/commands/scan/fetch-scan-metadata.d.mts +0 -8
- package/dist/types/commands/scan/fetch-scan-metadata.d.mts.map +0 -1
- package/dist/types/commands/scan/fetch-scan.d.mts +0 -4
- package/dist/types/commands/scan/fetch-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +0 -10
- package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts.map +0 -1
- package/dist/types/commands/scan/finalize-tier1-scan.d.mts +0 -12
- package/dist/types/commands/scan/finalize-tier1-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/generate-report.d.mts +0 -44
- package/dist/types/commands/scan/generate-report.d.mts.map +0 -1
- package/dist/types/commands/scan/handle-create-github-scan.d.mts +0 -12
- package/dist/types/commands/scan/handle-create-github-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/handle-create-new-scan.d.mts +0 -29
- package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/handle-delete-scan.d.mts +0 -3
- package/dist/types/commands/scan/handle-delete-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/handle-diff-scan.d.mts +0 -10
- package/dist/types/commands/scan/handle-diff-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/handle-list-scans.d.mts +0 -13
- package/dist/types/commands/scan/handle-list-scans.d.mts.map +0 -1
- package/dist/types/commands/scan/handle-scan-config.d.mts +0 -2
- package/dist/types/commands/scan/handle-scan-config.d.mts.map +0 -1
- package/dist/types/commands/scan/handle-scan-metadata.d.mts +0 -3
- package/dist/types/commands/scan/handle-scan-metadata.d.mts.map +0 -1
- package/dist/types/commands/scan/handle-scan-reach.d.mts +0 -12
- package/dist/types/commands/scan/handle-scan-reach.d.mts.map +0 -1
- package/dist/types/commands/scan/handle-scan-report.d.mts +0 -14
- package/dist/types/commands/scan/handle-scan-report.d.mts.map +0 -1
- package/dist/types/commands/scan/handle-scan-view.d.mts +0 -3
- package/dist/types/commands/scan/handle-scan-view.d.mts.map +0 -1
- package/dist/types/commands/scan/output-create-new-scan.d.mts +0 -10
- package/dist/types/commands/scan/output-create-new-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/output-delete-scan.d.mts +0 -4
- package/dist/types/commands/scan/output-delete-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/output-diff-scan.d.mts +0 -8
- package/dist/types/commands/scan/output-diff-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/output-list-scans.d.mts +0 -4
- package/dist/types/commands/scan/output-list-scans.d.mts.map +0 -1
- package/dist/types/commands/scan/output-scan-config-result.d.mts +0 -3
- package/dist/types/commands/scan/output-scan-config-result.d.mts.map +0 -1
- package/dist/types/commands/scan/output-scan-github.d.mts +0 -3
- package/dist/types/commands/scan/output-scan-github.d.mts.map +0 -1
- package/dist/types/commands/scan/output-scan-metadata.d.mts +0 -4
- package/dist/types/commands/scan/output-scan-metadata.d.mts.map +0 -1
- package/dist/types/commands/scan/output-scan-reach.d.mts +0 -7
- package/dist/types/commands/scan/output-scan-reach.d.mts.map +0 -1
- package/dist/types/commands/scan/output-scan-report.d.mts +0 -22
- package/dist/types/commands/scan/output-scan-report.d.mts.map +0 -1
- package/dist/types/commands/scan/output-scan-view.d.mts +0 -4
- package/dist/types/commands/scan/output-scan-view.d.mts.map +0 -1
- package/dist/types/commands/scan/perform-reachability-analysis.d.mts +0 -27
- package/dist/types/commands/scan/perform-reachability-analysis.d.mts.map +0 -1
- package/dist/types/commands/scan/reachability-flags.d.mts +0 -3
- package/dist/types/commands/scan/reachability-flags.d.mts.map +0 -1
- package/dist/types/commands/scan/setup-scan-config.d.mts +0 -3
- package/dist/types/commands/scan/setup-scan-config.d.mts.map +0 -1
- package/dist/types/commands/scan/stream-scan.d.mts +0 -7
- package/dist/types/commands/scan/stream-scan.d.mts.map +0 -1
- package/dist/types/commands/scan/suggest-org-slug.d.mts +0 -2
- package/dist/types/commands/scan/suggest-org-slug.d.mts.map +0 -1
- package/dist/types/commands/scan/suggest-to-persist-orgslug.d.mts +0 -2
- package/dist/types/commands/scan/suggest-to-persist-orgslug.d.mts.map +0 -1
- package/dist/types/commands/scan/suggest_branch_slug.d.mts +0 -2
- package/dist/types/commands/scan/suggest_branch_slug.d.mts.map +0 -1
- package/dist/types/commands/scan/suggest_target.d.mts +0 -2
- package/dist/types/commands/scan/suggest_target.d.mts.map +0 -1
- package/dist/types/commands/scan/types.d.mts +0 -3
- package/dist/types/commands/scan/types.d.mts.map +0 -1
- package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts +0 -10
- package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +0 -1
- package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts +0 -13
- package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts.map +0 -1
- package/dist/types/commands/threat-feed/handle-threat-feed.d.mts +0 -13
- package/dist/types/commands/threat-feed/handle-threat-feed.d.mts.map +0 -1
- package/dist/types/commands/threat-feed/output-threat-feed.d.mts +0 -4
- package/dist/types/commands/threat-feed/output-threat-feed.d.mts.map +0 -1
- package/dist/types/commands/threat-feed/types.d.mts +0 -15
- package/dist/types/commands/threat-feed/types.d.mts.map +0 -1
- package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts +0 -8
- package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts.map +0 -1
- package/dist/types/commands/uninstall/cmd-uninstall.d.mts +0 -3
- package/dist/types/commands/uninstall/cmd-uninstall.d.mts.map +0 -1
- package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts +0 -2
- package/dist/types/commands/uninstall/handle-uninstall-completion.d.mts.map +0 -1
- package/dist/types/commands/uninstall/output-uninstall-completion.d.mts +0 -6
- package/dist/types/commands/uninstall/output-uninstall-completion.d.mts.map +0 -1
- package/dist/types/commands/uninstall/teardown-tab-completion.d.mts +0 -6
- package/dist/types/commands/uninstall/teardown-tab-completion.d.mts.map +0 -1
- package/dist/types/commands/wrapper/add-socket-wrapper.d.mts +0 -2
- package/dist/types/commands/wrapper/add-socket-wrapper.d.mts.map +0 -1
- package/dist/types/commands/wrapper/check-socket-wrapper-setup.d.mts +0 -2
- package/dist/types/commands/wrapper/check-socket-wrapper-setup.d.mts.map +0 -1
- package/dist/types/commands/wrapper/cmd-wrapper.d.mts +0 -9
- package/dist/types/commands/wrapper/cmd-wrapper.d.mts.map +0 -1
- package/dist/types/commands/wrapper/postinstall-wrapper.d.mts +0 -2
- package/dist/types/commands/wrapper/postinstall-wrapper.d.mts.map +0 -1
- package/dist/types/commands/wrapper/remove-socket-wrapper.d.mts +0 -2
- package/dist/types/commands/wrapper/remove-socket-wrapper.d.mts.map +0 -1
- package/dist/types/commands/yarn/cmd-yarn.d.mts +0 -10
- package/dist/types/commands/yarn/cmd-yarn.d.mts.map +0 -1
- package/dist/types/commands.d.mts +0 -203
- package/dist/types/commands.d.mts.map +0 -1
- package/dist/types/constants.d.mts +0 -299
- package/dist/types/constants.d.mts.map +0 -1
- package/dist/types/flags.d.mts +0 -18
- package/dist/types/flags.d.mts.map +0 -1
- package/dist/types/instrument-with-sentry.d.mts +0 -2
- package/dist/types/instrument-with-sentry.d.mts.map +0 -1
- package/dist/types/npm-cli.d.mts +0 -3
- package/dist/types/npm-cli.d.mts.map +0 -1
- package/dist/types/npx-cli.d.mts +0 -3
- package/dist/types/npx-cli.d.mts.map +0 -1
- package/dist/types/pnpm-cli.d.mts +0 -3
- package/dist/types/pnpm-cli.d.mts.map +0 -1
- package/dist/types/sea/bootstrap.d.mts +0 -2
- package/dist/types/sea/bootstrap.d.mts.map +0 -1
- package/dist/types/sea/build-sea.d.mts +0 -27
- package/dist/types/sea/build-sea.d.mts.map +0 -1
- package/dist/types/shadow/common.d.mts +0 -23
- package/dist/types/shadow/common.d.mts.map +0 -1
- package/dist/types/shadow/npm/arborist/index.d.mts +0 -8
- package/dist/types/shadow/npm/arborist/index.d.mts.map +0 -1
- package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts +0 -35
- package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts.map +0 -1
- package/dist/types/shadow/npm/arborist/types.d.mts +0 -123
- package/dist/types/shadow/npm/arborist/types.d.mts.map +0 -1
- package/dist/types/shadow/npm/arborist-helpers.d.mts +0 -24
- package/dist/types/shadow/npm/arborist-helpers.d.mts.map +0 -1
- package/dist/types/shadow/npm/bin.d.mts +0 -5
- package/dist/types/shadow/npm/bin.d.mts.map +0 -1
- package/dist/types/shadow/npm/inject.d.mts +0 -2
- package/dist/types/shadow/npm/inject.d.mts.map +0 -1
- package/dist/types/shadow/npm/install.d.mts +0 -13
- package/dist/types/shadow/npm/install.d.mts.map +0 -1
- package/dist/types/shadow/npm/paths.d.mts +0 -6
- package/dist/types/shadow/npm/paths.d.mts.map +0 -1
- package/dist/types/shadow/npm-base.d.mts +0 -11
- package/dist/types/shadow/npm-base.d.mts.map +0 -1
- package/dist/types/shadow/npx/bin.d.mts +0 -5
- package/dist/types/shadow/npx/bin.d.mts.map +0 -1
- package/dist/types/shadow/pnpm/bin.d.mts +0 -10
- package/dist/types/shadow/pnpm/bin.d.mts.map +0 -1
- package/dist/types/shadow/stdio-ipc.d.mts +0 -7
- package/dist/types/shadow/stdio-ipc.d.mts.map +0 -1
- package/dist/types/shadow/yarn/bin.d.mts +0 -10
- package/dist/types/shadow/yarn/bin.d.mts.map +0 -1
- package/dist/types/test/json-output-validation.d.mts +0 -37
- package/dist/types/test/json-output-validation.d.mts.map +0 -1
- package/dist/types/test/mocks/socket-auth.d.mts +0 -88
- package/dist/types/test/mocks/socket-auth.d.mts.map +0 -1
- package/dist/types/types.d.mts +0 -29
- package/dist/types/types.d.mts.map +0 -1
- package/dist/types/utils/agent.d.mts +0 -12
- package/dist/types/utils/agent.d.mts.map +0 -1
- package/dist/types/utils/alert/artifact.d.mts +0 -21
- package/dist/types/utils/alert/artifact.d.mts.map +0 -1
- package/dist/types/utils/alert/fix.d.mts +0 -6
- package/dist/types/utils/alert/fix.d.mts.map +0 -1
- package/dist/types/utils/alert/severity.d.mts +0 -14
- package/dist/types/utils/alert/severity.d.mts.map +0 -1
- package/dist/types/utils/alerts-map.d.mts +0 -27
- package/dist/types/utils/alerts-map.d.mts.map +0 -1
- package/dist/types/utils/api.d.mts +0 -44
- package/dist/types/utils/api.d.mts.map +0 -1
- package/dist/types/utils/check-input.d.mts +0 -9
- package/dist/types/utils/check-input.d.mts.map +0 -1
- package/dist/types/utils/cmd.d.mts +0 -50
- package/dist/types/utils/cmd.d.mts.map +0 -1
- package/dist/types/utils/coana.d.mts +0 -2
- package/dist/types/utils/coana.d.mts.map +0 -1
- package/dist/types/utils/color-or-markdown.d.mts +0 -16
- package/dist/types/utils/color-or-markdown.d.mts.map +0 -1
- package/dist/types/utils/completion.d.mts +0 -11
- package/dist/types/utils/completion.d.mts.map +0 -1
- package/dist/types/utils/config.d.mts +0 -34
- package/dist/types/utils/config.d.mts.map +0 -1
- package/dist/types/utils/cve-to-ghsa.d.mts +0 -6
- package/dist/types/utils/cve-to-ghsa.d.mts.map +0 -1
- package/dist/types/utils/debug.d.mts +0 -45
- package/dist/types/utils/debug.d.mts.map +0 -1
- package/dist/types/utils/determine-org-slug.d.mts +0 -2
- package/dist/types/utils/determine-org-slug.d.mts.map +0 -1
- package/dist/types/utils/dlx-binary.d.mts +0 -58
- package/dist/types/utils/dlx-binary.d.mts.map +0 -1
- package/dist/types/utils/dlx-detection.d.mts +0 -29
- package/dist/types/utils/dlx-detection.d.mts.map +0 -1
- package/dist/types/utils/dlx.d.mts +0 -36
- package/dist/types/utils/dlx.d.mts.map +0 -1
- package/dist/types/utils/ecosystem.d.mts +0 -20
- package/dist/types/utils/ecosystem.d.mts.map +0 -1
- package/dist/types/utils/errors.d.mts +0 -62
- package/dist/types/utils/errors.d.mts.map +0 -1
- package/dist/types/utils/extract-names.d.mts +0 -15
- package/dist/types/utils/extract-names.d.mts.map +0 -1
- package/dist/types/utils/fail-msg-with-badge.d.mts +0 -2
- package/dist/types/utils/fail-msg-with-badge.d.mts.map +0 -1
- package/dist/types/utils/filter-config.d.mts +0 -5
- package/dist/types/utils/filter-config.d.mts.map +0 -1
- package/dist/types/utils/fs.d.mts +0 -8
- package/dist/types/utils/fs.d.mts.map +0 -1
- package/dist/types/utils/get-output-kind.d.mts +0 -3
- package/dist/types/utils/get-output-kind.d.mts.map +0 -1
- package/dist/types/utils/git.d.mts +0 -35
- package/dist/types/utils/git.d.mts.map +0 -1
- package/dist/types/utils/github.d.mts +0 -38
- package/dist/types/utils/github.d.mts.map +0 -1
- package/dist/types/utils/glob.d.mts +0 -15
- package/dist/types/utils/glob.d.mts.map +0 -1
- package/dist/types/utils/lockfile.d.mts +0 -2
- package/dist/types/utils/lockfile.d.mts.map +0 -1
- package/dist/types/utils/map-to-object.d.mts +0 -10
- package/dist/types/utils/map-to-object.d.mts.map +0 -1
- package/dist/types/utils/markdown.d.mts +0 -27
- package/dist/types/utils/markdown.d.mts.map +0 -1
- package/dist/types/utils/meow-with-subcommands.d.mts +0 -83
- package/dist/types/utils/meow-with-subcommands.d.mts.map +0 -1
- package/dist/types/utils/ms-at-home.d.mts +0 -2
- package/dist/types/utils/ms-at-home.d.mts.map +0 -1
- package/dist/types/utils/npm-config.d.mts +0 -14
- package/dist/types/utils/npm-config.d.mts.map +0 -1
- package/dist/types/utils/npm-package-arg.d.mts +0 -8
- package/dist/types/utils/npm-package-arg.d.mts.map +0 -1
- package/dist/types/utils/npm-paths.d.mts +0 -7
- package/dist/types/utils/npm-paths.d.mts.map +0 -1
- package/dist/types/utils/npm-spec.d.mts +0 -57
- package/dist/types/utils/npm-spec.d.mts.map +0 -1
- package/dist/types/utils/objects.d.mts +0 -3
- package/dist/types/utils/objects.d.mts.map +0 -1
- package/dist/types/utils/organization.d.mts +0 -5
- package/dist/types/utils/organization.d.mts.map +0 -1
- package/dist/types/utils/output-formatting.d.mts +0 -20
- package/dist/types/utils/output-formatting.d.mts.map +0 -1
- package/dist/types/utils/package-environment.d.mts +0 -57
- package/dist/types/utils/package-environment.d.mts.map +0 -1
- package/dist/types/utils/path-resolve.d.mts +0 -14
- package/dist/types/utils/path-resolve.d.mts.map +0 -1
- package/dist/types/utils/pnpm-paths.d.mts +0 -5
- package/dist/types/utils/pnpm-paths.d.mts.map +0 -1
- package/dist/types/utils/pnpm.d.mts +0 -11
- package/dist/types/utils/pnpm.d.mts.map +0 -1
- package/dist/types/utils/purl-to-ghsa.d.mts +0 -6
- package/dist/types/utils/purl-to-ghsa.d.mts.map +0 -1
- package/dist/types/utils/purl.d.mts +0 -71
- package/dist/types/utils/purl.d.mts.map +0 -1
- package/dist/types/utils/requirements.d.mts +0 -125
- package/dist/types/utils/requirements.d.mts.map +0 -1
- package/dist/types/utils/sdk.d.mts +0 -17
- package/dist/types/utils/sdk.d.mts.map +0 -1
- package/dist/types/utils/semver.d.mts +0 -7
- package/dist/types/utils/semver.d.mts.map +0 -1
- package/dist/types/utils/serialize-result-json.d.mts +0 -5
- package/dist/types/utils/serialize-result-json.d.mts.map +0 -1
- package/dist/types/utils/shadow-links.d.mts +0 -5
- package/dist/types/utils/shadow-links.d.mts.map +0 -1
- package/dist/types/utils/socket-json.d.mts +0 -59
- package/dist/types/utils/socket-json.d.mts.map +0 -1
- package/dist/types/utils/socket-package-alert.d.mts +0 -80
- package/dist/types/utils/socket-package-alert.d.mts.map +0 -1
- package/dist/types/utils/socket-url.d.mts +0 -8
- package/dist/types/utils/socket-url.d.mts.map +0 -1
- package/dist/types/utils/spec.d.mts +0 -5
- package/dist/types/utils/spec.d.mts.map +0 -1
- package/dist/types/utils/strings.d.mts +0 -14
- package/dist/types/utils/strings.d.mts.map +0 -1
- package/dist/types/utils/terminal-link.d.mts +0 -52
- package/dist/types/utils/terminal-link.d.mts.map +0 -1
- package/dist/types/utils/tildify.d.mts +0 -2
- package/dist/types/utils/tildify.d.mts.map +0 -1
- package/dist/types/utils/translations.d.mts +0 -617
- package/dist/types/utils/translations.d.mts.map +0 -1
- package/dist/types/utils/walk-nested-map.d.mts +0 -7
- package/dist/types/utils/walk-nested-map.d.mts.map +0 -1
- package/dist/types/utils/yarn-paths.d.mts +0 -5
- package/dist/types/utils/yarn-paths.d.mts.map +0 -1
- package/dist/types/utils/yarn-version.d.mts +0 -2
- package/dist/types/utils/yarn-version.d.mts.map +0 -1
- package/dist/types/yarn-cli.d.mts +0 -3
- package/dist/types/yarn-cli.d.mts.map +0 -1
- package/dist/utils.js +0 -6146
- package/dist/utils.js.map +0 -1
- package/dist/vendor.js +0 -162074
- package/dist/yarn-cli.js +0 -30
- package/dist/yarn-cli.js.map +0 -1
- package/external/@socketsecurity/registry/LICENSE +0 -21
- package/external/@socketsecurity/registry/README.md +0 -9
- package/external/@socketsecurity/registry/extensions.json +0 -28
- package/external/@socketsecurity/registry/external/@inquirer/confirm.js +0 -3165
- package/external/@socketsecurity/registry/external/@inquirer/input.js +0 -3202
- package/external/@socketsecurity/registry/external/@inquirer/password.js +0 -3307
- package/external/@socketsecurity/registry/external/@inquirer/search.js +0 -3519
- package/external/@socketsecurity/registry/external/@inquirer/select.js +0 -3655
- package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +0 -21406
- package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/read-package.js +0 -183
- package/external/@socketsecurity/registry/external/@npmcli/package-json/lib/sort.js +0 -274
- package/external/@socketsecurity/registry/external/@npmcli/promise-spawn.js +0 -704
- package/external/@socketsecurity/registry/external/@socketregistry/is-unicode-supported.js +0 -54
- package/external/@socketsecurity/registry/external/@socketregistry/packageurl-js.js +0 -4516
- package/external/@socketsecurity/registry/external/@socketregistry/yocto-spinner.js +0 -453
- package/external/@socketsecurity/registry/external/@yarnpkg/extensions.js +0 -1406
- package/external/@socketsecurity/registry/external/browserslist.js +0 -20496
- package/external/@socketsecurity/registry/external/cacache.js +0 -16208
- package/external/@socketsecurity/registry/external/debug.js +0 -1163
- package/external/@socketsecurity/registry/external/fast-glob.js +0 -7994
- package/external/@socketsecurity/registry/external/fast-sort.js +0 -181
- package/external/@socketsecurity/registry/external/libnpmpack.js +0 -106271
- package/external/@socketsecurity/registry/external/make-fetch-happen.js +0 -38997
- package/external/@socketsecurity/registry/external/normalize-package-data.js +0 -5343
- package/external/@socketsecurity/registry/external/npm-package-arg.js +0 -5773
- package/external/@socketsecurity/registry/external/pacote.js +0 -74109
- package/external/@socketsecurity/registry/external/picomatch.js +0 -2307
- package/external/@socketsecurity/registry/external/semver.js +0 -2618
- package/external/@socketsecurity/registry/external/signal-exit.js +0 -336
- package/external/@socketsecurity/registry/external/spdx-correct.js +0 -1457
- package/external/@socketsecurity/registry/external/spdx-expression-parse.js +0 -1043
- package/external/@socketsecurity/registry/external/streaming-iterables.js +0 -326
- package/external/@socketsecurity/registry/external/validate-npm-package-name.js +0 -108
- package/external/@socketsecurity/registry/external/which.js +0 -405
- package/external/@socketsecurity/registry/external/yoctocolors-cjs.js +0 -101
- package/external/@socketsecurity/registry/index.js +0 -31
- package/external/@socketsecurity/registry/lib/agent.js +0 -390
- package/external/@socketsecurity/registry/lib/arrays.js +0 -89
- package/external/@socketsecurity/registry/lib/bin.js +0 -650
- package/external/@socketsecurity/registry/lib/constants/abort-controller.js +0 -15
- package/external/@socketsecurity/registry/lib/constants/abort-signal.js +0 -27
- package/external/@socketsecurity/registry/lib/constants/at-latest.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/biome-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/bun-lock.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/bun-lockb.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/bun.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ci.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/column-limit.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/copy-left-licenses.js +0 -27
- package/external/@socketsecurity/registry/lib/constants/darwin.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/dot-git-dir.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/dot-package-lock-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/dot-socket-dir.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/empty-file.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/empty-value.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/env.js +0 -59
- package/external/@socketsecurity/registry/lib/constants/eslint-config-js.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/esnext.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/exec-path.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-cjs.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-cmd.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-cts.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-dts.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-js.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-lock.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-lockb.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-md.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-mjs.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-mts.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-ps1.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-yaml.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/ext-yml.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/extensions-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/extensions.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/get-ipc.js +0 -10
- package/external/@socketsecurity/registry/lib/constants/gitignore.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/index.js +0 -139
- package/external/@socketsecurity/registry/lib/constants/ipc-handler.js +0 -19
- package/external/@socketsecurity/registry/lib/constants/ipc-object.js +0 -6
- package/external/@socketsecurity/registry/lib/constants/ipc-promise.js +0 -47
- package/external/@socketsecurity/registry/lib/constants/ipc-target.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/k-internals-symbol.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/latest.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-glob.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-original-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-original-glob.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license-original.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/license.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/lifecycle-script-names.js +0 -18
- package/external/@socketsecurity/registry/lib/constants/loop-sentinel.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/maintained-node-versions.js +0 -47
- package/external/@socketsecurity/registry/lib/constants/manifest-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/mit.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-auth-token.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-debug-flags.js +0 -9
- package/external/@socketsecurity/registry/lib/constants/node-env.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-harden-flags.js +0 -29
- package/external/@socketsecurity/registry/lib/constants/node-modules-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-modules.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/node-no-warnings-flags.js +0 -16
- package/external/@socketsecurity/registry/lib/constants/node-version.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/npm-exec-path.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/npm-real-exec-path.js +0 -6
- package/external/@socketsecurity/registry/lib/constants/npm-shrinkwrap-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/npm.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/npx.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/overrides.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-default-node-range.js +0 -6
- package/external/@socketsecurity/registry/lib/constants/package-default-socket-categories.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-default-version.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-extensions.js +0 -47
- package/external/@socketsecurity/registry/lib/constants/package-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/package-lock-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/packument-cache.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/pacote-cache-path.js +0 -9
- package/external/@socketsecurity/registry/lib/constants/pnpm-exec-path.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/pnpm-lock-yaml.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/pnpm.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/pre-commit.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/readme-glob-recursive.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/readme-glob.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/readme-md.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/registry-scope-delimiter.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/registry.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/resolutions.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-github-org.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-ipc-handshake.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-override-scope.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-public-api-token.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-npm-org.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-package-name.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-repo-name.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-registry-scope.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/socket-security-scope.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/spinner.js +0 -4
- package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-api.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-compile-cache-env-var.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-disable-warning-flag.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-permission-flag.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-node-require-module.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/supports-node-run.js +0 -8
- package/external/@socketsecurity/registry/lib/constants/supports-process-send.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/ts-libs-available.js +0 -22
- package/external/@socketsecurity/registry/lib/constants/ts-types-available.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/tsconfig-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/undefined-token.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unknown-error.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unknown-value.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unlicenced.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/unlicensed.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/utf8.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/vitest.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/vlt-lock-json.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/vlt.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/win32.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn-berry.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn-classic.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn-exec-path.js +0 -5
- package/external/@socketsecurity/registry/lib/constants/yarn-lock.js +0 -3
- package/external/@socketsecurity/registry/lib/constants/yarn.js +0 -3
- package/external/@socketsecurity/registry/lib/debug.js +0 -264
- package/external/@socketsecurity/registry/lib/env.js +0 -62
- package/external/@socketsecurity/registry/lib/fs.js +0 -556
- package/external/@socketsecurity/registry/lib/functions.js +0 -20
- package/external/@socketsecurity/registry/lib/globs.js +0 -145
- package/external/@socketsecurity/registry/lib/json.js +0 -69
- package/external/@socketsecurity/registry/lib/logger.js +0 -534
- package/external/@socketsecurity/registry/lib/objects.js +0 -422
- package/external/@socketsecurity/registry/lib/packages.js +0 -1376
- package/external/@socketsecurity/registry/lib/path.js +0 -231
- package/external/@socketsecurity/registry/lib/promises.js +0 -286
- package/external/@socketsecurity/registry/lib/prompts.js +0 -63
- package/external/@socketsecurity/registry/lib/regexps.js +0 -23
- package/external/@socketsecurity/registry/lib/sorts.js +0 -70
- package/external/@socketsecurity/registry/lib/spawn.js +0 -252
- package/external/@socketsecurity/registry/lib/spinner.js +0 -205
- package/external/@socketsecurity/registry/lib/streams.js +0 -84
- package/external/@socketsecurity/registry/lib/strings.js +0 -235
- package/external/@socketsecurity/registry/lib/url.js +0 -68
- package/external/@socketsecurity/registry/lib/words.js +0 -45
- package/external/@socketsecurity/registry/manifest.json +0 -1875
- package/external/blessed/LICENSE +0 -20
- package/external/blessed/README.md +0 -2421
- package/external/blessed/lib/alias.js +0 -528
- package/external/blessed/lib/blessed.js +0 -34
- package/external/blessed/lib/colors.js +0 -532
- package/external/blessed/lib/events.js +0 -191
- package/external/blessed/lib/gpmclient.js +0 -223
- package/external/blessed/lib/helpers.js +0 -167
- package/external/blessed/lib/keys.js +0 -341
- package/external/blessed/lib/program.js +0 -4297
- package/external/blessed/lib/tput.js +0 -3020
- package/external/blessed/lib/unicode.js +0 -792
- package/external/blessed/lib/widget.js +0 -62
- package/external/blessed/lib/widgets/ansiimage.js +0 -169
- package/external/blessed/lib/widgets/bigtext.js +0 -161
- package/external/blessed/lib/widgets/box.js +0 -36
- package/external/blessed/lib/widgets/button.js +0 -64
- package/external/blessed/lib/widgets/checkbox.js +0 -93
- package/external/blessed/lib/widgets/element.js +0 -2572
- package/external/blessed/lib/widgets/filemanager.js +0 -214
- package/external/blessed/lib/widgets/form.js +0 -269
- package/external/blessed/lib/widgets/image.js +0 -63
- package/external/blessed/lib/widgets/input.js +0 -36
- package/external/blessed/lib/widgets/layout.js +0 -235
- package/external/blessed/lib/widgets/line.js +0 -58
- package/external/blessed/lib/widgets/list.js +0 -601
- package/external/blessed/lib/widgets/listbar.js +0 -413
- package/external/blessed/lib/widgets/listtable.js +0 -254
- package/external/blessed/lib/widgets/loading.js +0 -90
- package/external/blessed/lib/widgets/log.js +0 -85
- package/external/blessed/lib/widgets/message.js +0 -125
- package/external/blessed/lib/widgets/node.js +0 -284
- package/external/blessed/lib/widgets/overlayimage.js +0 -719
- package/external/blessed/lib/widgets/progressbar.js +0 -159
- package/external/blessed/lib/widgets/prompt.js +0 -122
- package/external/blessed/lib/widgets/question.js +0 -118
- package/external/blessed/lib/widgets/radiobutton.js +0 -63
- package/external/blessed/lib/widgets/radioset.js +0 -38
- package/external/blessed/lib/widgets/screen.js +0 -2300
- package/external/blessed/lib/widgets/scrollablebox.js +0 -391
- package/external/blessed/lib/widgets/scrollabletext.js +0 -37
- package/external/blessed/lib/widgets/table.js +0 -356
- package/external/blessed/lib/widgets/terminal.js +0 -414
- package/external/blessed/lib/widgets/text.js +0 -37
- package/external/blessed/lib/widgets/textarea.js +0 -344
- package/external/blessed/lib/widgets/textbox.js +0 -79
- package/external/blessed/lib/widgets/video.js +0 -128
- package/external/blessed/usr/fonts/AUTHORS +0 -1
- package/external/blessed/usr/fonts/LICENSE +0 -94
- package/external/blessed/usr/fonts/README +0 -340
- package/external/blessed/usr/fonts/ter-u14b.json +0 -17826
- package/external/blessed/usr/fonts/ter-u14n.json +0 -17826
- package/external/blessed/usr/linux +0 -0
- package/external/blessed/usr/windows-ansi +0 -0
- package/external/blessed/usr/xterm +0 -0
- package/external/blessed/usr/xterm-256color +0 -0
- package/external/blessed/usr/xterm.termcap +0 -243
- package/external/blessed/usr/xterm.terminfo +0 -1977
- package/external/blessed/vendor/tng.js +0 -1757
- package/external/blessed-contrib/LICENSE.md +0 -21
- package/external/blessed-contrib/lib/layout/grid.js +0 -409
- package/external/blessed-contrib/lib/widget/charts/bar.js +0 -8370
- package/external/blessed-contrib/lib/widget/charts/line.js +0 -17924
- package/external/blessed-contrib/lib/widget/table.js +0 -187
- package/shadow-bin/npm +0 -27
- package/shadow-bin/npx +0 -27
- package/shadow-bin/pnpm +0 -27
- package/shadow-bin/yarn +0 -27
- /package/{translations.json → data/alert-translations.json} +0 -0
- /package/{requirements.json → data/command-api-requirements.json} +0 -0
- /package/{dist → data}/socket-completion.bash +0 -0
|
@@ -1,2300 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* screen.js - screen node for blessed
|
|
5
|
-
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
|
6
|
-
* https://github.com/chjj/blessed
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Modules
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
var path = require('path')
|
|
14
|
-
, fs = require('fs')
|
|
15
|
-
, cp = require('child_process');
|
|
16
|
-
|
|
17
|
-
var colors = require('../colors')
|
|
18
|
-
, program = require('../program')
|
|
19
|
-
, unicode = require('../unicode');
|
|
20
|
-
|
|
21
|
-
var nextTick = global.setImmediate || process.nextTick.bind(process);
|
|
22
|
-
|
|
23
|
-
var helpers = require('../helpers');
|
|
24
|
-
|
|
25
|
-
var Node = require('./node');
|
|
26
|
-
var Log = require('./log');
|
|
27
|
-
var Element = require('./element');
|
|
28
|
-
var Box = require('./box');
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Screen
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
function Screen(options) {
|
|
35
|
-
var self = this;
|
|
36
|
-
|
|
37
|
-
if (!(this instanceof Node)) {
|
|
38
|
-
return new Screen(options);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
Screen.bind(this);
|
|
42
|
-
|
|
43
|
-
options = options || {};
|
|
44
|
-
if (options.rsety && options.listen) {
|
|
45
|
-
options = { program: options };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
this.program = options.program;
|
|
49
|
-
|
|
50
|
-
if (!this.program) {
|
|
51
|
-
this.program = program({
|
|
52
|
-
input: options.input,
|
|
53
|
-
output: options.output,
|
|
54
|
-
log: options.log,
|
|
55
|
-
debug: options.debug,
|
|
56
|
-
dump: options.dump,
|
|
57
|
-
terminal: options.terminal || options.term,
|
|
58
|
-
resizeTimeout: options.resizeTimeout,
|
|
59
|
-
forceUnicode: options.forceUnicode,
|
|
60
|
-
tput: true,
|
|
61
|
-
buffer: true,
|
|
62
|
-
zero: true
|
|
63
|
-
});
|
|
64
|
-
} else {
|
|
65
|
-
this.program.setupTput();
|
|
66
|
-
this.program.useBuffer = true;
|
|
67
|
-
this.program.zero = true;
|
|
68
|
-
this.program.options.resizeTimeout = options.resizeTimeout;
|
|
69
|
-
if (options.forceUnicode != null) {
|
|
70
|
-
this.program.tput.features.unicode = options.forceUnicode;
|
|
71
|
-
this.program.tput.unicode = options.forceUnicode;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
this.tput = this.program.tput;
|
|
76
|
-
|
|
77
|
-
Node.call(this, options);
|
|
78
|
-
|
|
79
|
-
this.autoPadding = options.autoPadding !== false;
|
|
80
|
-
this.tabc = Array((options.tabSize || 4) + 1).join(' ');
|
|
81
|
-
this.dockBorders = options.dockBorders;
|
|
82
|
-
|
|
83
|
-
this.ignoreLocked = options.ignoreLocked || [];
|
|
84
|
-
|
|
85
|
-
this._unicode = this.tput.unicode || this.tput.numbers.U8 === 1;
|
|
86
|
-
this.fullUnicode = this.options.fullUnicode && this._unicode;
|
|
87
|
-
|
|
88
|
-
this.dattr = ((0 << 18) | (0x1ff << 9)) | 0x1ff;
|
|
89
|
-
|
|
90
|
-
this.renders = 0;
|
|
91
|
-
this.position = {
|
|
92
|
-
left: this.left = this.aleft = this.rleft = 0,
|
|
93
|
-
right: this.right = this.aright = this.rright = 0,
|
|
94
|
-
top: this.top = this.atop = this.rtop = 0,
|
|
95
|
-
bottom: this.bottom = this.abottom = this.rbottom = 0,
|
|
96
|
-
get height() { return self.height; },
|
|
97
|
-
get width() { return self.width; }
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
this.ileft = 0;
|
|
101
|
-
this.itop = 0;
|
|
102
|
-
this.iright = 0;
|
|
103
|
-
this.ibottom = 0;
|
|
104
|
-
this.iheight = 0;
|
|
105
|
-
this.iwidth = 0;
|
|
106
|
-
|
|
107
|
-
this.padding = {
|
|
108
|
-
left: 0,
|
|
109
|
-
top: 0,
|
|
110
|
-
right: 0,
|
|
111
|
-
bottom: 0
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
this.hover = null;
|
|
115
|
-
this.history = [];
|
|
116
|
-
this.clickable = [];
|
|
117
|
-
this.keyable = [];
|
|
118
|
-
this.grabKeys = false;
|
|
119
|
-
this.lockKeys = false;
|
|
120
|
-
this.focused;
|
|
121
|
-
this._buf = '';
|
|
122
|
-
|
|
123
|
-
this._ci = -1;
|
|
124
|
-
|
|
125
|
-
if (options.title) {
|
|
126
|
-
this.title = options.title;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
options.cursor = options.cursor || {
|
|
130
|
-
artificial: options.artificialCursor,
|
|
131
|
-
shape: options.cursorShape,
|
|
132
|
-
blink: options.cursorBlink,
|
|
133
|
-
color: options.cursorColor
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
this.cursor = {
|
|
137
|
-
artificial: options.cursor.artificial || false,
|
|
138
|
-
shape: options.cursor.shape || 'block',
|
|
139
|
-
blink: options.cursor.blink || false,
|
|
140
|
-
color: options.cursor.color || null,
|
|
141
|
-
_set: false,
|
|
142
|
-
_state: 1,
|
|
143
|
-
_hidden: true
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
this.program.on('resize', function() {
|
|
147
|
-
self.alloc();
|
|
148
|
-
self.render();
|
|
149
|
-
(function emit(el) {
|
|
150
|
-
el.emit('resize');
|
|
151
|
-
el.children.forEach(emit);
|
|
152
|
-
})(self);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
this.program.on('focus', function() {
|
|
156
|
-
self.emit('focus');
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
this.program.on('blur', function() {
|
|
160
|
-
self.emit('blur');
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
this.program.on('warning', function(text) {
|
|
164
|
-
self.emit('warning', text);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
this.on('newListener', function fn(type) {
|
|
168
|
-
if (type === 'keypress' || type.indexOf('key ') === 0 || type === 'mouse') {
|
|
169
|
-
if (type === 'keypress' || type.indexOf('key ') === 0) self._listenKeys();
|
|
170
|
-
if (type === 'mouse') self._listenMouse();
|
|
171
|
-
}
|
|
172
|
-
if (type === 'mouse'
|
|
173
|
-
|| type === 'click'
|
|
174
|
-
|| type === 'mouseover'
|
|
175
|
-
|| type === 'mouseout'
|
|
176
|
-
|| type === 'mousedown'
|
|
177
|
-
|| type === 'mouseup'
|
|
178
|
-
|| type === 'mousewheel'
|
|
179
|
-
|| type === 'wheeldown'
|
|
180
|
-
|| type === 'wheelup'
|
|
181
|
-
|| type === 'mousemove') {
|
|
182
|
-
self._listenMouse();
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
this.setMaxListeners(Infinity);
|
|
187
|
-
|
|
188
|
-
this.enter();
|
|
189
|
-
|
|
190
|
-
this.postEnter();
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
Screen.global = null;
|
|
194
|
-
|
|
195
|
-
Screen.total = 0;
|
|
196
|
-
|
|
197
|
-
Screen.instances = [];
|
|
198
|
-
|
|
199
|
-
Screen.bind = function(screen) {
|
|
200
|
-
if (!Screen.global) {
|
|
201
|
-
Screen.global = screen;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (!~Screen.instances.indexOf(screen)) {
|
|
205
|
-
Screen.instances.push(screen);
|
|
206
|
-
screen.index = Screen.total;
|
|
207
|
-
Screen.total++;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (Screen._bound) return;
|
|
211
|
-
Screen._bound = true;
|
|
212
|
-
|
|
213
|
-
process.on('uncaughtException', Screen._exceptionHandler = function(err) {
|
|
214
|
-
if (process.listeners('uncaughtException').length > 1) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
Screen.instances.slice().forEach(function(screen) {
|
|
218
|
-
screen.destroy();
|
|
219
|
-
});
|
|
220
|
-
err = err || new Error('Uncaught Exception.');
|
|
221
|
-
console.error(err.stack ? err.stack + '' : err + '');
|
|
222
|
-
nextTick(function() {
|
|
223
|
-
process.exit(1);
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
['SIGTERM', 'SIGINT', 'SIGQUIT'].forEach(function(signal) {
|
|
228
|
-
var name = '_' + signal.toLowerCase() + 'Handler';
|
|
229
|
-
process.on(signal, Screen[name] = function() {
|
|
230
|
-
if (process.listeners(signal).length > 1) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
nextTick(function() {
|
|
234
|
-
process.exit(0);
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
process.on('exit', Screen._exitHandler = function() {
|
|
240
|
-
Screen.instances.slice().forEach(function(screen) {
|
|
241
|
-
screen.destroy();
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
Screen.prototype.__proto__ = Node.prototype;
|
|
247
|
-
|
|
248
|
-
Screen.prototype.type = 'screen';
|
|
249
|
-
|
|
250
|
-
Screen.prototype.__defineGetter__('title', function() {
|
|
251
|
-
return this.program.title;
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
Screen.prototype.__defineSetter__('title', function(title) {
|
|
255
|
-
return this.program.title = title;
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
Screen.prototype.__defineGetter__('terminal', function() {
|
|
259
|
-
return this.program.terminal;
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
Screen.prototype.__defineSetter__('terminal', function(terminal) {
|
|
263
|
-
this.setTerminal(terminal);
|
|
264
|
-
return this.program.terminal;
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
Screen.prototype.setTerminal = function(terminal) {
|
|
268
|
-
var entered = !!this.program.isAlt;
|
|
269
|
-
if (entered) {
|
|
270
|
-
this._buf = '';
|
|
271
|
-
this.program._buf = '';
|
|
272
|
-
this.leave();
|
|
273
|
-
}
|
|
274
|
-
this.program.setTerminal(terminal);
|
|
275
|
-
this.tput = this.program.tput;
|
|
276
|
-
if (entered) {
|
|
277
|
-
this.enter();
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
Screen.prototype.enter = function() {
|
|
282
|
-
if (this.program.isAlt) return;
|
|
283
|
-
if (!this.cursor._set) {
|
|
284
|
-
if (this.options.cursor.shape) {
|
|
285
|
-
this.cursorShape(this.cursor.shape, this.cursor.blink);
|
|
286
|
-
}
|
|
287
|
-
if (this.options.cursor.color) {
|
|
288
|
-
this.cursorColor(this.cursor.color);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
if (process.platform === 'win32') {
|
|
292
|
-
try {
|
|
293
|
-
cp.execSync('cls', { stdio: 'ignore', timeout: 1000 });
|
|
294
|
-
} catch (e) {
|
|
295
|
-
;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
this.program.alternateBuffer();
|
|
299
|
-
this.program.put.keypad_xmit();
|
|
300
|
-
this.program.csr(0, this.height - 1);
|
|
301
|
-
this.program.hideCursor();
|
|
302
|
-
this.program.cup(0, 0);
|
|
303
|
-
// We need this for tmux now:
|
|
304
|
-
if (this.tput.strings.ena_acs) {
|
|
305
|
-
this.program._write(this.tput.enacs());
|
|
306
|
-
}
|
|
307
|
-
this.alloc();
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
Screen.prototype.leave = function() {
|
|
311
|
-
if (!this.program.isAlt) return;
|
|
312
|
-
this.program.put.keypad_local();
|
|
313
|
-
if (this.program.scrollTop !== 0
|
|
314
|
-
|| this.program.scrollBottom !== this.rows - 1) {
|
|
315
|
-
this.program.csr(0, this.height - 1);
|
|
316
|
-
}
|
|
317
|
-
// XXX For some reason if alloc/clear() is before this
|
|
318
|
-
// line, it doesn't work on linux console.
|
|
319
|
-
this.program.showCursor();
|
|
320
|
-
this.alloc();
|
|
321
|
-
if (this._listenedMouse) {
|
|
322
|
-
this.program.disableMouse();
|
|
323
|
-
}
|
|
324
|
-
this.program.normalBuffer();
|
|
325
|
-
if (this.cursor._set) this.cursorReset();
|
|
326
|
-
this.program.flush();
|
|
327
|
-
if (process.platform === 'win32') {
|
|
328
|
-
try {
|
|
329
|
-
cp.execSync('cls', { stdio: 'ignore', timeout: 1000 });
|
|
330
|
-
} catch (e) {
|
|
331
|
-
;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
Screen.prototype.postEnter = function() {
|
|
337
|
-
var self = this;
|
|
338
|
-
if (this.options.debug) {
|
|
339
|
-
this.debugLog = new Log({
|
|
340
|
-
screen: this,
|
|
341
|
-
parent: this,
|
|
342
|
-
hidden: true,
|
|
343
|
-
draggable: true,
|
|
344
|
-
left: 'center',
|
|
345
|
-
top: 'center',
|
|
346
|
-
width: '30%',
|
|
347
|
-
height: '30%',
|
|
348
|
-
border: 'line',
|
|
349
|
-
label: ' {bold}Debug Log{/bold} ',
|
|
350
|
-
tags: true,
|
|
351
|
-
keys: true,
|
|
352
|
-
vi: true,
|
|
353
|
-
mouse: true,
|
|
354
|
-
scrollbar: {
|
|
355
|
-
ch: ' ',
|
|
356
|
-
track: {
|
|
357
|
-
bg: 'yellow'
|
|
358
|
-
},
|
|
359
|
-
style: {
|
|
360
|
-
inverse: true
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
this.debugLog.toggle = function() {
|
|
366
|
-
if (self.debugLog.hidden) {
|
|
367
|
-
self.saveFocus();
|
|
368
|
-
self.debugLog.show();
|
|
369
|
-
self.debugLog.setFront();
|
|
370
|
-
self.debugLog.focus();
|
|
371
|
-
} else {
|
|
372
|
-
self.debugLog.hide();
|
|
373
|
-
self.restoreFocus();
|
|
374
|
-
}
|
|
375
|
-
self.render();
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
this.debugLog.key(['q', 'escape'], self.debugLog.toggle);
|
|
379
|
-
this.key('f12', self.debugLog.toggle);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
if (this.options.warnings) {
|
|
383
|
-
this.on('warning', function(text) {
|
|
384
|
-
var warning = new Box({
|
|
385
|
-
screen: self,
|
|
386
|
-
parent: self,
|
|
387
|
-
left: 'center',
|
|
388
|
-
top: 'center',
|
|
389
|
-
width: 'shrink',
|
|
390
|
-
padding: 1,
|
|
391
|
-
height: 'shrink',
|
|
392
|
-
align: 'center',
|
|
393
|
-
valign: 'middle',
|
|
394
|
-
border: 'line',
|
|
395
|
-
label: ' {red-fg}{bold}WARNING{/} ',
|
|
396
|
-
content: '{bold}' + text + '{/bold}',
|
|
397
|
-
tags: true
|
|
398
|
-
});
|
|
399
|
-
self.render();
|
|
400
|
-
var timeout = setTimeout(function() {
|
|
401
|
-
warning.destroy();
|
|
402
|
-
self.render();
|
|
403
|
-
}, 1500);
|
|
404
|
-
if (timeout.unref) {
|
|
405
|
-
timeout.unref();
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
Screen.prototype._destroy = Screen.prototype.destroy;
|
|
412
|
-
Screen.prototype.destroy = function() {
|
|
413
|
-
this.leave();
|
|
414
|
-
|
|
415
|
-
var index = Screen.instances.indexOf(this);
|
|
416
|
-
if (~index) {
|
|
417
|
-
Screen.instances.splice(index, 1);
|
|
418
|
-
Screen.total--;
|
|
419
|
-
|
|
420
|
-
Screen.global = Screen.instances[0];
|
|
421
|
-
|
|
422
|
-
if (Screen.total === 0) {
|
|
423
|
-
Screen.global = null;
|
|
424
|
-
|
|
425
|
-
process.removeListener('uncaughtException', Screen._exceptionHandler);
|
|
426
|
-
process.removeListener('SIGTERM', Screen._sigtermHandler);
|
|
427
|
-
process.removeListener('SIGINT', Screen._sigintHandler);
|
|
428
|
-
process.removeListener('SIGQUIT', Screen._sigquitHandler);
|
|
429
|
-
process.removeListener('exit', Screen._exitHandler);
|
|
430
|
-
delete Screen._exceptionHandler;
|
|
431
|
-
delete Screen._sigtermHandler;
|
|
432
|
-
delete Screen._sigintHandler;
|
|
433
|
-
delete Screen._sigquitHandler;
|
|
434
|
-
delete Screen._exitHandler;
|
|
435
|
-
|
|
436
|
-
delete Screen._bound;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
this.destroyed = true;
|
|
440
|
-
this.emit('destroy');
|
|
441
|
-
this._destroy();
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
this.program.destroy();
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
Screen.prototype.log = function() {
|
|
448
|
-
return this.program.log.apply(this.program, arguments);
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
Screen.prototype.debug = function() {
|
|
452
|
-
if (this.debugLog) {
|
|
453
|
-
this.debugLog.log.apply(this.debugLog, arguments);
|
|
454
|
-
}
|
|
455
|
-
return this.program.debug.apply(this.program, arguments);
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
Screen.prototype._listenMouse = function(el) {
|
|
459
|
-
var self = this;
|
|
460
|
-
|
|
461
|
-
if (el && !~this.clickable.indexOf(el)) {
|
|
462
|
-
el.clickable = true;
|
|
463
|
-
this.clickable.push(el);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
if (this._listenedMouse) return;
|
|
467
|
-
this._listenedMouse = true;
|
|
468
|
-
|
|
469
|
-
this.program.enableMouse();
|
|
470
|
-
if (this.options.sendFocus) {
|
|
471
|
-
this.program.setMouse({ sendFocus: true }, true);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
this.on('render', function() {
|
|
475
|
-
self._needsClickableSort = true;
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
this.program.on('mouse', function(data) {
|
|
479
|
-
if (self.lockKeys) return;
|
|
480
|
-
|
|
481
|
-
if (self._needsClickableSort) {
|
|
482
|
-
self.clickable = helpers.hsort(self.clickable);
|
|
483
|
-
self._needsClickableSort = false;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
var i = 0
|
|
487
|
-
, el
|
|
488
|
-
, set
|
|
489
|
-
, pos;
|
|
490
|
-
|
|
491
|
-
for (; i < self.clickable.length; i++) {
|
|
492
|
-
el = self.clickable[i];
|
|
493
|
-
|
|
494
|
-
if (el.detached || !el.visible) {
|
|
495
|
-
continue;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
// if (self.grabMouse && self.focused !== el
|
|
499
|
-
// && !el.hasAncestor(self.focused)) continue;
|
|
500
|
-
|
|
501
|
-
pos = el.lpos;
|
|
502
|
-
if (!pos) continue;
|
|
503
|
-
|
|
504
|
-
if (data.x >= pos.xi && data.x < pos.xl
|
|
505
|
-
&& data.y >= pos.yi && data.y < pos.yl) {
|
|
506
|
-
el.emit('mouse', data);
|
|
507
|
-
if (data.action === 'mousedown') {
|
|
508
|
-
self.mouseDown = el;
|
|
509
|
-
} else if (data.action === 'mouseup') {
|
|
510
|
-
(self.mouseDown || el).emit('click', data);
|
|
511
|
-
self.mouseDown = null;
|
|
512
|
-
} else if (data.action === 'mousemove') {
|
|
513
|
-
if (self.hover && el.index > self.hover.index) {
|
|
514
|
-
set = false;
|
|
515
|
-
}
|
|
516
|
-
if (self.hover !== el && !set) {
|
|
517
|
-
if (self.hover) {
|
|
518
|
-
self.hover.emit('mouseout', data);
|
|
519
|
-
}
|
|
520
|
-
el.emit('mouseover', data);
|
|
521
|
-
self.hover = el;
|
|
522
|
-
}
|
|
523
|
-
set = true;
|
|
524
|
-
}
|
|
525
|
-
el.emit(data.action, data);
|
|
526
|
-
break;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
// Just mouseover?
|
|
531
|
-
if ((data.action === 'mousemove'
|
|
532
|
-
|| data.action === 'mousedown'
|
|
533
|
-
|| data.action === 'mouseup')
|
|
534
|
-
&& self.hover
|
|
535
|
-
&& !set) {
|
|
536
|
-
self.hover.emit('mouseout', data);
|
|
537
|
-
self.hover = null;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
self.emit('mouse', data);
|
|
541
|
-
self.emit(data.action, data);
|
|
542
|
-
});
|
|
543
|
-
|
|
544
|
-
// Autofocus highest element.
|
|
545
|
-
// this.on('element click', function(el, data) {
|
|
546
|
-
// var target;
|
|
547
|
-
// do {
|
|
548
|
-
// if (el.clickable === true && el.options.autoFocus !== false) {
|
|
549
|
-
// target = el;
|
|
550
|
-
// }
|
|
551
|
-
// } while (el = el.parent);
|
|
552
|
-
// if (target) target.focus();
|
|
553
|
-
// });
|
|
554
|
-
|
|
555
|
-
// Autofocus elements with the appropriate option.
|
|
556
|
-
this.on('element click', function(el) {
|
|
557
|
-
if (el.clickable === true && el.options.autoFocus !== false) {
|
|
558
|
-
el.focus();
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
Screen.prototype.enableMouse = function(el) {
|
|
564
|
-
this._listenMouse(el);
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
Screen.prototype._listenKeys = function(el) {
|
|
568
|
-
var self = this;
|
|
569
|
-
|
|
570
|
-
if (el && !~this.keyable.indexOf(el)) {
|
|
571
|
-
el.keyable = true;
|
|
572
|
-
this.keyable.push(el);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
if (this._listenedKeys) return;
|
|
576
|
-
this._listenedKeys = true;
|
|
577
|
-
|
|
578
|
-
// NOTE: The event emissions used to be reversed:
|
|
579
|
-
// element + screen
|
|
580
|
-
// They are now:
|
|
581
|
-
// screen + element
|
|
582
|
-
// After the first keypress emitted, the handler
|
|
583
|
-
// checks to make sure grabKeys, lockKeys, and focused
|
|
584
|
-
// weren't changed, and handles those situations appropriately.
|
|
585
|
-
this.program.on('keypress', function(ch, key) {
|
|
586
|
-
if (self.lockKeys && !~self.ignoreLocked.indexOf(key.full)) {
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
var focused = self.focused
|
|
591
|
-
, grabKeys = self.grabKeys;
|
|
592
|
-
|
|
593
|
-
if (!grabKeys || ~self.ignoreLocked.indexOf(key.full)) {
|
|
594
|
-
self.emit('keypress', ch, key);
|
|
595
|
-
self.emit('key ' + key.full, ch, key);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
// If something changed from the screen key handler, stop.
|
|
599
|
-
if (self.grabKeys !== grabKeys || self.lockKeys) {
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
if (focused && focused.keyable) {
|
|
604
|
-
focused.emit('keypress', ch, key);
|
|
605
|
-
focused.emit('key ' + key.full, ch, key);
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
};
|
|
609
|
-
|
|
610
|
-
Screen.prototype.enableKeys = function(el) {
|
|
611
|
-
this._listenKeys(el);
|
|
612
|
-
};
|
|
613
|
-
|
|
614
|
-
Screen.prototype.enableInput = function(el) {
|
|
615
|
-
this._listenMouse(el);
|
|
616
|
-
this._listenKeys(el);
|
|
617
|
-
};
|
|
618
|
-
|
|
619
|
-
Screen.prototype._initHover = function() {
|
|
620
|
-
var self = this;
|
|
621
|
-
|
|
622
|
-
if (this._hoverText) {
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
this._hoverText = new Box({
|
|
627
|
-
screen: this,
|
|
628
|
-
left: 0,
|
|
629
|
-
top: 0,
|
|
630
|
-
tags: false,
|
|
631
|
-
height: 'shrink',
|
|
632
|
-
width: 'shrink',
|
|
633
|
-
border: 'line',
|
|
634
|
-
style: {
|
|
635
|
-
border: {
|
|
636
|
-
fg: 'default'
|
|
637
|
-
},
|
|
638
|
-
bg: 'default',
|
|
639
|
-
fg: 'default'
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
|
|
643
|
-
this.on('mousemove', function(data) {
|
|
644
|
-
if (self._hoverText.detached) return;
|
|
645
|
-
self._hoverText.rleft = data.x + 1;
|
|
646
|
-
self._hoverText.rtop = data.y;
|
|
647
|
-
self.render();
|
|
648
|
-
});
|
|
649
|
-
|
|
650
|
-
this.on('element mouseover', function(el, data) {
|
|
651
|
-
if (!el._hoverOptions) return;
|
|
652
|
-
self._hoverText.parseTags = el.parseTags;
|
|
653
|
-
self._hoverText.setContent(el._hoverOptions.text);
|
|
654
|
-
self.append(self._hoverText);
|
|
655
|
-
self._hoverText.rleft = data.x + 1;
|
|
656
|
-
self._hoverText.rtop = data.y;
|
|
657
|
-
self.render();
|
|
658
|
-
});
|
|
659
|
-
|
|
660
|
-
this.on('element mouseout', function() {
|
|
661
|
-
if (self._hoverText.detached) return;
|
|
662
|
-
self._hoverText.detach();
|
|
663
|
-
self.render();
|
|
664
|
-
});
|
|
665
|
-
|
|
666
|
-
// XXX This can cause problems if the
|
|
667
|
-
// terminal does not support allMotion.
|
|
668
|
-
// Workaround: check to see if content is set.
|
|
669
|
-
this.on('element mouseup', function(el) {
|
|
670
|
-
if (!self._hoverText.getContent()) return;
|
|
671
|
-
if (!el._hoverOptions) return;
|
|
672
|
-
self.append(self._hoverText);
|
|
673
|
-
self.render();
|
|
674
|
-
});
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
Screen.prototype.__defineGetter__('cols', function() {
|
|
678
|
-
return this.program.cols;
|
|
679
|
-
});
|
|
680
|
-
|
|
681
|
-
Screen.prototype.__defineGetter__('rows', function() {
|
|
682
|
-
return this.program.rows;
|
|
683
|
-
});
|
|
684
|
-
|
|
685
|
-
Screen.prototype.__defineGetter__('width', function() {
|
|
686
|
-
return this.program.cols;
|
|
687
|
-
});
|
|
688
|
-
|
|
689
|
-
Screen.prototype.__defineGetter__('height', function() {
|
|
690
|
-
return this.program.rows;
|
|
691
|
-
});
|
|
692
|
-
|
|
693
|
-
Screen.prototype.alloc = function(dirty) {
|
|
694
|
-
var x, y;
|
|
695
|
-
|
|
696
|
-
this.lines = [];
|
|
697
|
-
for (y = 0; y < this.rows; y++) {
|
|
698
|
-
this.lines[y] = [];
|
|
699
|
-
for (x = 0; x < this.cols; x++) {
|
|
700
|
-
this.lines[y][x] = [this.dattr, ' '];
|
|
701
|
-
}
|
|
702
|
-
this.lines[y].dirty = !!dirty;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
this.olines = [];
|
|
706
|
-
for (y = 0; y < this.rows; y++) {
|
|
707
|
-
this.olines[y] = [];
|
|
708
|
-
for (x = 0; x < this.cols; x++) {
|
|
709
|
-
this.olines[y][x] = [this.dattr, ' '];
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
this.program.clear();
|
|
714
|
-
};
|
|
715
|
-
|
|
716
|
-
Screen.prototype.realloc = function() {
|
|
717
|
-
return this.alloc(true);
|
|
718
|
-
};
|
|
719
|
-
|
|
720
|
-
Screen.prototype.render = function() {
|
|
721
|
-
var self = this;
|
|
722
|
-
|
|
723
|
-
if (this.destroyed) return;
|
|
724
|
-
|
|
725
|
-
this.emit('prerender');
|
|
726
|
-
|
|
727
|
-
this._borderStops = {};
|
|
728
|
-
|
|
729
|
-
// TODO: Possibly get rid of .dirty altogether.
|
|
730
|
-
// TODO: Could possibly drop .dirty and just clear the `lines` buffer every
|
|
731
|
-
// time before a screen.render. This way clearRegion doesn't have to be
|
|
732
|
-
// called in arbitrary places for the sake of clearing a spot where an
|
|
733
|
-
// element used to be (e.g. when an element moves or is hidden). There could
|
|
734
|
-
// be some overhead though.
|
|
735
|
-
// this.screen.clearRegion(0, this.cols, 0, this.rows);
|
|
736
|
-
this._ci = 0;
|
|
737
|
-
this.children.forEach(function(el) {
|
|
738
|
-
el.index = self._ci++;
|
|
739
|
-
//el._rendering = true;
|
|
740
|
-
el.render();
|
|
741
|
-
//el._rendering = false;
|
|
742
|
-
});
|
|
743
|
-
this._ci = -1;
|
|
744
|
-
|
|
745
|
-
if (this.screen.dockBorders) {
|
|
746
|
-
this._dockBorders();
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
this.draw(0, this.lines.length - 1);
|
|
750
|
-
|
|
751
|
-
// XXX Workaround to deal with cursor pos before the screen has rendered and
|
|
752
|
-
// lpos is not reliable (stale).
|
|
753
|
-
if (this.focused && this.focused._updateCursor) {
|
|
754
|
-
this.focused._updateCursor(true);
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
this.renders++;
|
|
758
|
-
|
|
759
|
-
this.emit('render');
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
Screen.prototype.blankLine = function(ch, dirty) {
|
|
763
|
-
var out = [];
|
|
764
|
-
for (var x = 0; x < this.cols; x++) {
|
|
765
|
-
out[x] = [this.dattr, ch || ' '];
|
|
766
|
-
}
|
|
767
|
-
out.dirty = dirty;
|
|
768
|
-
return out;
|
|
769
|
-
};
|
|
770
|
-
|
|
771
|
-
Screen.prototype.insertLine = function(n, y, top, bottom) {
|
|
772
|
-
// if (y === top) return this.insertLineNC(n, y, top, bottom);
|
|
773
|
-
|
|
774
|
-
if (!this.tput.strings.change_scroll_region
|
|
775
|
-
|| !this.tput.strings.delete_line
|
|
776
|
-
|| !this.tput.strings.insert_line) return;
|
|
777
|
-
|
|
778
|
-
this._buf += this.tput.csr(top, bottom);
|
|
779
|
-
this._buf += this.tput.cup(y, 0);
|
|
780
|
-
this._buf += this.tput.il(n);
|
|
781
|
-
this._buf += this.tput.csr(0, this.height - 1);
|
|
782
|
-
|
|
783
|
-
var j = bottom + 1;
|
|
784
|
-
|
|
785
|
-
while (n--) {
|
|
786
|
-
this.lines.splice(y, 0, this.blankLine());
|
|
787
|
-
this.lines.splice(j, 1);
|
|
788
|
-
this.olines.splice(y, 0, this.blankLine());
|
|
789
|
-
this.olines.splice(j, 1);
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
|
|
793
|
-
Screen.prototype.deleteLine = function(n, y, top, bottom) {
|
|
794
|
-
// if (y === top) return this.deleteLineNC(n, y, top, bottom);
|
|
795
|
-
|
|
796
|
-
if (!this.tput.strings.change_scroll_region
|
|
797
|
-
|| !this.tput.strings.delete_line
|
|
798
|
-
|| !this.tput.strings.insert_line) return;
|
|
799
|
-
|
|
800
|
-
this._buf += this.tput.csr(top, bottom);
|
|
801
|
-
this._buf += this.tput.cup(y, 0);
|
|
802
|
-
this._buf += this.tput.dl(n);
|
|
803
|
-
this._buf += this.tput.csr(0, this.height - 1);
|
|
804
|
-
|
|
805
|
-
var j = bottom + 1;
|
|
806
|
-
|
|
807
|
-
while (n--) {
|
|
808
|
-
this.lines.splice(j, 0, this.blankLine());
|
|
809
|
-
this.lines.splice(y, 1);
|
|
810
|
-
this.olines.splice(j, 0, this.blankLine());
|
|
811
|
-
this.olines.splice(y, 1);
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
|
|
815
|
-
// This is how ncurses does it.
|
|
816
|
-
// Scroll down (up cursor-wise).
|
|
817
|
-
// This will only work for top line deletion as opposed to arbitrary lines.
|
|
818
|
-
Screen.prototype.insertLineNC = function(n, y, top, bottom) {
|
|
819
|
-
if (!this.tput.strings.change_scroll_region
|
|
820
|
-
|| !this.tput.strings.delete_line) return;
|
|
821
|
-
|
|
822
|
-
this._buf += this.tput.csr(top, bottom);
|
|
823
|
-
this._buf += this.tput.cup(top, 0);
|
|
824
|
-
this._buf += this.tput.dl(n);
|
|
825
|
-
this._buf += this.tput.csr(0, this.height - 1);
|
|
826
|
-
|
|
827
|
-
var j = bottom + 1;
|
|
828
|
-
|
|
829
|
-
while (n--) {
|
|
830
|
-
this.lines.splice(j, 0, this.blankLine());
|
|
831
|
-
this.lines.splice(y, 1);
|
|
832
|
-
this.olines.splice(j, 0, this.blankLine());
|
|
833
|
-
this.olines.splice(y, 1);
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
|
|
837
|
-
// This is how ncurses does it.
|
|
838
|
-
// Scroll up (down cursor-wise).
|
|
839
|
-
// This will only work for bottom line deletion as opposed to arbitrary lines.
|
|
840
|
-
Screen.prototype.deleteLineNC = function(n, y, top, bottom) {
|
|
841
|
-
if (!this.tput.strings.change_scroll_region
|
|
842
|
-
|| !this.tput.strings.delete_line) return;
|
|
843
|
-
|
|
844
|
-
this._buf += this.tput.csr(top, bottom);
|
|
845
|
-
this._buf += this.tput.cup(bottom, 0);
|
|
846
|
-
this._buf += Array(n + 1).join('\n');
|
|
847
|
-
this._buf += this.tput.csr(0, this.height - 1);
|
|
848
|
-
|
|
849
|
-
var j = bottom + 1;
|
|
850
|
-
|
|
851
|
-
while (n--) {
|
|
852
|
-
this.lines.splice(j, 0, this.blankLine());
|
|
853
|
-
this.lines.splice(y, 1);
|
|
854
|
-
this.olines.splice(j, 0, this.blankLine());
|
|
855
|
-
this.olines.splice(y, 1);
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
Screen.prototype.insertBottom = function(top, bottom) {
|
|
860
|
-
return this.deleteLine(1, top, top, bottom);
|
|
861
|
-
};
|
|
862
|
-
|
|
863
|
-
Screen.prototype.insertTop = function(top, bottom) {
|
|
864
|
-
return this.insertLine(1, top, top, bottom);
|
|
865
|
-
};
|
|
866
|
-
|
|
867
|
-
Screen.prototype.deleteBottom = function(top, bottom) {
|
|
868
|
-
return this.clearRegion(0, this.width, bottom, bottom);
|
|
869
|
-
};
|
|
870
|
-
|
|
871
|
-
Screen.prototype.deleteTop = function(top, bottom) {
|
|
872
|
-
// Same as: return this.insertBottom(top, bottom);
|
|
873
|
-
return this.deleteLine(1, top, top, bottom);
|
|
874
|
-
};
|
|
875
|
-
|
|
876
|
-
// Parse the sides of an element to determine
|
|
877
|
-
// whether an element has uniform cells on
|
|
878
|
-
// both sides. If it does, we can use CSR to
|
|
879
|
-
// optimize scrolling on a scrollable element.
|
|
880
|
-
// Not exactly sure how worthwile this is.
|
|
881
|
-
// This will cause a performance/cpu-usage hit,
|
|
882
|
-
// but will it be less or greater than the
|
|
883
|
-
// performance hit of slow-rendering scrollable
|
|
884
|
-
// boxes with clean sides?
|
|
885
|
-
Screen.prototype.cleanSides = function(el) {
|
|
886
|
-
var pos = el.lpos;
|
|
887
|
-
|
|
888
|
-
if (!pos) {
|
|
889
|
-
return false;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
if (pos._cleanSides != null) {
|
|
893
|
-
return pos._cleanSides;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
if (pos.xi <= 0 && pos.xl >= this.width) {
|
|
897
|
-
return pos._cleanSides = true;
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
if (this.options.fastCSR) {
|
|
901
|
-
// Maybe just do this instead of parsing.
|
|
902
|
-
if (pos.yi < 0) return pos._cleanSides = false;
|
|
903
|
-
if (pos.yl > this.height) return pos._cleanSides = false;
|
|
904
|
-
if (this.width - (pos.xl - pos.xi) < 40) {
|
|
905
|
-
return pos._cleanSides = true;
|
|
906
|
-
}
|
|
907
|
-
return pos._cleanSides = false;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
if (!this.options.smartCSR) {
|
|
911
|
-
return false;
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
// The scrollbar can't update properly, and there's also a
|
|
915
|
-
// chance that the scrollbar may get moved around senselessly.
|
|
916
|
-
// NOTE: In pratice, this doesn't seem to be the case.
|
|
917
|
-
// if (this.scrollbar) {
|
|
918
|
-
// return pos._cleanSides = false;
|
|
919
|
-
// }
|
|
920
|
-
|
|
921
|
-
// Doesn't matter if we're only a height of 1.
|
|
922
|
-
// if ((pos.yl - el.ibottom) - (pos.yi + el.itop) <= 1) {
|
|
923
|
-
// return pos._cleanSides = false;
|
|
924
|
-
// }
|
|
925
|
-
|
|
926
|
-
var yi = pos.yi + el.itop
|
|
927
|
-
, yl = pos.yl - el.ibottom
|
|
928
|
-
, first
|
|
929
|
-
, ch
|
|
930
|
-
, x
|
|
931
|
-
, y;
|
|
932
|
-
|
|
933
|
-
if (pos.yi < 0) return pos._cleanSides = false;
|
|
934
|
-
if (pos.yl > this.height) return pos._cleanSides = false;
|
|
935
|
-
if (pos.xi - 1 < 0) return pos._cleanSides = true;
|
|
936
|
-
if (pos.xl > this.width) return pos._cleanSides = true;
|
|
937
|
-
|
|
938
|
-
for (x = pos.xi - 1; x >= 0; x--) {
|
|
939
|
-
if (!this.olines[yi]) break;
|
|
940
|
-
first = this.olines[yi][x];
|
|
941
|
-
for (y = yi; y < yl; y++) {
|
|
942
|
-
if (!this.olines[y] || !this.olines[y][x]) break;
|
|
943
|
-
ch = this.olines[y][x];
|
|
944
|
-
if (ch[0] !== first[0] || ch[1] !== first[1]) {
|
|
945
|
-
return pos._cleanSides = false;
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
for (x = pos.xl; x < this.width; x++) {
|
|
951
|
-
if (!this.olines[yi]) break;
|
|
952
|
-
first = this.olines[yi][x];
|
|
953
|
-
for (y = yi; y < yl; y++) {
|
|
954
|
-
if (!this.olines[y] || !this.olines[y][x]) break;
|
|
955
|
-
ch = this.olines[y][x];
|
|
956
|
-
if (ch[0] !== first[0] || ch[1] !== first[1]) {
|
|
957
|
-
return pos._cleanSides = false;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
return pos._cleanSides = true;
|
|
963
|
-
};
|
|
964
|
-
|
|
965
|
-
Screen.prototype._dockBorders = function() {
|
|
966
|
-
var lines = this.lines
|
|
967
|
-
, stops = this._borderStops
|
|
968
|
-
, i
|
|
969
|
-
, y
|
|
970
|
-
, x
|
|
971
|
-
, ch;
|
|
972
|
-
|
|
973
|
-
// var keys, stop;
|
|
974
|
-
//
|
|
975
|
-
// keys = Object.keys(this._borderStops)
|
|
976
|
-
// .map(function(k) { return +k; })
|
|
977
|
-
// .sort(function(a, b) { return a - b; });
|
|
978
|
-
//
|
|
979
|
-
// for (i = 0; i < keys.length; i++) {
|
|
980
|
-
// y = keys[i];
|
|
981
|
-
// if (!lines[y]) continue;
|
|
982
|
-
// stop = this._borderStops[y];
|
|
983
|
-
// for (x = stop.xi; x < stop.xl; x++) {
|
|
984
|
-
|
|
985
|
-
stops = Object.keys(stops)
|
|
986
|
-
.map(function(k) { return +k; })
|
|
987
|
-
.sort(function(a, b) { return a - b; });
|
|
988
|
-
|
|
989
|
-
for (i = 0; i < stops.length; i++) {
|
|
990
|
-
y = stops[i];
|
|
991
|
-
if (!lines[y]) continue;
|
|
992
|
-
for (x = 0; x < this.width; x++) {
|
|
993
|
-
ch = lines[y][x][1];
|
|
994
|
-
if (angles[ch]) {
|
|
995
|
-
lines[y][x][1] = this._getAngle(lines, x, y);
|
|
996
|
-
lines[y].dirty = true;
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
};
|
|
1001
|
-
|
|
1002
|
-
Screen.prototype._getAngle = function(lines, x, y) {
|
|
1003
|
-
var angle = 0
|
|
1004
|
-
, attr = lines[y][x][0]
|
|
1005
|
-
, ch = lines[y][x][1];
|
|
1006
|
-
|
|
1007
|
-
if (lines[y][x - 1] && langles[lines[y][x - 1][1]]) {
|
|
1008
|
-
if (!this.options.ignoreDockContrast) {
|
|
1009
|
-
if (lines[y][x - 1][0] !== attr) return ch;
|
|
1010
|
-
}
|
|
1011
|
-
angle |= 1 << 3;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
if (lines[y - 1] && uangles[lines[y - 1][x][1]]) {
|
|
1015
|
-
if (!this.options.ignoreDockContrast) {
|
|
1016
|
-
if (lines[y - 1][x][0] !== attr) return ch;
|
|
1017
|
-
}
|
|
1018
|
-
angle |= 1 << 2;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
if (lines[y][x + 1] && rangles[lines[y][x + 1][1]]) {
|
|
1022
|
-
if (!this.options.ignoreDockContrast) {
|
|
1023
|
-
if (lines[y][x + 1][0] !== attr) return ch;
|
|
1024
|
-
}
|
|
1025
|
-
angle |= 1 << 1;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
if (lines[y + 1] && dangles[lines[y + 1][x][1]]) {
|
|
1029
|
-
if (!this.options.ignoreDockContrast) {
|
|
1030
|
-
if (lines[y + 1][x][0] !== attr) return ch;
|
|
1031
|
-
}
|
|
1032
|
-
angle |= 1 << 0;
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
// Experimental: fixes this situation:
|
|
1036
|
-
// +----------+
|
|
1037
|
-
// | <-- empty space here, should be a T angle
|
|
1038
|
-
// +-------+ |
|
|
1039
|
-
// | | |
|
|
1040
|
-
// +-------+ |
|
|
1041
|
-
// | |
|
|
1042
|
-
// +----------+
|
|
1043
|
-
// if (uangles[lines[y][x][1]]) {
|
|
1044
|
-
// if (lines[y + 1] && cdangles[lines[y + 1][x][1]]) {
|
|
1045
|
-
// if (!this.options.ignoreDockContrast) {
|
|
1046
|
-
// if (lines[y + 1][x][0] !== attr) return ch;
|
|
1047
|
-
// }
|
|
1048
|
-
// angle |= 1 << 0;
|
|
1049
|
-
// }
|
|
1050
|
-
// }
|
|
1051
|
-
|
|
1052
|
-
return angleTable[angle] || ch;
|
|
1053
|
-
};
|
|
1054
|
-
|
|
1055
|
-
Screen.prototype.draw = function(start, end) {
|
|
1056
|
-
// this.emit('predraw');
|
|
1057
|
-
|
|
1058
|
-
var x
|
|
1059
|
-
, y
|
|
1060
|
-
, line
|
|
1061
|
-
, out
|
|
1062
|
-
, ch
|
|
1063
|
-
, data
|
|
1064
|
-
, attr
|
|
1065
|
-
, fg
|
|
1066
|
-
, bg
|
|
1067
|
-
, flags;
|
|
1068
|
-
|
|
1069
|
-
var main = ''
|
|
1070
|
-
, pre
|
|
1071
|
-
, post;
|
|
1072
|
-
|
|
1073
|
-
var clr
|
|
1074
|
-
, neq
|
|
1075
|
-
, xx;
|
|
1076
|
-
|
|
1077
|
-
var lx = -1
|
|
1078
|
-
, ly = -1
|
|
1079
|
-
, o;
|
|
1080
|
-
|
|
1081
|
-
var acs;
|
|
1082
|
-
|
|
1083
|
-
if (this._buf) {
|
|
1084
|
-
main += this._buf;
|
|
1085
|
-
this._buf = '';
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
for (y = start; y <= end; y++) {
|
|
1089
|
-
line = this.lines[y];
|
|
1090
|
-
o = this.olines[y];
|
|
1091
|
-
|
|
1092
|
-
if (!line.dirty && !(this.cursor.artificial && y === this.program.y)) {
|
|
1093
|
-
continue;
|
|
1094
|
-
}
|
|
1095
|
-
line.dirty = false;
|
|
1096
|
-
|
|
1097
|
-
out = '';
|
|
1098
|
-
attr = this.dattr;
|
|
1099
|
-
|
|
1100
|
-
for (x = 0; x < line.length; x++) {
|
|
1101
|
-
data = line[x][0];
|
|
1102
|
-
ch = line[x][1];
|
|
1103
|
-
|
|
1104
|
-
// Render the artificial cursor.
|
|
1105
|
-
if (this.cursor.artificial
|
|
1106
|
-
&& !this.cursor._hidden
|
|
1107
|
-
&& this.cursor._state
|
|
1108
|
-
&& x === this.program.x
|
|
1109
|
-
&& y === this.program.y) {
|
|
1110
|
-
var cattr = this._cursorAttr(this.cursor, data);
|
|
1111
|
-
if (cattr.ch) ch = cattr.ch;
|
|
1112
|
-
data = cattr.attr;
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
// Take advantage of xterm's back_color_erase feature by using a
|
|
1116
|
-
// lookahead. Stop spitting out so many damn spaces. NOTE: Is checking
|
|
1117
|
-
// the bg for non BCE terminals worth the overhead?
|
|
1118
|
-
if (this.options.useBCE
|
|
1119
|
-
&& ch === ' '
|
|
1120
|
-
&& (this.tput.bools.back_color_erase
|
|
1121
|
-
|| (data & 0x1ff) === (this.dattr & 0x1ff))
|
|
1122
|
-
&& ((data >> 18) & 8) === ((this.dattr >> 18) & 8)) {
|
|
1123
|
-
clr = true;
|
|
1124
|
-
neq = false;
|
|
1125
|
-
|
|
1126
|
-
for (xx = x; xx < line.length; xx++) {
|
|
1127
|
-
if (line[xx][0] !== data || line[xx][1] !== ' ') {
|
|
1128
|
-
clr = false;
|
|
1129
|
-
break;
|
|
1130
|
-
}
|
|
1131
|
-
if (line[xx][0] !== o[xx][0] || line[xx][1] !== o[xx][1]) {
|
|
1132
|
-
neq = true;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
if (clr && neq) {
|
|
1137
|
-
lx = -1, ly = -1;
|
|
1138
|
-
if (data !== attr) {
|
|
1139
|
-
out += this.codeAttr(data);
|
|
1140
|
-
attr = data;
|
|
1141
|
-
}
|
|
1142
|
-
out += this.tput.cup(y, x);
|
|
1143
|
-
out += this.tput.el();
|
|
1144
|
-
for (xx = x; xx < line.length; xx++) {
|
|
1145
|
-
o[xx][0] = data;
|
|
1146
|
-
o[xx][1] = ' ';
|
|
1147
|
-
}
|
|
1148
|
-
break;
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
// If there's more than 10 spaces, use EL regardless
|
|
1152
|
-
// and start over drawing the rest of line. Might
|
|
1153
|
-
// not be worth it. Try to use ECH if the terminal
|
|
1154
|
-
// supports it. Maybe only try to use ECH here.
|
|
1155
|
-
// //if (this.tput.strings.erase_chars)
|
|
1156
|
-
// if (!clr && neq && (xx - x) > 10) {
|
|
1157
|
-
// lx = -1, ly = -1;
|
|
1158
|
-
// if (data !== attr) {
|
|
1159
|
-
// out += this.codeAttr(data);
|
|
1160
|
-
// attr = data;
|
|
1161
|
-
// }
|
|
1162
|
-
// out += this.tput.cup(y, x);
|
|
1163
|
-
// if (this.tput.strings.erase_chars) {
|
|
1164
|
-
// // Use erase_chars to avoid erasing the whole line.
|
|
1165
|
-
// out += this.tput.ech(xx - x);
|
|
1166
|
-
// } else {
|
|
1167
|
-
// out += this.tput.el();
|
|
1168
|
-
// }
|
|
1169
|
-
// if (this.tput.strings.parm_right_cursor) {
|
|
1170
|
-
// out += this.tput.cuf(xx - x);
|
|
1171
|
-
// } else {
|
|
1172
|
-
// out += this.tput.cup(y, xx);
|
|
1173
|
-
// }
|
|
1174
|
-
// this.fillRegion(data, ' ',
|
|
1175
|
-
// x, this.tput.strings.erase_chars ? xx : line.length,
|
|
1176
|
-
// y, y + 1);
|
|
1177
|
-
// x = xx - 1;
|
|
1178
|
-
// continue;
|
|
1179
|
-
// }
|
|
1180
|
-
|
|
1181
|
-
// Skip to the next line if the
|
|
1182
|
-
// rest of the line is already drawn.
|
|
1183
|
-
// if (!neq) {
|
|
1184
|
-
// for (; xx < line.length; xx++) {
|
|
1185
|
-
// if (line[xx][0] !== o[xx][0] || line[xx][1] !== o[xx][1]) {
|
|
1186
|
-
// neq = true;
|
|
1187
|
-
// break;
|
|
1188
|
-
// }
|
|
1189
|
-
// }
|
|
1190
|
-
// if (!neq) {
|
|
1191
|
-
// attr = data;
|
|
1192
|
-
// break;
|
|
1193
|
-
// }
|
|
1194
|
-
// }
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
// Optimize by comparing the real output
|
|
1198
|
-
// buffer to the pending output buffer.
|
|
1199
|
-
if (data === o[x][0] && ch === o[x][1]) {
|
|
1200
|
-
if (lx === -1) {
|
|
1201
|
-
lx = x;
|
|
1202
|
-
ly = y;
|
|
1203
|
-
}
|
|
1204
|
-
continue;
|
|
1205
|
-
} else if (lx !== -1) {
|
|
1206
|
-
if (this.tput.strings.parm_right_cursor) {
|
|
1207
|
-
out += y === ly
|
|
1208
|
-
? this.tput.cuf(x - lx)
|
|
1209
|
-
: this.tput.cup(y, x);
|
|
1210
|
-
} else {
|
|
1211
|
-
out += this.tput.cup(y, x);
|
|
1212
|
-
}
|
|
1213
|
-
lx = -1, ly = -1;
|
|
1214
|
-
}
|
|
1215
|
-
o[x][0] = data;
|
|
1216
|
-
o[x][1] = ch;
|
|
1217
|
-
|
|
1218
|
-
if (data !== attr) {
|
|
1219
|
-
if (attr !== this.dattr) {
|
|
1220
|
-
out += '\x1b[m';
|
|
1221
|
-
}
|
|
1222
|
-
if (data !== this.dattr) {
|
|
1223
|
-
out += '\x1b[';
|
|
1224
|
-
|
|
1225
|
-
bg = data & 0x1ff;
|
|
1226
|
-
fg = (data >> 9) & 0x1ff;
|
|
1227
|
-
flags = data >> 18;
|
|
1228
|
-
|
|
1229
|
-
// bold
|
|
1230
|
-
if (flags & 1) {
|
|
1231
|
-
out += '1;';
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
// underline
|
|
1235
|
-
if (flags & 2) {
|
|
1236
|
-
out += '4;';
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
// blink
|
|
1240
|
-
if (flags & 4) {
|
|
1241
|
-
out += '5;';
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
// inverse
|
|
1245
|
-
if (flags & 8) {
|
|
1246
|
-
out += '7;';
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
// invisible
|
|
1250
|
-
if (flags & 16) {
|
|
1251
|
-
out += '8;';
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
if (bg !== 0x1ff) {
|
|
1255
|
-
bg = this._reduceColor(bg);
|
|
1256
|
-
if (bg < 16) {
|
|
1257
|
-
if (bg < 8) {
|
|
1258
|
-
bg += 40;
|
|
1259
|
-
} else if (bg < 16) {
|
|
1260
|
-
bg -= 8;
|
|
1261
|
-
bg += 100;
|
|
1262
|
-
}
|
|
1263
|
-
out += bg + ';';
|
|
1264
|
-
} else {
|
|
1265
|
-
out += '48;5;' + bg + ';';
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
if (fg !== 0x1ff) {
|
|
1270
|
-
fg = this._reduceColor(fg);
|
|
1271
|
-
if (fg < 16) {
|
|
1272
|
-
if (fg < 8) {
|
|
1273
|
-
fg += 30;
|
|
1274
|
-
} else if (fg < 16) {
|
|
1275
|
-
fg -= 8;
|
|
1276
|
-
fg += 90;
|
|
1277
|
-
}
|
|
1278
|
-
out += fg + ';';
|
|
1279
|
-
} else {
|
|
1280
|
-
out += '38;5;' + fg + ';';
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
if (out[out.length - 1] === ';') out = out.slice(0, -1);
|
|
1285
|
-
|
|
1286
|
-
out += 'm';
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
// If we find a double-width char, eat the next character which should be
|
|
1291
|
-
// a space due to parseContent's behavior.
|
|
1292
|
-
if (this.fullUnicode) {
|
|
1293
|
-
// If this is a surrogate pair double-width char, we can ignore it
|
|
1294
|
-
// because parseContent already counted it as length=2.
|
|
1295
|
-
if (unicode.charWidth(line[x][1]) === 2) {
|
|
1296
|
-
// NOTE: At cols=44, the bug that is avoided
|
|
1297
|
-
// by the angles check occurs in widget-unicode:
|
|
1298
|
-
// Might also need: `line[x + 1][0] !== line[x][0]`
|
|
1299
|
-
// for borderless boxes?
|
|
1300
|
-
if (x === line.length - 1 || angles[line[x + 1][1]]) {
|
|
1301
|
-
// If we're at the end, we don't have enough space for a
|
|
1302
|
-
// double-width. Overwrite it with a space and ignore.
|
|
1303
|
-
ch = ' ';
|
|
1304
|
-
o[x][1] = '\0';
|
|
1305
|
-
} else {
|
|
1306
|
-
// ALWAYS refresh double-width chars because this special cursor
|
|
1307
|
-
// behavior is needed. There may be a more efficient way of doing
|
|
1308
|
-
// this. See above.
|
|
1309
|
-
o[x][1] = '\0';
|
|
1310
|
-
// Eat the next character by moving forward and marking as a
|
|
1311
|
-
// space (which it is).
|
|
1312
|
-
o[++x][1] = '\0';
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
// Attempt to use ACS for supported characters.
|
|
1318
|
-
// This is not ideal, but it's how ncurses works.
|
|
1319
|
-
// There are a lot of terminals that support ACS
|
|
1320
|
-
// *and UTF8, but do not declare U8. So ACS ends
|
|
1321
|
-
// up being used (slower than utf8). Terminals
|
|
1322
|
-
// that do not support ACS and do not explicitly
|
|
1323
|
-
// support UTF8 get their unicode characters
|
|
1324
|
-
// replaced with really ugly ascii characters.
|
|
1325
|
-
// It is possible there is a terminal out there
|
|
1326
|
-
// somewhere that does not support ACS, but
|
|
1327
|
-
// supports UTF8, but I imagine it's unlikely.
|
|
1328
|
-
// Maybe remove !this.tput.unicode check, however,
|
|
1329
|
-
// this seems to be the way ncurses does it.
|
|
1330
|
-
if (this.tput.strings.enter_alt_charset_mode
|
|
1331
|
-
&& !this.tput.brokenACS && (this.tput.acscr[ch] || acs)) {
|
|
1332
|
-
// Fun fact: even if this.tput.brokenACS wasn't checked here,
|
|
1333
|
-
// the linux console would still work fine because the acs
|
|
1334
|
-
// table would fail the check of: this.tput.acscr[ch]
|
|
1335
|
-
if (this.tput.acscr[ch]) {
|
|
1336
|
-
if (acs) {
|
|
1337
|
-
ch = this.tput.acscr[ch];
|
|
1338
|
-
} else {
|
|
1339
|
-
ch = this.tput.smacs()
|
|
1340
|
-
+ this.tput.acscr[ch];
|
|
1341
|
-
acs = true;
|
|
1342
|
-
}
|
|
1343
|
-
} else if (acs) {
|
|
1344
|
-
ch = this.tput.rmacs() + ch;
|
|
1345
|
-
acs = false;
|
|
1346
|
-
}
|
|
1347
|
-
} else {
|
|
1348
|
-
// U8 is not consistently correct. Some terminfo's
|
|
1349
|
-
// terminals that do not declare it may actually
|
|
1350
|
-
// support utf8 (e.g. urxvt), but if the terminal
|
|
1351
|
-
// does not declare support for ACS (and U8), chances
|
|
1352
|
-
// are it does not support UTF8. This is probably
|
|
1353
|
-
// the "safest" way to do this. Should fix things
|
|
1354
|
-
// like sun-color.
|
|
1355
|
-
// NOTE: It could be the case that the $LANG
|
|
1356
|
-
// is all that matters in some cases:
|
|
1357
|
-
// if (!this.tput.unicode && ch > '~') {
|
|
1358
|
-
if (!this.tput.unicode && this.tput.numbers.U8 !== 1 && ch > '~') {
|
|
1359
|
-
ch = this.tput.utoa[ch] || '?';
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
out += ch;
|
|
1364
|
-
attr = data;
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
if (attr !== this.dattr) {
|
|
1368
|
-
out += '\x1b[m';
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
if (out) {
|
|
1372
|
-
main += this.tput.cup(y, 0) + out;
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
if (acs) {
|
|
1377
|
-
main += this.tput.rmacs();
|
|
1378
|
-
acs = false;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
if (main) {
|
|
1382
|
-
pre = '';
|
|
1383
|
-
post = '';
|
|
1384
|
-
|
|
1385
|
-
pre += this.tput.sc();
|
|
1386
|
-
post += this.tput.rc();
|
|
1387
|
-
|
|
1388
|
-
if (!this.program.cursorHidden) {
|
|
1389
|
-
pre += this.tput.civis();
|
|
1390
|
-
post += this.tput.cnorm();
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
// this.program.flush();
|
|
1394
|
-
// this.program._owrite(pre + main + post);
|
|
1395
|
-
this.program._write(pre + main + post);
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
// this.emit('draw');
|
|
1399
|
-
};
|
|
1400
|
-
|
|
1401
|
-
Screen.prototype._reduceColor = function(color) {
|
|
1402
|
-
return colors.reduce(color, this.tput.colors);
|
|
1403
|
-
};
|
|
1404
|
-
|
|
1405
|
-
// Convert an SGR string to our own attribute format.
|
|
1406
|
-
Screen.prototype.attrCode = function(code, cur, def) {
|
|
1407
|
-
var flags = (cur >> 18) & 0x1ff
|
|
1408
|
-
, fg = (cur >> 9) & 0x1ff
|
|
1409
|
-
, bg = cur & 0x1ff
|
|
1410
|
-
, c
|
|
1411
|
-
, i;
|
|
1412
|
-
|
|
1413
|
-
code = code.slice(2, -1).split(';');
|
|
1414
|
-
if (!code[0]) code[0] = '0';
|
|
1415
|
-
|
|
1416
|
-
for (i = 0; i < code.length; i++) {
|
|
1417
|
-
c = +code[i] || 0;
|
|
1418
|
-
switch (c) {
|
|
1419
|
-
case 0: // normal
|
|
1420
|
-
bg = def & 0x1ff;
|
|
1421
|
-
fg = (def >> 9) & 0x1ff;
|
|
1422
|
-
flags = (def >> 18) & 0x1ff;
|
|
1423
|
-
break;
|
|
1424
|
-
case 1: // bold
|
|
1425
|
-
flags |= 1;
|
|
1426
|
-
break;
|
|
1427
|
-
case 22:
|
|
1428
|
-
flags = (def >> 18) & 0x1ff;
|
|
1429
|
-
break;
|
|
1430
|
-
case 4: // underline
|
|
1431
|
-
flags |= 2;
|
|
1432
|
-
break;
|
|
1433
|
-
case 24:
|
|
1434
|
-
flags = (def >> 18) & 0x1ff;
|
|
1435
|
-
break;
|
|
1436
|
-
case 5: // blink
|
|
1437
|
-
flags |= 4;
|
|
1438
|
-
break;
|
|
1439
|
-
case 25:
|
|
1440
|
-
flags = (def >> 18) & 0x1ff;
|
|
1441
|
-
break;
|
|
1442
|
-
case 7: // inverse
|
|
1443
|
-
flags |= 8;
|
|
1444
|
-
break;
|
|
1445
|
-
case 27:
|
|
1446
|
-
flags = (def >> 18) & 0x1ff;
|
|
1447
|
-
break;
|
|
1448
|
-
case 8: // invisible
|
|
1449
|
-
flags |= 16;
|
|
1450
|
-
break;
|
|
1451
|
-
case 28:
|
|
1452
|
-
flags = (def >> 18) & 0x1ff;
|
|
1453
|
-
break;
|
|
1454
|
-
case 39: // default fg
|
|
1455
|
-
fg = (def >> 9) & 0x1ff;
|
|
1456
|
-
break;
|
|
1457
|
-
case 49: // default bg
|
|
1458
|
-
bg = def & 0x1ff;
|
|
1459
|
-
break;
|
|
1460
|
-
case 100: // default fg/bg
|
|
1461
|
-
fg = (def >> 9) & 0x1ff;
|
|
1462
|
-
bg = def & 0x1ff;
|
|
1463
|
-
break;
|
|
1464
|
-
default: // color
|
|
1465
|
-
if (c === 48 && +code[i+1] === 5) {
|
|
1466
|
-
i += 2;
|
|
1467
|
-
bg = +code[i];
|
|
1468
|
-
break;
|
|
1469
|
-
} else if (c === 48 && +code[i+1] === 2) {
|
|
1470
|
-
i += 2;
|
|
1471
|
-
bg = colors.match(+code[i], +code[i+1], +code[i+2]);
|
|
1472
|
-
if (bg === -1) bg = def & 0x1ff;
|
|
1473
|
-
i += 2;
|
|
1474
|
-
break;
|
|
1475
|
-
} else if (c === 38 && +code[i+1] === 5) {
|
|
1476
|
-
i += 2;
|
|
1477
|
-
fg = +code[i];
|
|
1478
|
-
break;
|
|
1479
|
-
} else if (c === 38 && +code[i+1] === 2) {
|
|
1480
|
-
i += 2;
|
|
1481
|
-
fg = colors.match(+code[i], +code[i+1], +code[i+2]);
|
|
1482
|
-
if (fg === -1) fg = (def >> 9) & 0x1ff;
|
|
1483
|
-
i += 2;
|
|
1484
|
-
break;
|
|
1485
|
-
}
|
|
1486
|
-
if (c >= 40 && c <= 47) {
|
|
1487
|
-
bg = c - 40;
|
|
1488
|
-
} else if (c >= 100 && c <= 107) {
|
|
1489
|
-
bg = c - 100;
|
|
1490
|
-
bg += 8;
|
|
1491
|
-
} else if (c === 49) {
|
|
1492
|
-
bg = def & 0x1ff;
|
|
1493
|
-
} else if (c >= 30 && c <= 37) {
|
|
1494
|
-
fg = c - 30;
|
|
1495
|
-
} else if (c >= 90 && c <= 97) {
|
|
1496
|
-
fg = c - 90;
|
|
1497
|
-
fg += 8;
|
|
1498
|
-
} else if (c === 39) {
|
|
1499
|
-
fg = (def >> 9) & 0x1ff;
|
|
1500
|
-
} else if (c === 100) {
|
|
1501
|
-
fg = (def >> 9) & 0x1ff;
|
|
1502
|
-
bg = def & 0x1ff;
|
|
1503
|
-
}
|
|
1504
|
-
break;
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
return (flags << 18) | (fg << 9) | bg;
|
|
1509
|
-
};
|
|
1510
|
-
|
|
1511
|
-
// Convert our own attribute format to an SGR string.
|
|
1512
|
-
Screen.prototype.codeAttr = function(code) {
|
|
1513
|
-
var flags = (code >> 18) & 0x1ff
|
|
1514
|
-
, fg = (code >> 9) & 0x1ff
|
|
1515
|
-
, bg = code & 0x1ff
|
|
1516
|
-
, out = '';
|
|
1517
|
-
|
|
1518
|
-
// bold
|
|
1519
|
-
if (flags & 1) {
|
|
1520
|
-
out += '1;';
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
// underline
|
|
1524
|
-
if (flags & 2) {
|
|
1525
|
-
out += '4;';
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
// blink
|
|
1529
|
-
if (flags & 4) {
|
|
1530
|
-
out += '5;';
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
// inverse
|
|
1534
|
-
if (flags & 8) {
|
|
1535
|
-
out += '7;';
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
// invisible
|
|
1539
|
-
if (flags & 16) {
|
|
1540
|
-
out += '8;';
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
if (bg !== 0x1ff) {
|
|
1544
|
-
bg = this._reduceColor(bg);
|
|
1545
|
-
if (bg < 16) {
|
|
1546
|
-
if (bg < 8) {
|
|
1547
|
-
bg += 40;
|
|
1548
|
-
} else if (bg < 16) {
|
|
1549
|
-
bg -= 8;
|
|
1550
|
-
bg += 100;
|
|
1551
|
-
}
|
|
1552
|
-
out += bg + ';';
|
|
1553
|
-
} else {
|
|
1554
|
-
out += '48;5;' + bg + ';';
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
if (fg !== 0x1ff) {
|
|
1559
|
-
fg = this._reduceColor(fg);
|
|
1560
|
-
if (fg < 16) {
|
|
1561
|
-
if (fg < 8) {
|
|
1562
|
-
fg += 30;
|
|
1563
|
-
} else if (fg < 16) {
|
|
1564
|
-
fg -= 8;
|
|
1565
|
-
fg += 90;
|
|
1566
|
-
}
|
|
1567
|
-
out += fg + ';';
|
|
1568
|
-
} else {
|
|
1569
|
-
out += '38;5;' + fg + ';';
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
|
|
1573
|
-
if (out[out.length - 1] === ';') out = out.slice(0, -1);
|
|
1574
|
-
|
|
1575
|
-
return '\x1b[' + out + 'm';
|
|
1576
|
-
};
|
|
1577
|
-
|
|
1578
|
-
Screen.prototype.focusOffset = function(offset) {
|
|
1579
|
-
var shown = this.keyable.filter(function(el) {
|
|
1580
|
-
return !el.detached && el.visible;
|
|
1581
|
-
}).length;
|
|
1582
|
-
|
|
1583
|
-
if (!shown || !offset) {
|
|
1584
|
-
return;
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
var i = this.keyable.indexOf(this.focused);
|
|
1588
|
-
if (!~i) return;
|
|
1589
|
-
|
|
1590
|
-
if (offset > 0) {
|
|
1591
|
-
while (offset--) {
|
|
1592
|
-
if (++i > this.keyable.length - 1) i = 0;
|
|
1593
|
-
if (this.keyable[i].detached || !this.keyable[i].visible) offset++;
|
|
1594
|
-
}
|
|
1595
|
-
} else {
|
|
1596
|
-
offset = -offset;
|
|
1597
|
-
while (offset--) {
|
|
1598
|
-
if (--i < 0) i = this.keyable.length - 1;
|
|
1599
|
-
if (this.keyable[i].detached || !this.keyable[i].visible) offset++;
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
return this.keyable[i].focus();
|
|
1604
|
-
};
|
|
1605
|
-
|
|
1606
|
-
Screen.prototype.focusPrev =
|
|
1607
|
-
Screen.prototype.focusPrevious = function() {
|
|
1608
|
-
return this.focusOffset(-1);
|
|
1609
|
-
};
|
|
1610
|
-
|
|
1611
|
-
Screen.prototype.focusNext = function() {
|
|
1612
|
-
return this.focusOffset(1);
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
|
-
Screen.prototype.focusPush = function(el) {
|
|
1616
|
-
if (!el) return;
|
|
1617
|
-
var old = this.history[this.history.length - 1];
|
|
1618
|
-
if (this.history.length === 10) {
|
|
1619
|
-
this.history.shift();
|
|
1620
|
-
}
|
|
1621
|
-
this.history.push(el);
|
|
1622
|
-
this._focus(el, old);
|
|
1623
|
-
};
|
|
1624
|
-
|
|
1625
|
-
Screen.prototype.focusPop = function() {
|
|
1626
|
-
var old = this.history.pop();
|
|
1627
|
-
if (this.history.length) {
|
|
1628
|
-
this._focus(this.history[this.history.length - 1], old);
|
|
1629
|
-
}
|
|
1630
|
-
return old;
|
|
1631
|
-
};
|
|
1632
|
-
|
|
1633
|
-
Screen.prototype.saveFocus = function() {
|
|
1634
|
-
return this._savedFocus = this.focused;
|
|
1635
|
-
};
|
|
1636
|
-
|
|
1637
|
-
Screen.prototype.restoreFocus = function() {
|
|
1638
|
-
if (!this._savedFocus) return;
|
|
1639
|
-
this._savedFocus.focus();
|
|
1640
|
-
delete this._savedFocus;
|
|
1641
|
-
return this.focused;
|
|
1642
|
-
};
|
|
1643
|
-
|
|
1644
|
-
Screen.prototype.rewindFocus = function() {
|
|
1645
|
-
var old = this.history.pop()
|
|
1646
|
-
, el;
|
|
1647
|
-
|
|
1648
|
-
while (this.history.length) {
|
|
1649
|
-
el = this.history.pop();
|
|
1650
|
-
if (!el.detached && el.visible) {
|
|
1651
|
-
this.history.push(el);
|
|
1652
|
-
this._focus(el, old);
|
|
1653
|
-
return el;
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
if (old) {
|
|
1658
|
-
old.emit('blur');
|
|
1659
|
-
}
|
|
1660
|
-
};
|
|
1661
|
-
|
|
1662
|
-
Screen.prototype._focus = function(self, old) {
|
|
1663
|
-
// Find a scrollable ancestor if we have one.
|
|
1664
|
-
var el = self;
|
|
1665
|
-
while (el = el.parent) {
|
|
1666
|
-
if (el.scrollable) break;
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
// If we're in a scrollable element,
|
|
1670
|
-
// automatically scroll to the focused element.
|
|
1671
|
-
if (el && !el.detached) {
|
|
1672
|
-
// NOTE: This is different from the other "visible" values - it needs the
|
|
1673
|
-
// visible height of the scrolling element itself, not the element within
|
|
1674
|
-
// it.
|
|
1675
|
-
var visible = self.screen.height - el.atop - el.itop - el.abottom - el.ibottom;
|
|
1676
|
-
if (self.rtop < el.childBase) {
|
|
1677
|
-
el.scrollTo(self.rtop);
|
|
1678
|
-
self.screen.render();
|
|
1679
|
-
} else if (self.rtop + self.height - self.ibottom > el.childBase + visible) {
|
|
1680
|
-
// Explanation for el.itop here: takes into account scrollable elements
|
|
1681
|
-
// with borders otherwise the element gets covered by the bottom border:
|
|
1682
|
-
el.scrollTo(self.rtop - (el.height - self.height) + el.itop, true);
|
|
1683
|
-
self.screen.render();
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
if (old) {
|
|
1688
|
-
old.emit('blur', self);
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
self.emit('focus', old);
|
|
1692
|
-
};
|
|
1693
|
-
|
|
1694
|
-
Screen.prototype.__defineGetter__('focused', function() {
|
|
1695
|
-
return this.history[this.history.length - 1];
|
|
1696
|
-
});
|
|
1697
|
-
|
|
1698
|
-
Screen.prototype.__defineSetter__('focused', function(el) {
|
|
1699
|
-
return this.focusPush(el);
|
|
1700
|
-
});
|
|
1701
|
-
|
|
1702
|
-
Screen.prototype.clearRegion = function(xi, xl, yi, yl, override) {
|
|
1703
|
-
return this.fillRegion(this.dattr, ' ', xi, xl, yi, yl, override);
|
|
1704
|
-
};
|
|
1705
|
-
|
|
1706
|
-
Screen.prototype.fillRegion = function(attr, ch, xi, xl, yi, yl, override) {
|
|
1707
|
-
var lines = this.lines
|
|
1708
|
-
, cell
|
|
1709
|
-
, xx;
|
|
1710
|
-
|
|
1711
|
-
if (xi < 0) xi = 0;
|
|
1712
|
-
if (yi < 0) yi = 0;
|
|
1713
|
-
|
|
1714
|
-
for (; yi < yl; yi++) {
|
|
1715
|
-
if (!lines[yi]) break;
|
|
1716
|
-
for (xx = xi; xx < xl; xx++) {
|
|
1717
|
-
cell = lines[yi][xx];
|
|
1718
|
-
if (!cell) break;
|
|
1719
|
-
if (override || attr !== cell[0] || ch !== cell[1]) {
|
|
1720
|
-
lines[yi][xx][0] = attr;
|
|
1721
|
-
lines[yi][xx][1] = ch;
|
|
1722
|
-
lines[yi].dirty = true;
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
};
|
|
1727
|
-
|
|
1728
|
-
Screen.prototype.key = function() {
|
|
1729
|
-
return this.program.key.apply(this, arguments);
|
|
1730
|
-
};
|
|
1731
|
-
|
|
1732
|
-
Screen.prototype.onceKey = function() {
|
|
1733
|
-
return this.program.onceKey.apply(this, arguments);
|
|
1734
|
-
};
|
|
1735
|
-
|
|
1736
|
-
Screen.prototype.unkey =
|
|
1737
|
-
Screen.prototype.removeKey = function() {
|
|
1738
|
-
return this.program.unkey.apply(this, arguments);
|
|
1739
|
-
};
|
|
1740
|
-
|
|
1741
|
-
Screen.prototype.spawn = function(file, args, options) {
|
|
1742
|
-
if (!Array.isArray(args)) {
|
|
1743
|
-
options = args;
|
|
1744
|
-
args = [];
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
var screen = this
|
|
1748
|
-
, program = screen.program
|
|
1749
|
-
, spawn = require('child_process').spawn
|
|
1750
|
-
, mouse = program.mouseEnabled
|
|
1751
|
-
, ps;
|
|
1752
|
-
|
|
1753
|
-
options = options || {};
|
|
1754
|
-
|
|
1755
|
-
options.stdio = options.stdio || 'inherit';
|
|
1756
|
-
|
|
1757
|
-
program.lsaveCursor('spawn');
|
|
1758
|
-
// program.csr(0, program.rows - 1);
|
|
1759
|
-
program.normalBuffer();
|
|
1760
|
-
program.showCursor();
|
|
1761
|
-
if (mouse) program.disableMouse();
|
|
1762
|
-
|
|
1763
|
-
var write = program.output.write;
|
|
1764
|
-
program.output.write = function() {};
|
|
1765
|
-
program.input.pause();
|
|
1766
|
-
if (program.input.setRawMode) {
|
|
1767
|
-
program.input.setRawMode(false);
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
var resume = function() {
|
|
1771
|
-
if (resume.done) return;
|
|
1772
|
-
resume.done = true;
|
|
1773
|
-
|
|
1774
|
-
if (program.input.setRawMode) {
|
|
1775
|
-
program.input.setRawMode(true);
|
|
1776
|
-
}
|
|
1777
|
-
program.input.resume();
|
|
1778
|
-
program.output.write = write;
|
|
1779
|
-
|
|
1780
|
-
program.alternateBuffer();
|
|
1781
|
-
// program.csr(0, program.rows - 1);
|
|
1782
|
-
if (mouse) {
|
|
1783
|
-
program.enableMouse();
|
|
1784
|
-
if (screen.options.sendFocus) {
|
|
1785
|
-
screen.program.setMouse({ sendFocus: true }, true);
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
screen.alloc();
|
|
1790
|
-
screen.render();
|
|
1791
|
-
|
|
1792
|
-
screen.program.lrestoreCursor('spawn', true);
|
|
1793
|
-
};
|
|
1794
|
-
|
|
1795
|
-
ps = spawn(file, args, options);
|
|
1796
|
-
|
|
1797
|
-
ps.on('error', resume);
|
|
1798
|
-
|
|
1799
|
-
ps.on('exit', resume);
|
|
1800
|
-
|
|
1801
|
-
return ps;
|
|
1802
|
-
};
|
|
1803
|
-
|
|
1804
|
-
Screen.prototype.exec = function(file, args, options, callback) {
|
|
1805
|
-
var ps = this.spawn(file, args, options);
|
|
1806
|
-
|
|
1807
|
-
ps.on('error', function(err) {
|
|
1808
|
-
if (!callback) return;
|
|
1809
|
-
return callback(err, false);
|
|
1810
|
-
});
|
|
1811
|
-
|
|
1812
|
-
ps.on('exit', function(code) {
|
|
1813
|
-
if (!callback) return;
|
|
1814
|
-
return callback(null, code === 0);
|
|
1815
|
-
});
|
|
1816
|
-
|
|
1817
|
-
return ps;
|
|
1818
|
-
};
|
|
1819
|
-
|
|
1820
|
-
Screen.prototype.readEditor = function(options, callback) {
|
|
1821
|
-
if (typeof options === 'string') {
|
|
1822
|
-
options = { editor: options };
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
if (!callback) {
|
|
1826
|
-
callback = options;
|
|
1827
|
-
options = null;
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
if (!callback) {
|
|
1831
|
-
callback = function() {};
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
options = options || {};
|
|
1835
|
-
|
|
1836
|
-
var self = this
|
|
1837
|
-
, editor = options.editor || process.env.EDITOR || 'vi'
|
|
1838
|
-
, name = options.name || process.title || 'blessed'
|
|
1839
|
-
, rnd = Math.random().toString(36).split('.').pop()
|
|
1840
|
-
, file = '/tmp/' + name + '.' + rnd
|
|
1841
|
-
, args = [file]
|
|
1842
|
-
, opt;
|
|
1843
|
-
|
|
1844
|
-
opt = {
|
|
1845
|
-
stdio: 'inherit',
|
|
1846
|
-
env: process.env,
|
|
1847
|
-
cwd: process.env.HOME
|
|
1848
|
-
};
|
|
1849
|
-
|
|
1850
|
-
function writeFile(callback) {
|
|
1851
|
-
if (!options.value) return callback();
|
|
1852
|
-
return fs.writeFile(file, options.value, callback);
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
return writeFile(function(err) {
|
|
1856
|
-
if (err) return callback(err);
|
|
1857
|
-
return self.exec(editor, args, opt, function(err, success) {
|
|
1858
|
-
if (err) return callback(err);
|
|
1859
|
-
return fs.readFile(file, 'utf8', function(err, data) {
|
|
1860
|
-
return fs.unlink(file, function() {
|
|
1861
|
-
if (!success) return callback(new Error('Unsuccessful.'));
|
|
1862
|
-
if (err) return callback(err);
|
|
1863
|
-
return callback(null, data);
|
|
1864
|
-
});
|
|
1865
|
-
});
|
|
1866
|
-
});
|
|
1867
|
-
});
|
|
1868
|
-
};
|
|
1869
|
-
|
|
1870
|
-
Screen.prototype.displayImage = function(file, callback) {
|
|
1871
|
-
if (!file) {
|
|
1872
|
-
if (!callback) return;
|
|
1873
|
-
return callback(new Error('No image.'));
|
|
1874
|
-
}
|
|
1875
|
-
|
|
1876
|
-
file = path.resolve(process.cwd(), file);
|
|
1877
|
-
|
|
1878
|
-
if (!~file.indexOf('://')) {
|
|
1879
|
-
file = 'file://' + file;
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
var args = ['w3m', '-T', 'text/html'];
|
|
1883
|
-
|
|
1884
|
-
var input = '<title>press q to exit</title>'
|
|
1885
|
-
+ '<img align="center" src="' + file + '">';
|
|
1886
|
-
|
|
1887
|
-
var opt = {
|
|
1888
|
-
stdio: ['pipe', 1, 2],
|
|
1889
|
-
env: process.env,
|
|
1890
|
-
cwd: process.env.HOME
|
|
1891
|
-
};
|
|
1892
|
-
|
|
1893
|
-
var ps = this.spawn(args[0], args.slice(1), opt);
|
|
1894
|
-
|
|
1895
|
-
ps.on('error', function(err) {
|
|
1896
|
-
if (!callback) return;
|
|
1897
|
-
return callback(err);
|
|
1898
|
-
});
|
|
1899
|
-
|
|
1900
|
-
ps.on('exit', function(code) {
|
|
1901
|
-
if (!callback) return;
|
|
1902
|
-
if (code !== 0) return callback(new Error('Exit Code: ' + code));
|
|
1903
|
-
return callback(null, code === 0);
|
|
1904
|
-
});
|
|
1905
|
-
|
|
1906
|
-
ps.stdin.write(input + '\n');
|
|
1907
|
-
ps.stdin.end();
|
|
1908
|
-
};
|
|
1909
|
-
|
|
1910
|
-
Screen.prototype.setEffects = function(el, fel, over, out, effects, temp) {
|
|
1911
|
-
if (!effects) return;
|
|
1912
|
-
|
|
1913
|
-
var tmp = {};
|
|
1914
|
-
if (temp) el[temp] = tmp;
|
|
1915
|
-
|
|
1916
|
-
if (typeof el !== 'function') {
|
|
1917
|
-
var _el = el;
|
|
1918
|
-
el = function() { return _el; };
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
|
-
fel.on(over, function() {
|
|
1922
|
-
var element = el();
|
|
1923
|
-
Object.keys(effects).forEach(function(key) {
|
|
1924
|
-
var val = effects[key];
|
|
1925
|
-
if (val !== null && typeof val === 'object') {
|
|
1926
|
-
tmp[key] = tmp[key] || {};
|
|
1927
|
-
// element.style[key] = element.style[key] || {};
|
|
1928
|
-
Object.keys(val).forEach(function(k) {
|
|
1929
|
-
var v = val[k];
|
|
1930
|
-
tmp[key][k] = element.style[key][k];
|
|
1931
|
-
element.style[key][k] = v;
|
|
1932
|
-
});
|
|
1933
|
-
return;
|
|
1934
|
-
}
|
|
1935
|
-
tmp[key] = element.style[key];
|
|
1936
|
-
element.style[key] = val;
|
|
1937
|
-
});
|
|
1938
|
-
element.screen.render();
|
|
1939
|
-
});
|
|
1940
|
-
|
|
1941
|
-
fel.on(out, function() {
|
|
1942
|
-
var element = el();
|
|
1943
|
-
Object.keys(effects).forEach(function(key) {
|
|
1944
|
-
var val = effects[key];
|
|
1945
|
-
if (val !== null && typeof val === 'object') {
|
|
1946
|
-
tmp[key] = tmp[key] || {};
|
|
1947
|
-
// element.style[key] = element.style[key] || {};
|
|
1948
|
-
Object.keys(val).forEach(function(k) {
|
|
1949
|
-
if (tmp[key].hasOwnProperty(k)) {
|
|
1950
|
-
element.style[key][k] = tmp[key][k];
|
|
1951
|
-
}
|
|
1952
|
-
});
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1955
|
-
if (tmp.hasOwnProperty(key)) {
|
|
1956
|
-
element.style[key] = tmp[key];
|
|
1957
|
-
}
|
|
1958
|
-
});
|
|
1959
|
-
element.screen.render();
|
|
1960
|
-
});
|
|
1961
|
-
};
|
|
1962
|
-
|
|
1963
|
-
Screen.prototype.sigtstp = function(callback) {
|
|
1964
|
-
var self = this;
|
|
1965
|
-
this.program.sigtstp(function() {
|
|
1966
|
-
self.alloc();
|
|
1967
|
-
self.render();
|
|
1968
|
-
self.program.lrestoreCursor('pause', true);
|
|
1969
|
-
if (callback) callback();
|
|
1970
|
-
});
|
|
1971
|
-
};
|
|
1972
|
-
|
|
1973
|
-
Screen.prototype.copyToClipboard = function(text) {
|
|
1974
|
-
return this.program.copyToClipboard(text);
|
|
1975
|
-
};
|
|
1976
|
-
|
|
1977
|
-
Screen.prototype.cursorShape = function(shape, blink) {
|
|
1978
|
-
var self = this;
|
|
1979
|
-
|
|
1980
|
-
this.cursor.shape = shape || 'block';
|
|
1981
|
-
this.cursor.blink = blink || false;
|
|
1982
|
-
this.cursor._set = true;
|
|
1983
|
-
|
|
1984
|
-
if (this.cursor.artificial) {
|
|
1985
|
-
if (!this.program.hideCursor_old) {
|
|
1986
|
-
var hideCursor = this.program.hideCursor;
|
|
1987
|
-
this.program.hideCursor_old = this.program.hideCursor;
|
|
1988
|
-
this.program.hideCursor = function() {
|
|
1989
|
-
hideCursor.call(self.program);
|
|
1990
|
-
self.cursor._hidden = true;
|
|
1991
|
-
if (self.renders) self.render();
|
|
1992
|
-
};
|
|
1993
|
-
}
|
|
1994
|
-
if (!this.program.showCursor_old) {
|
|
1995
|
-
var showCursor = this.program.showCursor;
|
|
1996
|
-
this.program.showCursor_old = this.program.showCursor;
|
|
1997
|
-
this.program.showCursor = function() {
|
|
1998
|
-
self.cursor._hidden = false;
|
|
1999
|
-
if (self.program._exiting) showCursor.call(self.program);
|
|
2000
|
-
if (self.renders) self.render();
|
|
2001
|
-
};
|
|
2002
|
-
}
|
|
2003
|
-
if (!this._cursorBlink) {
|
|
2004
|
-
this._cursorBlink = setInterval(function() {
|
|
2005
|
-
if (!self.cursor.blink) return;
|
|
2006
|
-
self.cursor._state ^= 1;
|
|
2007
|
-
if (self.renders) self.render();
|
|
2008
|
-
}, 500);
|
|
2009
|
-
if (this._cursorBlink.unref) {
|
|
2010
|
-
this._cursorBlink.unref();
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
return true;
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
return this.program.cursorShape(this.cursor.shape, this.cursor.blink);
|
|
2017
|
-
};
|
|
2018
|
-
|
|
2019
|
-
Screen.prototype.cursorColor = function(color) {
|
|
2020
|
-
this.cursor.color = color != null
|
|
2021
|
-
? colors.convert(color)
|
|
2022
|
-
: null;
|
|
2023
|
-
this.cursor._set = true;
|
|
2024
|
-
|
|
2025
|
-
if (this.cursor.artificial) {
|
|
2026
|
-
return true;
|
|
2027
|
-
}
|
|
2028
|
-
|
|
2029
|
-
return this.program.cursorColor(colors.ncolors[this.cursor.color]);
|
|
2030
|
-
};
|
|
2031
|
-
|
|
2032
|
-
Screen.prototype.cursorReset =
|
|
2033
|
-
Screen.prototype.resetCursor = function() {
|
|
2034
|
-
this.cursor.shape = 'block';
|
|
2035
|
-
this.cursor.blink = false;
|
|
2036
|
-
this.cursor.color = null;
|
|
2037
|
-
this.cursor._set = false;
|
|
2038
|
-
|
|
2039
|
-
if (this.cursor.artificial) {
|
|
2040
|
-
this.cursor.artificial = false;
|
|
2041
|
-
if (this.program.hideCursor_old) {
|
|
2042
|
-
this.program.hideCursor = this.program.hideCursor_old;
|
|
2043
|
-
delete this.program.hideCursor_old;
|
|
2044
|
-
}
|
|
2045
|
-
if (this.program.showCursor_old) {
|
|
2046
|
-
this.program.showCursor = this.program.showCursor_old;
|
|
2047
|
-
delete this.program.showCursor_old;
|
|
2048
|
-
}
|
|
2049
|
-
if (this._cursorBlink) {
|
|
2050
|
-
clearInterval(this._cursorBlink);
|
|
2051
|
-
delete this._cursorBlink;
|
|
2052
|
-
}
|
|
2053
|
-
return true;
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
return this.program.cursorReset();
|
|
2057
|
-
};
|
|
2058
|
-
|
|
2059
|
-
Screen.prototype._cursorAttr = function(cursor, dattr) {
|
|
2060
|
-
var attr = dattr || this.dattr
|
|
2061
|
-
, cattr
|
|
2062
|
-
, ch;
|
|
2063
|
-
|
|
2064
|
-
if (cursor.shape === 'line') {
|
|
2065
|
-
attr &= ~(0x1ff << 9);
|
|
2066
|
-
attr |= 7 << 9;
|
|
2067
|
-
ch = '\u2502';
|
|
2068
|
-
} else if (cursor.shape === 'underline') {
|
|
2069
|
-
attr &= ~(0x1ff << 9);
|
|
2070
|
-
attr |= 7 << 9;
|
|
2071
|
-
attr |= 2 << 18;
|
|
2072
|
-
} else if (cursor.shape === 'block') {
|
|
2073
|
-
attr &= ~(0x1ff << 9);
|
|
2074
|
-
attr |= 7 << 9;
|
|
2075
|
-
attr |= 8 << 18;
|
|
2076
|
-
} else if (typeof cursor.shape === 'object' && cursor.shape) {
|
|
2077
|
-
cattr = Element.prototype.sattr.call(cursor, cursor.shape);
|
|
2078
|
-
|
|
2079
|
-
if (cursor.shape.bold || cursor.shape.underline
|
|
2080
|
-
|| cursor.shape.blink || cursor.shape.inverse
|
|
2081
|
-
|| cursor.shape.invisible) {
|
|
2082
|
-
attr &= ~(0x1ff << 18);
|
|
2083
|
-
attr |= ((cattr >> 18) & 0x1ff) << 18;
|
|
2084
|
-
}
|
|
2085
|
-
|
|
2086
|
-
if (cursor.shape.fg) {
|
|
2087
|
-
attr &= ~(0x1ff << 9);
|
|
2088
|
-
attr |= ((cattr >> 9) & 0x1ff) << 9;
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
|
-
if (cursor.shape.bg) {
|
|
2092
|
-
attr &= ~(0x1ff << 0);
|
|
2093
|
-
attr |= cattr & 0x1ff;
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2096
|
-
if (cursor.shape.ch) {
|
|
2097
|
-
ch = cursor.shape.ch;
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
|
-
if (cursor.color != null) {
|
|
2102
|
-
attr &= ~(0x1ff << 9);
|
|
2103
|
-
attr |= cursor.color << 9;
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
return {
|
|
2107
|
-
ch: ch,
|
|
2108
|
-
attr: attr
|
|
2109
|
-
};
|
|
2110
|
-
};
|
|
2111
|
-
|
|
2112
|
-
Screen.prototype.screenshot = function(xi, xl, yi, yl, term) {
|
|
2113
|
-
if (xi == null) xi = 0;
|
|
2114
|
-
if (xl == null) xl = this.cols;
|
|
2115
|
-
if (yi == null) yi = 0;
|
|
2116
|
-
if (yl == null) yl = this.rows;
|
|
2117
|
-
|
|
2118
|
-
if (xi < 0) xi = 0;
|
|
2119
|
-
if (yi < 0) yi = 0;
|
|
2120
|
-
|
|
2121
|
-
var x
|
|
2122
|
-
, y
|
|
2123
|
-
, line
|
|
2124
|
-
, out
|
|
2125
|
-
, ch
|
|
2126
|
-
, data
|
|
2127
|
-
, attr;
|
|
2128
|
-
|
|
2129
|
-
var sdattr = this.dattr;
|
|
2130
|
-
|
|
2131
|
-
if (term) {
|
|
2132
|
-
this.dattr = term.defAttr;
|
|
2133
|
-
}
|
|
2134
|
-
|
|
2135
|
-
var main = '';
|
|
2136
|
-
|
|
2137
|
-
for (y = yi; y < yl; y++) {
|
|
2138
|
-
line = term
|
|
2139
|
-
? term.lines[y]
|
|
2140
|
-
: this.lines[y];
|
|
2141
|
-
|
|
2142
|
-
if (!line) break;
|
|
2143
|
-
|
|
2144
|
-
out = '';
|
|
2145
|
-
attr = this.dattr;
|
|
2146
|
-
|
|
2147
|
-
for (x = xi; x < xl; x++) {
|
|
2148
|
-
if (!line[x]) break;
|
|
2149
|
-
|
|
2150
|
-
data = line[x][0];
|
|
2151
|
-
ch = line[x][1];
|
|
2152
|
-
|
|
2153
|
-
if (data !== attr) {
|
|
2154
|
-
if (attr !== this.dattr) {
|
|
2155
|
-
out += '\x1b[m';
|
|
2156
|
-
}
|
|
2157
|
-
if (data !== this.dattr) {
|
|
2158
|
-
var _data = data;
|
|
2159
|
-
if (term) {
|
|
2160
|
-
if (((_data >> 9) & 0x1ff) === 257) _data |= 0x1ff << 9;
|
|
2161
|
-
if ((_data & 0x1ff) === 256) _data |= 0x1ff;
|
|
2162
|
-
}
|
|
2163
|
-
out += this.codeAttr(_data);
|
|
2164
|
-
}
|
|
2165
|
-
}
|
|
2166
|
-
|
|
2167
|
-
if (this.fullUnicode) {
|
|
2168
|
-
if (unicode.charWidth(line[x][1]) === 2) {
|
|
2169
|
-
if (x === xl - 1) {
|
|
2170
|
-
ch = ' ';
|
|
2171
|
-
} else {
|
|
2172
|
-
x++;
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
}
|
|
2176
|
-
|
|
2177
|
-
out += ch;
|
|
2178
|
-
attr = data;
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
|
-
if (attr !== this.dattr) {
|
|
2182
|
-
out += '\x1b[m';
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
if (out) {
|
|
2186
|
-
main += (y > 0 ? '\n' : '') + out;
|
|
2187
|
-
}
|
|
2188
|
-
}
|
|
2189
|
-
|
|
2190
|
-
main = main.replace(/(?:\s*\x1b\[40m\s*\x1b\[m\s*)*$/, '') + '\n';
|
|
2191
|
-
|
|
2192
|
-
if (term) {
|
|
2193
|
-
this.dattr = sdattr;
|
|
2194
|
-
}
|
|
2195
|
-
|
|
2196
|
-
return main;
|
|
2197
|
-
};
|
|
2198
|
-
|
|
2199
|
-
/**
|
|
2200
|
-
* Positioning
|
|
2201
|
-
*/
|
|
2202
|
-
|
|
2203
|
-
Screen.prototype._getPos = function() {
|
|
2204
|
-
return this;
|
|
2205
|
-
};
|
|
2206
|
-
|
|
2207
|
-
/**
|
|
2208
|
-
* Angle Table
|
|
2209
|
-
*/
|
|
2210
|
-
|
|
2211
|
-
var angles = {
|
|
2212
|
-
'\u2518': true, // '┘'
|
|
2213
|
-
'\u2510': true, // '┐'
|
|
2214
|
-
'\u250c': true, // '┌'
|
|
2215
|
-
'\u2514': true, // '└'
|
|
2216
|
-
'\u253c': true, // '┼'
|
|
2217
|
-
'\u251c': true, // '├'
|
|
2218
|
-
'\u2524': true, // '┤'
|
|
2219
|
-
'\u2534': true, // '┴'
|
|
2220
|
-
'\u252c': true, // '┬'
|
|
2221
|
-
'\u2502': true, // '│'
|
|
2222
|
-
'\u2500': true // '─'
|
|
2223
|
-
};
|
|
2224
|
-
|
|
2225
|
-
var langles = {
|
|
2226
|
-
'\u250c': true, // '┌'
|
|
2227
|
-
'\u2514': true, // '└'
|
|
2228
|
-
'\u253c': true, // '┼'
|
|
2229
|
-
'\u251c': true, // '├'
|
|
2230
|
-
'\u2534': true, // '┴'
|
|
2231
|
-
'\u252c': true, // '┬'
|
|
2232
|
-
'\u2500': true // '─'
|
|
2233
|
-
};
|
|
2234
|
-
|
|
2235
|
-
var uangles = {
|
|
2236
|
-
'\u2510': true, // '┐'
|
|
2237
|
-
'\u250c': true, // '┌'
|
|
2238
|
-
'\u253c': true, // '┼'
|
|
2239
|
-
'\u251c': true, // '├'
|
|
2240
|
-
'\u2524': true, // '┤'
|
|
2241
|
-
'\u252c': true, // '┬'
|
|
2242
|
-
'\u2502': true // '│'
|
|
2243
|
-
};
|
|
2244
|
-
|
|
2245
|
-
var rangles = {
|
|
2246
|
-
'\u2518': true, // '┘'
|
|
2247
|
-
'\u2510': true, // '┐'
|
|
2248
|
-
'\u253c': true, // '┼'
|
|
2249
|
-
'\u2524': true, // '┤'
|
|
2250
|
-
'\u2534': true, // '┴'
|
|
2251
|
-
'\u252c': true, // '┬'
|
|
2252
|
-
'\u2500': true // '─'
|
|
2253
|
-
};
|
|
2254
|
-
|
|
2255
|
-
var dangles = {
|
|
2256
|
-
'\u2518': true, // '┘'
|
|
2257
|
-
'\u2514': true, // '└'
|
|
2258
|
-
'\u253c': true, // '┼'
|
|
2259
|
-
'\u251c': true, // '├'
|
|
2260
|
-
'\u2524': true, // '┤'
|
|
2261
|
-
'\u2534': true, // '┴'
|
|
2262
|
-
'\u2502': true // '│'
|
|
2263
|
-
};
|
|
2264
|
-
|
|
2265
|
-
// var cdangles = {
|
|
2266
|
-
// '\u250c': true // '┌'
|
|
2267
|
-
// };
|
|
2268
|
-
|
|
2269
|
-
// Every ACS angle character can be
|
|
2270
|
-
// represented by 4 bits ordered like this:
|
|
2271
|
-
// [langle][uangle][rangle][dangle]
|
|
2272
|
-
var angleTable = {
|
|
2273
|
-
'0000': '', // ?
|
|
2274
|
-
'0001': '\u2502', // '│' // ?
|
|
2275
|
-
'0010': '\u2500', // '─' // ??
|
|
2276
|
-
'0011': '\u250c', // '┌'
|
|
2277
|
-
'0100': '\u2502', // '│' // ?
|
|
2278
|
-
'0101': '\u2502', // '│'
|
|
2279
|
-
'0110': '\u2514', // '└'
|
|
2280
|
-
'0111': '\u251c', // '├'
|
|
2281
|
-
'1000': '\u2500', // '─' // ??
|
|
2282
|
-
'1001': '\u2510', // '┐'
|
|
2283
|
-
'1010': '\u2500', // '─' // ??
|
|
2284
|
-
'1011': '\u252c', // '┬'
|
|
2285
|
-
'1100': '\u2518', // '┘'
|
|
2286
|
-
'1101': '\u2524', // '┤'
|
|
2287
|
-
'1110': '\u2534', // '┴'
|
|
2288
|
-
'1111': '\u253c' // '┼'
|
|
2289
|
-
};
|
|
2290
|
-
|
|
2291
|
-
Object.keys(angleTable).forEach(function(key) {
|
|
2292
|
-
angleTable[parseInt(key, 2)] = angleTable[key];
|
|
2293
|
-
delete angleTable[key];
|
|
2294
|
-
});
|
|
2295
|
-
|
|
2296
|
-
/**
|
|
2297
|
-
* Expose
|
|
2298
|
-
*/
|
|
2299
|
-
|
|
2300
|
-
module.exports = Screen;
|