@socketsecurity/cli-with-sentry 0.15.11 → 0.15.12

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