diff options
Diffstat (limited to 'editors/vi.c')
-rw-r--r-- | editors/vi.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/editors/vi.c b/editors/vi.c index 899fcf57e..065a1068e 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2314,16 +2314,18 @@ static void undo_push(char *src, unsigned int length, uint8_t u_type) // Add to | |||
2314 | } | 2314 | } |
2315 | break; | 2315 | break; |
2316 | case UNDO_INS_QUEUED: | 2316 | case UNDO_INS_QUEUED: |
2317 | if (length != 1) | 2317 | if (length < 1) |
2318 | return; | 2318 | return; |
2319 | switch (undo_queue_state) { | 2319 | switch (undo_queue_state) { |
2320 | case UNDO_EMPTY: | 2320 | case UNDO_EMPTY: |
2321 | undo_queue_state = UNDO_INS; | 2321 | undo_queue_state = UNDO_INS; |
2322 | undo_queue_spos = src; | 2322 | undo_queue_spos = src; |
2323 | case UNDO_INS: | 2323 | case UNDO_INS: |
2324 | undo_q++; // Don't need to save any data for insertions | 2324 | while (length--) { |
2325 | if (undo_q == CONFIG_FEATURE_VI_UNDO_QUEUE_MAX) | 2325 | undo_q++; // Don't need to save any data for insertions |
2326 | undo_queue_commit(); | 2326 | if (undo_q == CONFIG_FEATURE_VI_UNDO_QUEUE_MAX) |
2327 | undo_queue_commit(); | ||
2328 | } | ||
2327 | return; | 2329 | return; |
2328 | case UNDO_DEL: | 2330 | case UNDO_DEL: |
2329 | // Switch from storing deleted text to inserted text | 2331 | // Switch from storing deleted text to inserted text |
@@ -2372,16 +2374,16 @@ static void undo_push(char *src, unsigned int length, uint8_t u_type) // Add to | |||
2372 | static void undo_push_insert(char *p, int len, int undo) | 2374 | static void undo_push_insert(char *p, int len, int undo) |
2373 | { | 2375 | { |
2374 | switch (undo) { | 2376 | switch (undo) { |
2375 | case ALLOW_UNDO: | 2377 | case ALLOW_UNDO: |
2376 | undo_push(p, len, UNDO_INS); | 2378 | undo_push(p, len, UNDO_INS); |
2377 | break; | 2379 | break; |
2378 | case ALLOW_UNDO_CHAIN: | 2380 | case ALLOW_UNDO_CHAIN: |
2379 | undo_push(p, len, UNDO_INS_CHAIN); | 2381 | undo_push(p, len, UNDO_INS_CHAIN); |
2380 | break; | 2382 | break; |
2381 | # if ENABLE_FEATURE_VI_UNDO_QUEUE | 2383 | # if ENABLE_FEATURE_VI_UNDO_QUEUE |
2382 | case ALLOW_UNDO_QUEUED: | 2384 | case ALLOW_UNDO_QUEUED: |
2383 | undo_push(p, len, UNDO_INS_QUEUED); | 2385 | undo_push(p, len, UNDO_INS_QUEUED); |
2384 | break; | 2386 | break; |
2385 | # endif | 2387 | # endif |
2386 | } | 2388 | } |
2387 | } | 2389 | } |