소스 검색

Align Ctrl+Right behavior with Ctrl+Left

The word navigation logic for Ctrl+Right incorrectly included trailing
delimiters (spaces, punctuation) after the word. This created an
asymmetric and unintuitive experience compared to Ctrl+Left.

This commit adjusts the logic in both TInputLine and TEditor.NextWord
to first skip delimiters and then skip the word itself, ensuring the
cursor stops precisely at the word boundary.
Ivan Sorokin 4 일 전
부모
커밋
9726b4443b
2개의 변경된 파일3개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 3
      packages/fv/src/dialogs.inc
  2. 2 4
      packages/fv/src/editors.inc

+ 1 - 3
packages/fv/src/dialogs.inc

@@ -1987,10 +1987,8 @@ BEGIN
                S := Data Sw_PString_DeRef;
                Len := Length(S);
                I := CurPos;
-               // Skip the word
-               while (I < Len) and not IsDelimiter(S[I+1]) do Inc(I);
-               // Skip trailing delimiters
                while (I < Len) and IsDelimiter(S[I+1]) do Inc(I);
+               while (I < Len) and not IsDelimiter(S[I+1]) do Inc(I);
                CurPos := I;
              end;
            End;

+ 2 - 4
packages/fv/src/editors.inc

@@ -3269,12 +3269,10 @@ end; { TEditor.NextLine }
 
 function TEditor.NextWord (P : Sw_Word) : Sw_Word;
 begin
-  // Skip the rest of the current word
-  while (P < BufLen) and not IsDelimiter(BufChar(P)) do
-    P := NextChar(P);
-  // Skip trailing delimiters
   while (P < BufLen) and IsDelimiter(BufChar(P)) do
     P := NextChar(P);
+  while (P < BufLen) and not IsDelimiter(BufChar(P)) do
+    P := NextChar(P);
   NextWord := P;
 end; { TEditor.NextWord }