Skip to content

Commit

Permalink
Revert "issue/4599-Add cursor position information on the bottom of t…
Browse files Browse the repository at this point in the history
…he editor area" (#5440)
  • Loading branch information
mamoodi authored Dec 6, 2024
1 parent 22292f7 commit e4e3e4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
27 changes: 9 additions & 18 deletions frontend/src/components/features/editor/code-editor-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import { useSaveFile } from "#/hooks/mutation/use-save-file";
interface CodeEditorComponentProps {
onMount: EditorProps["onMount"];
isReadOnly: boolean;
cursorPosition: { line: number; column: number };
}

function CodeEditorComponent({
onMount,
isReadOnly,
cursorPosition,
}: CodeEditorComponentProps) {
const { t } = useTranslation();
const {
Expand Down Expand Up @@ -102,22 +100,15 @@ function CodeEditorComponent({
}

return (
<div className="flex flex-col h-full w-full">
<div className="flex-grow min-h-0 relative">
<Editor
data-testid="code-editor"
path={selectedPath ?? undefined}
defaultValue=""
value={selectedPath ? fileContent : undefined}
onMount={onMount}
onChange={handleEditorChange}
options={{ readOnly: isReadOnly }}
/>
</div>
<div className="p-2 text-neutral-500 flex-shrink-0 absolute bottom-1">
Row: {cursorPosition.line}, Column: {cursorPosition.column}
</div>
</div>
<Editor
data-testid="code-editor"
path={selectedPath ?? undefined}
defaultValue=""
value={selectedPath ? fileContent : undefined}
onMount={onMount}
onChange={handleEditorChange}
options={{ readOnly: isReadOnly }}
/>
);
}

Expand Down
11 changes: 1 addition & 10 deletions frontend/src/routes/_oh.app._index/route.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React from "react";
import { useSelector } from "react-redux";
import { useRouteError } from "react-router";
import { editor } from "monaco-editor";
Expand Down Expand Up @@ -32,7 +32,6 @@ function CodeEditor() {
} = useFiles();

const [fileExplorerIsOpen, setFileExplorerIsOpen] = React.useState(true);
const [cursorPosition, setCursorPosition] = useState({ line: 1, column: 1 });
const editorRef = React.useRef<editor.IStandaloneCodeEditor | null>(null);

const { mutate: saveFile } = useSaveFile();
Expand All @@ -54,13 +53,6 @@ function CodeEditor() {
},
});
monaco.editor.setTheme("oh-dark");

e.onDidChangeCursorPosition((ee) => {
setCursorPosition({
line: ee.position.lineNumber,
column: ee.position.column,
});
});
};

const agentState = useSelector(
Expand Down Expand Up @@ -111,7 +103,6 @@ function CodeEditor() {
<CodeEditorComponent
onMount={handleEditorDidMount}
isReadOnly={!isEditingAllowed}
cursorPosition={cursorPosition}
/>
</div>
</div>
Expand Down

0 comments on commit e4e3e4a

Please sign in to comment.