aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/vi.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 2aa0ad9dd..bff47250d 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -255,8 +255,8 @@ enum {
255 YANKDEL = TRUE, 255 YANKDEL = TRUE,
256 FORWARD = 1, // code depends on "1" for array index 256 FORWARD = 1, // code depends on "1" for array index
257 BACK = -1, // code depends on "-1" for array index 257 BACK = -1, // code depends on "-1" for array index
258 LIMITED = 0, // how much of text[] in char_search 258 LIMITED = 0, // char_search() only current line
259 FULL = 1, // how much of text[] in char_search 259 FULL = 1, // char_search() to the end/beginning of entire text
260 260
261 S_BEFORE_WS = 1, // used in skip_thing() for moving "dot" 261 S_BEFORE_WS = 1, // used in skip_thing() for moving "dot"
262 S_TO_WS = 2, // used in skip_thing() for moving "dot" 262 S_TO_WS = 2, // used in skip_thing() for moving "dot"
@@ -1914,10 +1914,15 @@ static char *char_search(char *p, const char *pat, int dir, int range)
1914 return p; 1914 return p;
1915 } 1915 }
1916 1916
1917 // assume a LIMITED forward search 1917 q = end - 1; // if FULL
1918 q = end - 1; 1918 if (range == LIMITED)
1919 if (dir == BACK) 1919 q = next_line(p);
1920 if (dir == BACK) {
1920 q = text; 1921 q = text;
1922 if (range == LIMITED)
1923 q = prev_line(p);
1924 }
1925
1921 // RANGE could be negative if we are searching backwards 1926 // RANGE could be negative if we are searching backwards
1922 range = q - p; 1927 range = q - p;
1923 q = p; 1928 q = p;