MCPcopy Create free account
hub / github.com/continuedev/continue / renderInputText

Function renderInputText

extensions/cli/src/ui/UserInput.tsx:784–862  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

782 });
783
784 const renderInputText = () => {
785 const placeholderText = isRemoteMode
786 ? "Ask anything, / for slash commands, ! for shell mode"
787 : placeholder ||
788 "Ask anything, @ for context, / for slash commands, ! for shell mode";
789 if (inputText.length === 0) {
790 return (
791 <>
792 {(inputMode || isWaitingForResponse) && (
793 <Text italic color="gray">
794 ▋{placeholderText}
795 </Text>
796 )}
797 {!inputMode && !isWaitingForResponse && (
798 <Text italic color="gray">
799 {placeholderText}
800 </Text>
801 )}
802 </>
803 );
804 }
805
806 if (inputMode || isWaitingForResponse) {
807 // Handle multi-line text with cursor
808 const lines = inputText.split("\n");
809 let charCount = 0;
810 let cursorLine = 0;
811 let cursorCol = 0;
812
813 // Find which line and column the cursor is on
814 for (let i = 0; i < lines.length; i++) {
815 if (cursorPosition <= charCount + lines[i].length) {
816 cursorLine = i;
817 cursorCol = cursorPosition - charCount;
818 break;
819 }
820 charCount += lines[i].length + 1; // +1 for the newline character
821 }
822
823 // Handle cursor at the very end
824 if (cursorPosition >= inputText.length) {
825 cursorLine = lines.length - 1;
826 cursorCol = lines[cursorLine].length;
827 }
828
829 return (
830 <Box flexDirection="column">
831 {lines.map((line, lineIndex) => {
832 if (lineIndex === cursorLine) {
833 // Line with cursor
834 const beforeCursor = line.slice(0, cursorCol);
835 const atCursor = line.slice(cursorCol, cursorCol + 1);
836 const afterCursor = line.slice(cursorCol + 1);
837
838 return (
839 <Text key={lineIndex}>
840 {beforeCursor}
841 <Text inverse>{atCursor || " "}</Text>

Callers 1

UserInputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected