OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Add information about cursor row and column positions in the editor area

Open STF-Zero opened this issue 1 year ago • 3 comments

There isn't any information about where my cursor is currently.

Users would feel greater when they are debugging their Python project since python is strict with indentation of code with the help of the reference of the cursor position. This suggestion is largely influenced by the VS Code editor.

Actually I've already solved this problem by modifying [frontend/src/routes/_oh.app._index/code-editor-component.tsx] . Here's how I worked it out :

  1. State management: Use React's useState hook to create a state called cursorPosition that stores the position of the cursor (row and column numbers).
  2. Register events for cursor position changes: In the handleEditorDidMount callback, use Monaco Editor's onDidChangeCursorPosition event to monitor cursor position changes. When the cursor position changes, this code updates the cursorPosition state, storing the row and column numbers of the current cursor.
  3. Cursor Position Display: In the component's JSX return, the cursorPosition state is used to dynamically display the current cursor position.

Here's what my local implementation looks like : implementation

STF-Zero avatar Oct 29 '24 02:10 STF-Zero

Ah this is cool! If you have a change that is working, why not open a PR? I'm sure others would appreciate the improvement. Just need to make sure @rbren and @amanape approve the PR since it's a UI tweak.

mamoodi avatar Oct 29 '24 12:10 mamoodi

Thanks for opening that PR! Seems like just needs a conflict resolution for merging!

mamoodi avatar Nov 01 '24 17:11 mamoodi

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Dec 03 '24 02:12 github-actions[bot]

This issue was closed because it has been stalled for over 30 days with no activity.

github-actions[bot] avatar Dec 10 '24 02:12 github-actions[bot]