(args)
| 1466 | } |
| 1467 | |
| 1468 | cmdList(args) { |
| 1469 | |
| 1470 | let path, centerLine, startLine, endLine; |
| 1471 | |
| 1472 | if (args.length > 0) { |
| 1473 | const spec = args[0]; |
| 1474 | if (spec.includes(':')) { |
| 1475 | const lastColon = spec.lastIndexOf(':'); |
| 1476 | path = spec.substring(0, lastColon); |
| 1477 | |
| 1478 | const lineSpec = spec.substring(lastColon + 1); |
| 1479 | if (lineSpec.includes(',')) { |
| 1480 | const parts = lineSpec.split(','); |
| 1481 | startLine = parseInt(parts[0]); |
| 1482 | endLine = parseInt(parts[1]); |
| 1483 | } else { |
| 1484 | centerLine = parseInt(lineSpec); |
| 1485 | } |
| 1486 | |
| 1487 | const resolved = this.resolveFilePath(path, false); |
| 1488 | if (resolved === null) |
| 1489 | return; |
| 1490 | path = resolved; |
| 1491 | } |
| 1492 | else { |
| 1493 | if (spec.includes(',')) { |
| 1494 | const parts = spec.split(','); |
| 1495 | startLine = parseInt(parts[0]); |
| 1496 | endLine = parseInt(parts[1]); |
| 1497 | } else { |
| 1498 | centerLine = parseInt(spec); |
| 1499 | } |
| 1500 | path = this.currentPath; |
| 1501 | } |
| 1502 | } |
| 1503 | else if (this.listPosition) { |
| 1504 | // Continue listing from where we left off |
| 1505 | path = this.listPosition.path; |
| 1506 | centerLine = this.listPosition.line; |
| 1507 | } |
| 1508 | else { |
| 1509 | path = this.currentPath; |
| 1510 | centerLine = parseInt(this.currentLine); |
| 1511 | } |
| 1512 | |
| 1513 | if (!path) { |
| 1514 | this.commandError('No current file.'); |
| 1515 | return; |
| 1516 | } |
| 1517 | |
| 1518 | const lines = this.readSourceLines(path); |
| 1519 | if (!lines) { |
| 1520 | this.commandError(`Cannot read file: ${path}`); |
| 1521 | return; |
| 1522 | } |
| 1523 | |
| 1524 | let start, end; |
| 1525 | if (this.listWindowSize === undefined) this.listWindowSize = 10; |
no test coverage detected