Browse Source

After using the shortcut key to switch comments, move the cursor to the next line. #442

oldj 3 years ago
parent
commit
26437235a3
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/renderer/components/Editor/HostsEditor.tsx

+ 5 - 0
src/renderer/components/Editor/HostsEditor.tsx

@@ -87,6 +87,11 @@ const HostsEditor = (props: Props) => {
   const toggleComment = () => {
     if (is_read_only || !cm_editor) return
     cm_editor.toggleComment()
+
+    // 光标移到下一行
+    let cursor = cm_editor.getCursor()
+    cursor.line += 1
+    cm_editor.setCursor(cursor)
   }
 
   const onGutterClick = (n: number) => {