소스 검색

VimEditingEngine: Add J command to join two lines

Matthew Hall 4 년 전
부모
커밋
180e2469af
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      Userland/Libraries/LibGUI/VimEditingEngine.cpp

+ 10 - 0
Userland/Libraries/LibGUI/VimEditingEngine.cpp

@@ -916,6 +916,16 @@ bool VimEditingEngine::on_key_in_normal_mode(const KeyEvent& event)
             case (KeyCode::Key_RightBrace):
             case (KeyCode::Key_RightBrace):
                 move_to_next_empty_lines_block();
                 move_to_next_empty_lines_block();
                 return true;
                 return true;
+            case (KeyCode::Key_J): {
+                if (m_editor->cursor().line() + 1 >= m_editor->line_count())
+                    return true;
+                move_to_logical_line_end();
+                m_editor->add_code_point(' ');
+                TextPosition next_line = { m_editor->cursor().line() + 1, 0 };
+                m_editor->delete_text_range({ m_editor->cursor(), next_line });
+                move_one_left();
+                return true;
+            }
             default:
             default:
                 break;
                 break;
             }
             }