Changeset View
Changeset View
Standalone View
Standalone View
src/script/katescriptdocument.cpp
Context not available. | |||||
52 | return m_document->defStyleNum(line, column); | 52 | return m_document->defStyleNum(line, column); | ||
---|---|---|---|---|---|
53 | } | 53 | } | ||
54 | 54 | | |||
55 | int KateScriptDocument::defStyleNum(const KTextEditor::Cursor &cursor) | 55 | int KateScriptDocument::defStyleNum(const QJSValue &jscursor) | ||
56 | { | 56 | { | ||
57 | return defStyleNum(cursor.line(), cursor.column()); | 57 | return defStyleNum(cursorFromScriptValue(jscursor)); | ||
58 | } | 58 | } | ||
59 | 59 | | |||
60 | int KateScriptDocument::defStyleNum(const QJSValue &jscursor) | 60 | int KateScriptDocument::defStyleNum(const KTextEditor::Cursor &cursor) | ||
61 | { | 61 | { | ||
62 | return defStyleNum(cursorFromScriptValue(jscursor)); | 62 | return defStyleNum(cursor.line(), cursor.column()); | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | bool KateScriptDocument::isCode(int line, int column) | 65 | bool KateScriptDocument::isCode(int line, int column) | ||
Context not available. | |||||
68 | return _isCode(defaultStyle); | 68 | return _isCode(defaultStyle); | ||
69 | } | 69 | } | ||
70 | 70 | | |||
71 | bool KateScriptDocument::isCode(const KTextEditor::Cursor &cursor) | 71 | bool KateScriptDocument::isCode(const QJSValue &jscursor) | ||
72 | { | 72 | { | ||
73 | return isCode(cursor.line(), cursor.column()); | 73 | return isCode(cursorFromScriptValue(jscursor)); | ||
74 | } | 74 | } | ||
75 | 75 | | |||
76 | bool KateScriptDocument::isCode(const QJSValue &jscursor) | 76 | bool KateScriptDocument::isCode(const KTextEditor::Cursor &cursor) | ||
77 | { | 77 | { | ||
78 | return isCode(cursorFromScriptValue(jscursor)); | 78 | return isCode(cursor.line(), cursor.column()); | ||
79 | } | 79 | } | ||
80 | 80 | | |||
81 | bool KateScriptDocument::isComment(int line, int column) | 81 | bool KateScriptDocument::isComment(int line, int column) | ||
Context not available. | |||||
83 | return m_document->isComment(line, column); | 83 | return m_document->isComment(line, column); | ||
84 | } | 84 | } | ||
85 | 85 | | |||
86 | bool KateScriptDocument::isComment(const KTextEditor::Cursor &cursor) | 86 | bool KateScriptDocument::isComment(const QJSValue &jscursor) | ||
87 | { | 87 | { | ||
88 | return isComment(cursor.line(), cursor.column()); | 88 | return isComment(cursorFromScriptValue(jscursor)); | ||
89 | } | 89 | } | ||
90 | 90 | | |||
91 | bool KateScriptDocument::isComment(const QJSValue &jscursor) | 91 | bool KateScriptDocument::isComment(const KTextEditor::Cursor &cursor) | ||
92 | { | 92 | { | ||
93 | return isComment(cursorFromScriptValue(jscursor)); | 93 | return isComment(cursor.line(), cursor.column()); | ||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | bool KateScriptDocument::isString(int line, int column) | 96 | bool KateScriptDocument::isString(int line, int column) | ||
Context not available. | |||||
99 | return defaultStyle == KTextEditor::dsString; | 99 | return defaultStyle == KTextEditor::dsString; | ||
100 | } | 100 | } | ||
101 | 101 | | |||
102 | bool KateScriptDocument::isString(const KTextEditor::Cursor &cursor) | 102 | bool KateScriptDocument::isString(const QJSValue &jscursor) | ||
103 | { | 103 | { | ||
104 | return isString(cursor.line(), cursor.column()); | 104 | return isString(cursorFromScriptValue(jscursor)); | ||
105 | } | 105 | } | ||
106 | 106 | | |||
107 | bool KateScriptDocument::isString(const QJSValue &jscursor) | 107 | bool KateScriptDocument::isString(const KTextEditor::Cursor &cursor) | ||
108 | { | 108 | { | ||
109 | return isString(cursorFromScriptValue(jscursor)); | 109 | return isString(cursor.line(), cursor.column()); | ||
110 | } | 110 | } | ||
111 | 111 | | |||
112 | bool KateScriptDocument::isRegionMarker(int line, int column) | 112 | bool KateScriptDocument::isRegionMarker(int line, int column) | ||
Context not available. | |||||
115 | return defaultStyle == KTextEditor::dsRegionMarker; | 115 | return defaultStyle == KTextEditor::dsRegionMarker; | ||
116 | } | 116 | } | ||
117 | 117 | | |||
118 | bool KateScriptDocument::isRegionMarker(const KTextEditor::Cursor &cursor) | 118 | bool KateScriptDocument::isRegionMarker(const QJSValue &jscursor) | ||
119 | { | 119 | { | ||
120 | return isRegionMarker(cursor.line(), cursor.column()); | 120 | return isRegionMarker(cursorFromScriptValue(jscursor)); | ||
121 | } | 121 | } | ||
122 | 122 | | |||
123 | bool KateScriptDocument::isRegionMarker(const QJSValue &jscursor) | 123 | bool KateScriptDocument::isRegionMarker(const KTextEditor::Cursor &cursor) | ||
124 | { | 124 | { | ||
125 | return isRegionMarker(cursorFromScriptValue(jscursor)); | 125 | return isRegionMarker(cursor.line(), cursor.column()); | ||
126 | } | 126 | } | ||
127 | 127 | | |||
128 | bool KateScriptDocument::isChar(int line, int column) | 128 | bool KateScriptDocument::isChar(int line, int column) | ||
Context not available. | |||||
131 | return defaultStyle == KTextEditor::dsChar; | 131 | return defaultStyle == KTextEditor::dsChar; | ||
132 | } | 132 | } | ||
133 | 133 | | |||
134 | bool KateScriptDocument::isChar(const KTextEditor::Cursor &cursor) | 134 | bool KateScriptDocument::isChar(const QJSValue &jscursor) | ||
135 | { | 135 | { | ||
136 | return isChar(cursor.line(), cursor.column()); | 136 | return isChar(cursorFromScriptValue(jscursor)); | ||
137 | } | 137 | } | ||
138 | 138 | | |||
139 | bool KateScriptDocument::isChar(const QJSValue &jscursor) | 139 | bool KateScriptDocument::isChar(const KTextEditor::Cursor &cursor) | ||
140 | { | 140 | { | ||
141 | return isChar(cursorFromScriptValue(jscursor)); | 141 | return isChar(cursor.line(), cursor.column()); | ||
142 | } | 142 | } | ||
143 | 143 | | |||
144 | bool KateScriptDocument::isOthers(int line, int column) | 144 | bool KateScriptDocument::isOthers(int line, int column) | ||
Context not available. | |||||
147 | return defaultStyle == KTextEditor::dsOthers; | 147 | return defaultStyle == KTextEditor::dsOthers; | ||
148 | } | 148 | } | ||
149 | 149 | | |||
150 | bool KateScriptDocument::isOthers(const KTextEditor::Cursor &cursor) | 150 | bool KateScriptDocument::isOthers(const QJSValue &jscursor) | ||
151 | { | 151 | { | ||
152 | return isOthers(cursor.line(), cursor.column()); | 152 | return isOthers(cursorFromScriptValue(jscursor)); | ||
153 | } | 153 | } | ||
154 | 154 | | |||
155 | bool KateScriptDocument::isOthers(const QJSValue &jscursor) | 155 | bool KateScriptDocument::isOthers(const KTextEditor::Cursor &cursor) | ||
156 | { | 156 | { | ||
157 | return isOthers(cursorFromScriptValue(jscursor)); | 157 | return isOthers(cursor.line(), cursor.column()); | ||
158 | } | 158 | } | ||
159 | 159 | | |||
160 | int KateScriptDocument::firstVirtualColumn(int line) | 160 | int KateScriptDocument::firstVirtualColumn(int line) | ||
Context not available. | |||||
189 | return textLine->toVirtualColumn(column, tabWidth); | 189 | return textLine->toVirtualColumn(column, tabWidth); | ||
190 | } | 190 | } | ||
191 | 191 | | |||
192 | int KateScriptDocument::toVirtualColumn(const QJSValue &jscursor) | ||||
193 | { | ||||
194 | return toVirtualColumn(cursorFromScriptValue(jscursor)); | ||||
195 | } | ||||
196 | | ||||
192 | int KateScriptDocument::toVirtualColumn(const KTextEditor::Cursor &cursor) | 197 | int KateScriptDocument::toVirtualColumn(const KTextEditor::Cursor &cursor) | ||
193 | { | 198 | { | ||
194 | return toVirtualColumn(cursor.line(), cursor.column()); | 199 | return toVirtualColumn(cursor.line(), cursor.column()); | ||
195 | } | 200 | } | ||
196 | 201 | | |||
197 | int KateScriptDocument::toVirtualColumn(const QJSValue &jscursor) | 202 | QJSValue KateScriptDocument::toVirtualCursor(const QJSValue &jscursor) | ||
198 | { | 203 | { | ||
199 | return toVirtualColumn(cursorFromScriptValue(jscursor)); | 204 | const KTextEditor::Cursor cursor = toVirtualCursor(cursorFromScriptValue(jscursor)); | ||
205 | return cursorToScriptValue(m_engine, cursor); | ||||
200 | } | 206 | } | ||
201 | 207 | | |||
202 | KTextEditor::Cursor KateScriptDocument::toVirtualCursor(const KTextEditor::Cursor &cursor) | 208 | KTextEditor::Cursor KateScriptDocument::toVirtualCursor(const KTextEditor::Cursor &cursor) | ||
Context not available. | |||||
215 | return textLine->fromVirtualColumn(virtualColumn, tabWidth); | 221 | return textLine->fromVirtualColumn(virtualColumn, tabWidth); | ||
216 | } | 222 | } | ||
217 | 223 | | |||
224 | int KateScriptDocument::fromVirtualColumn(const QJSValue &jscursor) | ||||
225 | { | ||||
226 | return fromVirtualColumn(cursorFromScriptValue(jscursor)); | ||||
227 | } | ||||
228 | | ||||
218 | int KateScriptDocument::fromVirtualColumn(const KTextEditor::Cursor &virtualCursor) | 229 | int KateScriptDocument::fromVirtualColumn(const KTextEditor::Cursor &virtualCursor) | ||
219 | { | 230 | { | ||
220 | return fromVirtualColumn(virtualCursor.line(), virtualCursor.column()); | 231 | return fromVirtualColumn(virtualCursor.line(), virtualCursor.column()); | ||
221 | } | 232 | } | ||
222 | 233 | | |||
234 | QJSValue KateScriptDocument::fromVirtualCursor(const QJSValue &jscursor) | ||||
235 | { | ||||
236 | const KTextEditor::Cursor cursor = fromVirtualCursor(cursorFromScriptValue(jscursor)); | ||||
237 | return cursorToScriptValue(m_engine, cursor); | ||||
238 | } | ||||
239 | | ||||
223 | KTextEditor::Cursor KateScriptDocument::fromVirtualCursor(const KTextEditor::Cursor &virtualCursor) | 240 | KTextEditor::Cursor KateScriptDocument::fromVirtualCursor(const KTextEditor::Cursor &virtualCursor) | ||
224 | { | 241 | { | ||
225 | return KTextEditor::Cursor(virtualCursor.line(), | 242 | return KTextEditor::Cursor(virtualCursor.line(), | ||
Context not available. | |||||
442 | return m_document->text(range); | 459 | return m_document->text(range); | ||
443 | } | 460 | } | ||
444 | 461 | | |||
462 | QString KateScriptDocument::text(const QJSValue &jsfrom, const QJSValue &jsto) | ||||
463 | { | ||||
464 | return text(cursorFromScriptValue(jsfrom), cursorFromScriptValue(jsto)); | ||||
465 | } | ||||
466 | | ||||
445 | QString KateScriptDocument::text(const QJSValue &jsrange) | 467 | QString KateScriptDocument::text(const QJSValue &jsrange) | ||
446 | { | 468 | { | ||
447 | return text(rangeFromScriptValue(jsrange)); | 469 | return text(rangeFromScriptValue(jsrange)); | ||
Context not available. | |||||
467 | return wordRangeAt(KTextEditor::Cursor(line, column)); | 489 | return wordRangeAt(KTextEditor::Cursor(line, column)); | ||
468 | } | 490 | } | ||
469 | 491 | | |||
492 | QJSValue KateScriptDocument::wordRangeAt(const QJSValue & jscursor) | ||||
493 | { | ||||
494 | return wordRangeAt(cursorFromScriptValue(jscursor)); | ||||
495 | } | ||||
496 | | ||||
470 | QJSValue KateScriptDocument::wordRangeAt(const KTextEditor::Cursor &cursor) | 497 | QJSValue KateScriptDocument::wordRangeAt(const KTextEditor::Cursor &cursor) | ||
471 | { | 498 | { | ||
472 | return rangeToScriptValue(m_engine, m_document->wordRangeAt(cursor)); | 499 | return rangeToScriptValue(m_engine, m_document->wordRangeAt(cursor)); | ||
Context not available. | |||||
477 | return charAt(KTextEditor::Cursor(line, column)); | 504 | return charAt(KTextEditor::Cursor(line, column)); | ||
478 | } | 505 | } | ||
479 | 506 | | |||
480 | QString KateScriptDocument::charAt(const KTextEditor::Cursor &cursor) | 507 | QString KateScriptDocument::charAt(const QJSValue &jscursor) | ||
481 | { | 508 | { | ||
482 | const QChar c = m_document->characterAt(cursor); | 509 | return charAt(cursorFromScriptValue(jscursor)); | ||
483 | return c.isNull() ? QString() : QString(c); | | |||
484 | } | 510 | } | ||
485 | 511 | | |||
486 | QString KateScriptDocument::charAt(const QJSValue &jscursor) | 512 | QString KateScriptDocument::charAt(const KTextEditor::Cursor &cursor) | ||
487 | { | 513 | { | ||
488 | return charAt(cursorFromScriptValue(jscursor)); | 514 | const QChar c = m_document->characterAt(cursor); | ||
515 | return c.isNull() ? QString() : QString(c); | ||||
489 | } | 516 | } | ||
490 | 517 | | |||
491 | QString KateScriptDocument::firstChar(int line) | 518 | QString KateScriptDocument::firstChar(int line) | ||
Context not available. | |||||
515 | return isSpace(KTextEditor::Cursor(line, column)); | 542 | return isSpace(KTextEditor::Cursor(line, column)); | ||
516 | } | 543 | } | ||
517 | 544 | | |||
518 | bool KateScriptDocument::isSpace(const KTextEditor::Cursor &cursor) | 545 | bool KateScriptDocument::isSpace(const QJSValue &jscursor) | ||
519 | { | 546 | { | ||
520 | return m_document->characterAt(cursor).isSpace(); | 547 | return isSpace(cursorFromScriptValue(jscursor)); | ||
521 | } | 548 | } | ||
522 | 549 | | |||
523 | bool KateScriptDocument::isSpace(const QJSValue &jscursor) | 550 | bool KateScriptDocument::isSpace(const KTextEditor::Cursor &cursor) | ||
524 | { | 551 | { | ||
525 | return isSpace(cursorFromScriptValue(jscursor)); | 552 | return m_document->characterAt(cursor).isSpace(); | ||
526 | } | 553 | } | ||
527 | 554 | | |||
528 | bool KateScriptDocument::matchesAt(int line, int column, const QString &s) | 555 | bool KateScriptDocument::matchesAt(int line, int column, const QString &s) | ||
Context not available. | |||||
565 | return removeText(KTextEditor::Range(from, to)); | 592 | return removeText(KTextEditor::Range(from, to)); | ||
566 | } | 593 | } | ||
567 | 594 | | |||
568 | bool KateScriptDocument::truncate(const KTextEditor::Cursor &cursor) | | |||
569 | { | | |||
570 | return truncate(cursor.line(), cursor.column()); | | |||
571 | } | | |||
572 | | ||||
573 | bool KateScriptDocument::truncate(const QJSValue &cursor) | 595 | bool KateScriptDocument::truncate(const QJSValue &cursor) | ||
574 | { | 596 | { | ||
575 | return truncate(cursorFromScriptValue(cursor)); | 597 | return truncate(cursorFromScriptValue(cursor)); | ||
576 | } | 598 | } | ||
577 | 599 | | |||
578 | bool KateScriptDocument::insertText(int line, int column, const QString &s) | 600 | bool KateScriptDocument::truncate(const KTextEditor::Cursor &cursor) | ||
579 | { | 601 | { | ||
580 | return insertText(KTextEditor::Cursor(line, column), s); | 602 | return truncate(cursor.line(), cursor.column()); | ||
581 | } | 603 | } | ||
582 | 604 | | |||
583 | bool KateScriptDocument::insertText(const KTextEditor::Cursor &cursor, const QString &s) | 605 | bool KateScriptDocument::insertText(int line, int column, const QString &s) | ||
584 | { | 606 | { | ||
585 | return m_document->insertText(cursor, s); | 607 | return insertText(KTextEditor::Cursor(line, column), s); | ||
586 | } | 608 | } | ||
587 | 609 | | |||
588 | bool KateScriptDocument::insertText(const QJSValue &jscursor, const QString &s) | 610 | bool KateScriptDocument::insertText(const QJSValue &jscursor, const QString &s) | ||
Context not available. | |||||
591 | return insertText(cursor, s); | 613 | return insertText(cursor, s); | ||
592 | } | 614 | } | ||
593 | 615 | | |||
594 | bool KateScriptDocument::removeText(int fromLine, int fromColumn, int toLine, int toColumn) | 616 | bool KateScriptDocument::insertText(const KTextEditor::Cursor &cursor, const QString &s) | ||
595 | { | 617 | { | ||
596 | return removeText(KTextEditor::Range(fromLine, fromColumn, toLine, toColumn)); | 618 | return m_document->insertText(cursor, s); | ||
597 | } | 619 | } | ||
598 | 620 | | |||
599 | bool KateScriptDocument::removeText(const KTextEditor::Cursor &from, const KTextEditor::Cursor &to) | 621 | bool KateScriptDocument::removeText(int fromLine, int fromColumn, int toLine, int toColumn) | ||
600 | { | 622 | { | ||
601 | return removeText(KTextEditor::Range(from, to)); | 623 | return removeText(KTextEditor::Range(fromLine, fromColumn, toLine, toColumn)); | ||
602 | } | 624 | } | ||
603 | 625 | | |||
604 | bool KateScriptDocument::removeText(const KTextEditor::Range &range) | 626 | bool KateScriptDocument::removeText(const QJSValue &jsfrom, const QJSValue &jsto) | ||
605 | { | 627 | { | ||
606 | return m_document->removeText(range); | 628 | return removeText(cursorFromScriptValue(jsfrom), cursorFromScriptValue(jsto)); | ||
607 | } | 629 | } | ||
608 | 630 | | |||
609 | bool KateScriptDocument::removeText(const QJSValue &jsrange) | 631 | bool KateScriptDocument::removeText(const QJSValue &jsrange) | ||
Context not available. | |||||
612 | return removeText(range); | 634 | return removeText(range); | ||
613 | } | 635 | } | ||
614 | 636 | | |||
637 | bool KateScriptDocument::removeText(const KTextEditor::Cursor &from, const KTextEditor::Cursor &to) | ||||
638 | { | ||||
639 | return removeText(KTextEditor::Range(from, to)); | ||||
640 | } | ||||
641 | | ||||
642 | bool KateScriptDocument::removeText(const KTextEditor::Range &range) | ||||
643 | { | ||||
644 | return m_document->removeText(range); | ||||
645 | } | ||||
646 | | ||||
615 | bool KateScriptDocument::insertLine(int line, const QString &s) | 647 | bool KateScriptDocument::insertLine(int line, const QString &s) | ||
616 | { | 648 | { | ||
617 | return m_document->insertLine(line, s); | 649 | return m_document->insertLine(line, s); | ||
Context not available. | |||||
627 | return m_document->editWrapLine(line, column); | 659 | return m_document->editWrapLine(line, column); | ||
628 | } | 660 | } | ||
629 | 661 | | |||
630 | bool KateScriptDocument::wrapLine(const KTextEditor::Cursor &cursor) | 662 | bool KateScriptDocument::wrapLine(const QJSValue &jscursor) | ||
631 | { | 663 | { | ||
632 | return wrapLine(cursor.line(), cursor.column()); | 664 | return wrapLine(cursorFromScriptValue(jscursor)); | ||
633 | } | 665 | } | ||
634 | 666 | | |||
635 | bool KateScriptDocument::wrapLine(const QJSValue &jscursor) | 667 | bool KateScriptDocument::wrapLine(const KTextEditor::Cursor &cursor) | ||
636 | { | 668 | { | ||
637 | return wrapLine(cursorFromScriptValue(jscursor)); | 669 | return wrapLine(cursor.line(), cursor.column()); | ||
638 | } | 670 | } | ||
639 | 671 | | |||
640 | void KateScriptDocument::joinLines(int startLine, int endLine) | 672 | void KateScriptDocument::joinLines(int startLine, int endLine) | ||
Context not available. | |||||
692 | return m_document->isValidTextPosition(KTextEditor::Cursor(line, column)); | 724 | return m_document->isValidTextPosition(KTextEditor::Cursor(line, column)); | ||
693 | } | 725 | } | ||
694 | 726 | | |||
695 | bool KateScriptDocument::isValidTextPosition(const KTextEditor::Cursor& cursor) | | |||
696 | { | | |||
697 | return m_document->isValidTextPosition(cursor); | | |||
698 | } | | |||
699 | | ||||
700 | bool KateScriptDocument::isValidTextPosition(const QJSValue& cursor) | 727 | bool KateScriptDocument::isValidTextPosition(const QJSValue& cursor) | ||
701 | { | 728 | { | ||
702 | return m_document->isValidTextPosition(cursorFromScriptValue(cursor)); | 729 | return m_document->isValidTextPosition(cursorFromScriptValue(cursor)); | ||
Context not available. | |||||
723 | return textLine->previousNonSpaceChar(column); | 750 | return textLine->previousNonSpaceChar(column); | ||
724 | } | 751 | } | ||
725 | 752 | | |||
726 | int KateScriptDocument::prevNonSpaceColumn(const KTextEditor::Cursor &cursor) | 753 | int KateScriptDocument::prevNonSpaceColumn(const QJSValue &cursor) | ||
727 | { | 754 | { | ||
728 | return prevNonSpaceColumn(cursor.line(), cursor.column()); | 755 | return prevNonSpaceColumn(cursorFromScriptValue(cursor)); | ||
729 | } | 756 | } | ||
730 | 757 | | |||
731 | int KateScriptDocument::prevNonSpaceColumn(const QJSValue &cursor) | 758 | int KateScriptDocument::prevNonSpaceColumn(const KTextEditor::Cursor &cursor) | ||
732 | { | 759 | { | ||
733 | return prevNonSpaceColumn(cursorFromScriptValue(cursor)); | 760 | return prevNonSpaceColumn(cursor.line(), cursor.column()); | ||
734 | } | 761 | } | ||
735 | 762 | | |||
736 | int KateScriptDocument::nextNonSpaceColumn(int line, int column) | 763 | int KateScriptDocument::nextNonSpaceColumn(int line, int column) | ||
Context not available. | |||||
742 | return textLine->nextNonSpaceChar(column); | 769 | return textLine->nextNonSpaceChar(column); | ||
743 | } | 770 | } | ||
744 | 771 | | |||
745 | int KateScriptDocument::nextNonSpaceColumn(const KTextEditor::Cursor &cursor) | 772 | int KateScriptDocument::nextNonSpaceColumn(const QJSValue &cursor) | ||
746 | { | 773 | { | ||
747 | return nextNonSpaceColumn(cursor.line(), cursor.column()); | 774 | return nextNonSpaceColumn(cursorFromScriptValue(cursor)); | ||
748 | } | 775 | } | ||
749 | 776 | | |||
750 | int KateScriptDocument::nextNonSpaceColumn(const QJSValue &cursor) | 777 | int KateScriptDocument::nextNonSpaceColumn(const KTextEditor::Cursor &cursor) | ||
751 | { | 778 | { | ||
752 | return nextNonSpaceColumn(cursorFromScriptValue(cursor)); | 779 | return nextNonSpaceColumn(cursor.line(), cursor.column()); | ||
753 | } | 780 | } | ||
754 | 781 | | |||
755 | int KateScriptDocument::prevNonEmptyLine(int line) | 782 | int KateScriptDocument::prevNonEmptyLine(int line) | ||
Context not available. | |||||
831 | return textLine->attribute(column); | 858 | return textLine->attribute(column); | ||
832 | } | 859 | } | ||
833 | 860 | | |||
861 | int KateScriptDocument::attribute(const QJSValue &jscursor) | ||||
862 | { | ||||
863 | return attribute(cursorFromScriptValue(jscursor)); | ||||
864 | } | ||||
865 | | ||||
834 | int KateScriptDocument::attribute(const KTextEditor::Cursor &cursor) | 866 | int KateScriptDocument::attribute(const KTextEditor::Cursor &cursor) | ||
835 | { | 867 | { | ||
836 | return attribute(cursor.line(), cursor.column()); | 868 | return attribute(cursor.line(), cursor.column()); | ||
Context not available. | |||||
841 | return attr == attribute(line, column); | 873 | return attr == attribute(line, column); | ||
842 | } | 874 | } | ||
843 | 875 | | |||
876 | bool KateScriptDocument::isAttribute(const QJSValue &jscursor, int attr) | ||||
877 | { | ||||
878 | return isAttribute(cursorFromScriptValue(jscursor), attr); | ||||
879 | } | ||||
880 | | ||||
844 | bool KateScriptDocument::isAttribute(const KTextEditor::Cursor &cursor, int attr) | 881 | bool KateScriptDocument::isAttribute(const KTextEditor::Cursor &cursor, int attr) | ||
845 | { | 882 | { | ||
846 | return isAttribute(cursor.line(), cursor.column(), attr); | 883 | return isAttribute(cursor.line(), cursor.column(), attr); | ||
Context not available. | |||||
854 | return a->name(); | 891 | return a->name(); | ||
855 | } | 892 | } | ||
856 | 893 | | |||
857 | QString KateScriptDocument::attributeName(const KTextEditor::Cursor &cursor) | | |||
858 | { | | |||
859 | return attributeName(cursor.line(), cursor.column()); | | |||
860 | } | | |||
861 | | ||||
862 | QString KateScriptDocument::attributeName(const QJSValue &jscursor) | 894 | QString KateScriptDocument::attributeName(const QJSValue &jscursor) | ||
863 | { | 895 | { | ||
864 | return attributeName(cursorFromScriptValue(jscursor)); | 896 | return attributeName(cursorFromScriptValue(jscursor)); | ||
865 | } | 897 | } | ||
866 | 898 | | |||
867 | bool KateScriptDocument::isAttributeName(int line, int column, const QString &name) | 899 | QString KateScriptDocument::attributeName(const KTextEditor::Cursor &cursor) | ||
868 | { | 900 | { | ||
869 | return name == attributeName(line, column); | 901 | return attributeName(cursor.line(), cursor.column()); | ||
870 | } | 902 | } | ||
871 | 903 | | |||
872 | bool KateScriptDocument::isAttributeName(const KTextEditor::Cursor &cursor, const QString &name) | 904 | bool KateScriptDocument::isAttributeName(int line, int column, const QString &name) | ||
873 | { | 905 | { | ||
874 | return isAttributeName(cursor.line(), cursor.column(), name); | 906 | return name == attributeName(line, column); | ||
875 | } | 907 | } | ||
876 | 908 | | |||
877 | bool KateScriptDocument::isAttributeName(const QJSValue &jscursor, const QString &name) | 909 | bool KateScriptDocument::isAttributeName(const QJSValue &jscursor, const QString &name) | ||
878 | { | 910 | { | ||
879 | KTextEditor::Cursor cursor = cursorFromScriptValue(jscursor); | 911 | KTextEditor::Cursor cursor = cursorFromScriptValue(jscursor); | ||
880 | return isAttributeName(cursor, name); | 912 | return isAttributeName(cursor.line(), cursor.column(), name); | ||
881 | } | 913 | } | ||
882 | 914 | | |||
883 | QString KateScriptDocument::variable(const QString &s) | 915 | QString KateScriptDocument::variable(const QString &s) | ||
Context not available. |