Преглед на файлове

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 }