Rev 8762 | Rev 9050 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8762 | Rev 9010 | ||
---|---|---|---|
Line 1504... | Line 1504... | ||
1504 | delete(text) |
1504 | delete(text) |
1505 | END |
1505 | END |
1506 | END delLine; |
1506 | END delLine; |
Line -... | Line 1507... | ||
- | 1507 | ||
- | 1508 | ||
- | 1509 | PROCEDURE dupLine (text: tText); |
|
- | 1510 | VAR |
|
- | 1511 | newLine, curLine: tLine; |
|
- | 1512 | BEGIN |
|
- | 1513 | curLine := text.curLine; |
|
- | 1514 | newLine := Lines.create(FALSE); |
|
- | 1515 | Lines.modify(newLine); |
|
- | 1516 | modify(text); |
|
- | 1517 | Lines.insert3(newLine, 0, curLine.length); |
|
- | 1518 | List._insert(text, curLine, newLine); |
|
- | 1519 | Lines.move(curLine, newLine) |
|
- | 1520 | END dupLine; |
|
- | 1521 | ||
- | 1522 | ||
- | 1523 | PROCEDURE exchange (text: tText; first, second: tLine); |
|
- | 1524 | BEGIN |
|
- | 1525 | List._exchange(text, first, second); |
|
- | 1526 | Lines.modify(text.curLine); |
|
- | 1527 | modify(text); |
|
- | 1528 | UpDown(text, 0) |
|
- | 1529 | END exchange; |
|
- | 1530 | ||
- | 1531 | ||
- | 1532 | PROCEDURE upLine (text: tText); |
|
- | 1533 | BEGIN |
|
- | 1534 | IF text.cursor.Y > 0 THEN |
|
- | 1535 | DEC(text.cursor.Y); |
|
- | 1536 | exchange(text, text.curLine.prev(tLine), text.curLine) |
|
- | 1537 | END |
|
- | 1538 | END upLine; |
|
- | 1539 | ||
- | 1540 | ||
- | 1541 | PROCEDURE downLine (text: tText); |
|
- | 1542 | BEGIN |
|
- | 1543 | IF text.cursor.Y < text.count - 1 THEN |
|
- | 1544 | INC(text.cursor.Y); |
|
- | 1545 | exchange(text, text.curLine, text.curLine.next(tLine)) |
|
- | 1546 | END |
|
- | 1547 | END downLine; |
|
- | 1548 | ||
- | 1549 | ||
- | 1550 | PROCEDURE isWordChar (c: WCHAR): BOOLEAN; |
|
- | 1551 | RETURN U.isLetter(c) OR U.isDigit(c) OR (c = "_") |
|
- | 1552 | END isWordChar; |
|
- | 1553 | ||
- | 1554 | ||
- | 1555 | PROCEDURE wordSel* (text: tText); |
|
- | 1556 | VAR |
|
- | 1557 | n, i, x1, x2: INTEGER; |
|
- | 1558 | selBeg, selEnd: tPoint; |
|
- | 1559 | str: tString; |
|
- | 1560 | curLine: tLine; |
|
- | 1561 | BEGIN |
|
- | 1562 | curLine := text.curLine; |
|
- | 1563 | IF selected(text) & (text.cursor.Y = text.select.Y) THEN |
|
- | 1564 | getSelect(text, selBeg, selEnd); |
|
- | 1565 | x1 := selBeg.X; |
|
- | 1566 | x2 := selEnd.X; |
|
- | 1567 | n := getString(curLine, x1, x2 - x1, str); |
|
- | 1568 | ELSE |
|
- | 1569 | str := "" |
|
- | 1570 | END; |
|
- | 1571 | IF str # "" THEN |
|
- | 1572 | i := 0; |
|
- | 1573 | WHILE (i < n) & isWordChar(str[i]) DO |
|
- | 1574 | INC(i) |
|
- | 1575 | END; |
|
- | 1576 | IF (i # n) OR |
|
- | 1577 | ((x1 > 0) & isWordChar(getChar(curLine, x1 - 1))) OR |
|
- | 1578 | ((x2 < curLine.length) & isWordChar(getChar(curLine, x2))) THEN |
|
- | 1579 | str := "" |
|
- | 1580 | END |
|
- | 1581 | END; |
|
- | 1582 | IF search(text, str, TRUE, TRUE) THEN END |
|
- | 1583 | END wordSel; |
|
1507 | 1584 | ||
1508 | 1585 | ||
1509 | PROCEDURE key* (text: tText; code: INTEGER; shift: SET); |
1586 | PROCEDURE key* (text: tText; code: INTEGER; shift: SET); |
1510 | BEGIN |
1587 | BEGIN |
1511 | IF SHIFT IN shift THEN |
1588 | IF SHIFT IN shift THEN |
Line 1548... | Line 1625... | ||
1548 | SetPos(text, text.curLine.prev(tLine).length, text.cursor.Y - 1) |
1625 | SetPos(text, text.curLine.prev(tLine).length, text.cursor.Y - 1) |
1549 | ELSE |
1626 | ELSE |
1550 | SetPos(text, text.cursor.X - 1, text.cursor.Y) |
1627 | SetPos(text, text.cursor.X - 1, text.cursor.Y) |
1551 | END |
1628 | END |
1552 | |38: |
1629 | |38: |
- | 1630 | IF CTRL IN shift THEN |
|
- | 1631 | upLine(text) |
|
- | 1632 | ELSE |
|
1553 | UpDown(text, -1) |
1633 | UpDown(text, -1) |
- | 1634 | END |
|
1554 | |39: |
1635 | |39: |
1555 | IF (text.cursor.X = text.curLine.length) & (text.curLine.next # NIL) THEN |
1636 | IF (text.cursor.X = text.curLine.length) & (text.curLine.next # NIL) THEN |
1556 | SetPos(text, 0, text.cursor.Y + 1) |
1637 | SetPos(text, 0, text.cursor.Y + 1) |
1557 | ELSE |
1638 | ELSE |
1558 | SetPos(text, text.cursor.X + 1, text.cursor.Y) |
1639 | SetPos(text, text.cursor.X + 1, text.cursor.Y) |
1559 | END |
1640 | END |
1560 | |40: |
1641 | |40: |
- | 1642 | IF CTRL IN shift THEN |
|
- | 1643 | downLine(text) |
|
- | 1644 | ELSE |
|
1561 | UpDown(text, 1) |
1645 | UpDown(text, 1) |
- | 1646 | END |
|
1562 | 1647 | |46: |
|
- | 1648 | IF CTRL IN shift THEN |
|
- | 1649 | delLine(text) |
|
- | 1650 | ELSE |
|
1563 | |46: delete(text); ShowCursor; drawCursor := TRUE |
1651 | delete(text); ShowCursor; drawCursor := TRUE |
1564 | 1652 | END |
|
1565 | |ORD("C"): |
1653 | |ORD("C"): |
1566 | IF CTRL IN shift THEN |
1654 | IF CTRL IN shift THEN |
1567 | IF selected(text) THEN |
1655 | IF selected(text) THEN |
1568 | copy(text) |
1656 | copy(text) |
1569 | END |
1657 | END |
Line 1590... | Line 1678... | ||
1590 | END |
1678 | END |
1591 | |ORD("L"), ORD("U"): |
1679 | |ORD("L"), ORD("U"): |
1592 | IF CTRL IN shift THEN |
1680 | IF CTRL IN shift THEN |
1593 | changeCase(text, code = ORD("U")) |
1681 | changeCase(text, code = ORD("U")) |
1594 | END |
1682 | END |
- | 1683 | |ORD("D"): |
|
- | 1684 | IF CTRL IN shift THEN |
|
- | 1685 | dupLine(text) |
|
- | 1686 | END |
|
1595 | ELSE |
1687 | ELSE |
1596 | END |
1688 | END |
1597 | END key; |
1689 | END key; |
Line 1610... | Line 1702... | ||
1610 | 1702 | ||
1611 | PROCEDURE selectWord* (text: tText); |
1703 | PROCEDURE selectWord* (text: tText); |
1612 | VAR |
1704 | VAR |
1613 | cursorX, x1, x2: INTEGER; |
1705 | cursorX, x1, x2: INTEGER; |
1614 | line: tLine; |
- | |
1615 | - | ||
1616 | PROCEDURE isWordChar (c: WCHAR): BOOLEAN; |
- | |
1617 | RETURN U.isLetter(c) OR U.isDigit(c) OR (c = "_") |
- | |
1618 | END isWordChar; |
- | |
1619 | 1706 | line: tLine; |
|
1620 | BEGIN |
1707 | BEGIN |
1621 | resetSelect(text); |
1708 | resetSelect(text); |
1622 | cursorX := text.cursor.X; |
1709 | cursorX := text.cursor.X; |
1623 | line := text.curLine; |
1710 | line := text.curLine; |