Skip to content

Fix: Windows Multi-line Paste Handling with Debounced Data Processing#627

Merged
pomelo-nwu merged 6 commits into
mainfrom
fix/win-paste-multi-line
Sep 16, 2025
Merged

Fix: Windows Multi-line Paste Handling with Debounced Data Processing#627
pomelo-nwu merged 6 commits into
mainfrom
fix/win-paste-multi-line

Conversation

@tanzhenxin

@tanzhenxin tanzhenxin commented Sep 16, 2025

Copy link
Copy Markdown
Collaborator

🐛 Problem Description

Issue: On Windows terminals, multi-line paste operations were causing accidental command submissions due to Node.js readline losing bracketed paste boundaries.

Root Cause Analysis

  1. Bracketed Paste Protocol: Modern terminals use escape sequences ESC[200~ (start) and ESC[201~ (end) to mark paste boundaries
  2. Windows-Specific Bug: Node's readline keypress stream on Windows often loses these bracketed paste boundaries
  3. Symptom: Multi-line pastes get delivered as individual Return key events instead of a single paste event
  4. User Impact: Users accidentally submit incomplete commands when pressing Enter within pasted multi-line content

Example Scenario

# User pastes this multi-line content:
function example() {
  console.log("hello");  # ← This line triggers accidental submit
  return true;
}

Instead of being treated as a single paste operation, each newline becomes a separate Return keypress, causing the command to submit prematurely.

🔧 Solution Implementation

Core Changes

  1. Platform Detection: Added Windows-specific handling (process.platform === 'win32')
  2. Force Passthrough Mode: Windows now uses raw byte parsing instead of Node's readline keypress stream
  3. Debounced Buffer Processing: Implemented 100ms debounce timer for single Return characters to distinguish between user keypresses and paste fragments
  4. Enhanced Raw Data Parsing: Improved bracketed paste marker detection with proper buffer management

Key Technical Improvements

1. Windows Detection & Passthrough Mode

const isWindows = process.platform === 'win32';
// Force passthrough on Windows to parse raw bytes and detect ESC[200~...201~
if (nodeMajorVersion < 20 || isWindows || process.env['PASTE_WORKAROUND'] === '1') {
  usePassthrough = true;
}

2. Debounced Raw Data Processing

// On Windows terminals, during a paste, the terminal might send a
// single return character chunk. Wait 100ms to determine if it's
// part of a paste or just a return character.
const isReturnChar = rawDataBuffer.length <= 2 && rawDataBuffer.includes(0x0d);
if (isReturnChar) {
  rawFlushTimeout = setTimeout(flushRawBuffer, 100);
} else {
  flushRawBuffer();
}

3. Improved Buffer Management

  • Raw Data Buffering: Accumulate incoming data chunks before processing
  • Marker Detection: Enhanced bracketed paste boundary detection across fragmented data
  • Timeout Cleanup: Proper cleanup of debounce timers to prevent memory leaks

🧪 Testing Strategy

New Test Coverage

  • Fragmented Paste Markers: Tests for paste sequences split across multiple data events
  • Multi-line Content: Validation of newline preservation within paste boundaries
  • Buffer Boundary Handling: Edge cases where markers span buffer boundaries
  • Windows-Specific Scenarios: Platform-specific paste behavior validation
  • Debounce Timer Logic: Verification of 100ms timeout behavior for Return characters

🔍 Validation

Before Fix

  • ❌ Multi-line pastes on Windows caused accidental submissions
  • ❌ Users experienced frustrating UX with incomplete command execution

After Fix

  • ✅ Multi-line pastes are properly detected and handled as single paste events
  • ✅ Maintains backward compatibility with existing paste workaround environment variable

🚀 Deployment Notes

  • No Breaking Changes: All existing functionality preserved
  • Platform-Specific: Only affects Windows behavior, other platforms unchanged

Linked issues / bugs

@github-actions

Copy link
Copy Markdown
Contributor

📋 Review Summary

This PR addresses a critical issue with multi-line paste operations on Windows terminals, where Node.js readline was losing bracketed paste boundaries, causing accidental command submissions. The solution implements platform-specific handling for Windows with debounced buffer processing to correctly distinguish between user keypresses and paste fragments. The changes are well-structured and include comprehensive test coverage.

🔍 General Feedback

  • The implementation correctly identifies and addresses the root cause of the Windows paste issue
  • Good use of platform detection (process.platform === 'win32') to apply fixes only where needed
  • The debounced buffer processing approach with a 100ms timeout is a reasonable solution for distinguishing paste fragments from user keypresses
  • Comprehensive test coverage has been added to validate the new functionality
  • The code follows existing patterns in the codebase and maintains backward compatibility

🎯 Specific Feedback

🟡 High

  • File: packages/cli/src/ui/contexts/KeypressContext.tsx:375 - The 100ms debounce timeout for Return characters is a heuristic value that may need tuning based on user feedback. Some users with different typing speeds or terminal configurations might experience either too much delay or insufficient buffering. Consider making this configurable or adding metrics to understand its effectiveness in real-world usage.

🟢 Medium

  • File: packages/cli/src/ui/contexts/KeypressContext.tsx:353 - The createPasteKeyEvent function has been modified to accept additional parameters, but the type definition was changed from requiring 'paste-start' or 'paste-end' to allowing an empty string. Consider whether this change in type safety is necessary or if there's a better way to handle the new use case while maintaining type safety.
  • File: packages/cli/src/ui/contexts/KeypressContext.tsx:385 - The condition rawDataBuffer.length <= 2 || isPaste for determining when to write directly to the keypress stream might benefit from additional comments explaining the rationale behind the length check.

🔵 Low

  • File: packages/cli/src/ui/contexts/KeypressContext.test.tsx:410 - The comment "The current implementation processes fragmented paste markers as separate events rather than reconstructing them into a single paste event" indicates a limitation in the current approach. Consider adding a TODO to address this in a future enhancement if it's a known issue that should be fixed.
  • File: packages/cli/src/ui/contexts/KeypressContext.tsx:103 - The comment for the Windows-specific fix is very detailed and helpful, but consider moving some of the technical details to a separate documentation file if the comment becomes too long.

✅ Highlights

  • Excellent test coverage added for various paste scenarios including fragmented paste markers, multiline content, and complex sequences with multiple paste blocks
  • Platform-specific handling that only affects Windows behavior while leaving other platforms unchanged
  • Clean implementation that maintains backward compatibility with existing paste workaround environment variables
  • Good use of clearTimeout to prevent memory leaks with the rawFlushTimeout
  • Well-structured code with clear separation of concerns in the buffer flushing logic

@github-actions

github-actions Bot commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

Code Coverage Summary

Package Lines Statements Functions Branches
CLI 67.44% 67.44% 73.1% 80.52%
Core 74.15% 74.15% 76.75% 83.12%
CLI Package - Full Text Report
-------------------|---------|----------|---------|---------|-------------------
File               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------------|---------|----------|---------|---------|-------------------
All files          |   67.44 |    80.52 |    73.1 |   67.44 |                   
 src               |   54.39 |       78 |   66.66 |   54.39 |                   
  gemini.tsx       |    31.4 |    66.66 |      50 |    31.4 | ...59-325,335-352 
  ...ractiveCli.ts |   93.85 |    72.72 |     100 |   93.85 | 34-37,68-70,116   
  ...ActiveAuth.ts |     100 |      100 |     100 |     100 |                   
 src/commands      |   94.11 |      100 |      50 |   94.11 |                   
  mcp.ts           |   94.11 |      100 |      50 |   94.11 | 26                
 src/commands/mcp  |   95.62 |       80 |    90.9 |   95.62 |                   
  add.ts           |    97.4 |    83.33 |     100 |    97.4 | 109-112,119       
  list.ts          |   90.56 |    80.76 |      80 |   90.56 | ...10-112,137-138 
  remove.ts        |     100 |    66.66 |     100 |     100 | 19-23             
 src/config        |   91.66 |    81.37 |   81.81 |   91.66 |                   
  auth.ts          |   79.16 |    90.47 |      25 |   79.16 | ...60,63-64,67-68 
  config.ts        |   96.53 |    87.09 |      70 |   96.53 | ...86,466,647-651 
  extension.ts     |   78.35 |    84.37 |     100 |   78.35 | ...07-111,120-121 
  keyBindings.ts   |     100 |      100 |     100 |     100 |                   
  sandboxConfig.ts |   51.35 |    16.66 |   66.66 |   51.35 | ...43,53-69,74-91 
  settings.ts      |   84.28 |       80 |   93.75 |   84.28 | ...93-394,467-468 
  ...ingsSchema.ts |     100 |      100 |     100 |     100 |                   
  ...tedFolders.ts |   90.67 |    76.92 |     100 |   90.67 | ...20,125-130,148 
 src/generated     |     100 |      100 |     100 |     100 |                   
  git-commit.ts    |     100 |      100 |     100 |     100 |                   
 src/patches       |       0 |        0 |       0 |       0 |                   
  is-in-ci.ts      |       0 |        0 |       0 |       0 | 1-17              
 src/services      |   61.99 |    88.13 |   72.22 |   61.99 |                   
  ...mandLoader.ts |     100 |      100 |     100 |     100 |                   
  ...andService.ts |     100 |      100 |     100 |     100 |                   
  ...mandLoader.ts |   92.17 |    91.89 |     100 |   92.17 | 173-178,252-259   
  ...omptLoader.ts |    9.39 |    57.14 |   33.33 |    9.39 | ...44-167,173-230 
  types.ts         |       0 |        0 |       0 |       0 | 1                 
 ...mpt-processors |   97.56 |    94.11 |     100 |   97.56 |                   
  ...tProcessor.ts |     100 |      100 |     100 |     100 |                   
  ...lProcessor.ts |   97.36 |    93.61 |     100 |   97.36 | 77-78,202-203     
  types.ts         |     100 |      100 |     100 |     100 |                   
 src/test-utils    |    91.3 |    83.33 |      80 |    91.3 |                   
  ...omMatchers.ts |   69.69 |       50 |      50 |   69.69 | 31-34,36-38,44-46 
  ...andContext.ts |     100 |      100 |     100 |     100 |                   
  render.tsx       |     100 |      100 |     100 |     100 |                   
 src/ui            |   58.56 |    69.87 |   58.53 |   58.56 |                   
  App.tsx          |   57.34 |    59.64 |   31.25 |   57.34 | ...1374,1400-1429 
  ...tionNudge.tsx |    8.33 |      100 |       0 |    8.33 | 26-98             
  colors.ts        |   79.59 |      100 |   66.66 |   79.59 | ...43,45-46,48-49 
  constants.ts     |     100 |      100 |     100 |     100 |                   
  keyMatchers.ts   |   95.65 |    95.65 |     100 |   95.65 | 29-30             
  ...tic-colors.ts |     100 |      100 |     100 |     100 |                   
  types.ts         |     100 |      100 |     100 |     100 |                   
 src/ui/commands   |   77.06 |    82.21 |   78.46 |   77.06 |                   
  aboutCommand.ts  |     100 |       60 |     100 |     100 | 23-30             
  agentsCommand.ts |   77.77 |      100 |       0 |   77.77 | 19-21,28-30       
  authCommand.ts   |     100 |      100 |     100 |     100 |                   
  bugCommand.ts    |   79.72 |     37.5 |     100 |   79.72 | 33-36,43,81-90    
  chatCommand.ts   |   94.21 |    83.33 |     100 |   94.21 | ...09-210,212-213 
  clearCommand.ts  |     100 |      100 |     100 |     100 |                   
  ...essCommand.ts |     100 |    88.88 |     100 |     100 | 69                
  copyCommand.ts   |     100 |      100 |     100 |     100 |                   
  corgiCommand.ts  |     100 |      100 |     100 |     100 |                   
  ...ryCommand.tsx |   71.77 |    73.07 |     100 |   71.77 | ...20-121,157-165 
  docsCommand.ts   |     100 |      100 |     100 |     100 |                   
  editorCommand.ts |     100 |      100 |     100 |     100 |                   
  ...onsCommand.ts |     100 |      100 |     100 |     100 |                   
  helpCommand.ts   |     100 |      100 |     100 |     100 |                   
  ideCommand.ts    |    62.6 |    66.66 |      60 |    62.6 | ...38-248,256-266 
  initCommand.ts   |   81.15 |    66.66 |     100 |   81.15 | 50,64-69,71-76    
  mcpCommand.ts    |   82.33 |    82.95 |   83.33 |   82.33 | ...84-385,438-445 
  memoryCommand.ts |   60.74 |    92.59 |   42.85 |   60.74 | ...15,222-243,267 
  ...acyCommand.ts |     100 |      100 |     100 |     100 |                   
  quitCommand.ts   |   64.81 |      100 |      50 |   64.81 | 15-34             
  ...oreCommand.ts |   93.79 |    91.42 |     100 |   93.79 | 54-55,84-89       
  ...ngsCommand.ts |     100 |      100 |     100 |     100 |                   
  ...hubCommand.ts |   83.66 |    66.66 |     100 |   83.66 | ...57-160,163-166 
  statsCommand.ts  |   84.48 |       75 |     100 |   84.48 | 24-32             
  ...aryCommand.ts |    8.33 |      100 |       0 |    8.33 | 23-188            
  ...tupCommand.ts |     100 |      100 |     100 |     100 |                   
  themeCommand.ts  |     100 |      100 |     100 |     100 |                   
  toolsCommand.ts  |     100 |      100 |     100 |     100 |                   
  types.ts         |     100 |      100 |     100 |     100 |                   
  vimCommand.ts    |   44.44 |      100 |       0 |   44.44 | 14-24             
 src/ui/components |   62.27 |    82.13 |   63.63 |   62.27 |                   
  AboutBox.tsx     |     100 |       50 |     100 |     100 | 104               
  AsciiArt.ts      |     100 |      100 |     100 |     100 |                   
  AuthDialog.tsx   |   71.23 |       85 |      50 |   71.23 | ...25-129,137-143 
  ...nProgress.tsx |   16.66 |      100 |       0 |   16.66 | 18-62             
  ...Indicator.tsx |   15.15 |      100 |       0 |   15.15 | 17-47             
  ...ryDisplay.tsx |   89.47 |    33.33 |     100 |   89.47 | 20-21             
  ...ryDisplay.tsx |   92.04 |    94.44 |     100 |   92.04 | 82-87,92          
  ...geDisplay.tsx |     100 |      100 |     100 |     100 |                   
  ...gProfiler.tsx |      24 |      100 |       0 |      24 | 13-36             
  ...esDisplay.tsx |   10.52 |      100 |       0 |   10.52 | 24-82             
  ...ngsDialog.tsx |    7.29 |      100 |       0 |    7.29 | 27-172            
  ...ustDialog.tsx |     100 |      100 |     100 |     100 |                   
  Footer.tsx       |   84.82 |    82.35 |     100 |   84.82 | ...,89-91,136-143 
  ...ngSpinner.tsx |   86.66 |       75 |     100 |   86.66 | 31-32             
  Header.tsx       |   87.23 |    57.14 |     100 |   87.23 | 36-39,55,64       
  Help.tsx         |    3.27 |      100 |       0 |    3.27 | 17-173            
  ...emDisplay.tsx |   70.66 |       50 |     100 |   70.66 | ...65,86,89-96,99 
  InputPrompt.tsx  |   88.84 |    82.19 |     100 |   88.84 | ...98-500,601-605 
  ...Indicator.tsx |     100 |      100 |     100 |     100 |                   
  ...geDisplay.tsx |   25.92 |      100 |       0 |   25.92 | 14-36             
  ...tsDisplay.tsx |     100 |      100 |     100 |     100 |                   
  ...KeyPrompt.tsx |   62.33 |    31.25 |     100 |   62.33 | ...58-111,115-123 
  PrepareLabel.tsx |      60 |       80 |     100 |      60 | 35-48             
  ...ionDialog.tsx |   20.75 |      100 |       0 |   20.75 | 28-74             
  ...hProgress.tsx |     100 |      100 |     100 |     100 |                   
  ...ryDisplay.tsx |     100 |      100 |     100 |     100 |                   
  ...ngsDialog.tsx |   31.75 |     62.5 |      25 |   31.75 | ...66-667,745-748 
  ...ionDialog.tsx |    85.5 |      100 |   33.33 |    85.5 | 37-40,45-52       
  ...Indicator.tsx |   44.44 |      100 |       0 |   44.44 | 12-17             
  ...MoreLines.tsx |      60 |       25 |     100 |      60 | 24-27,33-40       
  StatsDisplay.tsx |    98.5 |    93.33 |     100 |    98.5 | 177-179           
  ...nsDisplay.tsx |   88.05 |    71.42 |     100 |   88.05 | 36-41,96-98       
  ThemeDialog.tsx  |    5.33 |      100 |       0 |    5.33 | 34-310            
  Tips.tsx         |      16 |      100 |       0 |      16 | 17-45             
  TodoDisplay.tsx  |     100 |      100 |     100 |     100 |                   
  ...tsDisplay.tsx |     100 |     87.5 |     100 |     100 | 30-31             
  ...ification.tsx |   36.36 |      100 |       0 |   36.36 | 15-22             
  ...ackDialog.tsx |    6.89 |      100 |       0 |    6.89 | 23-123            
 ...nents/messages |   63.83 |    81.75 |   59.25 |   63.83 |                   
  ...onMessage.tsx |   18.51 |      100 |       0 |   18.51 | 22-49             
  DiffRenderer.tsx |   96.41 |    83.14 |     100 |   96.41 | ...17-218,222,284 
  ErrorMessage.tsx |     100 |      100 |     100 |     100 |                   
  ...niMessage.tsx |   18.51 |      100 |       0 |   18.51 | 20-43             
  ...geContent.tsx |   19.04 |      100 |       0 |   19.04 | 25-43             
  InfoMessage.tsx  |    90.9 |       50 |     100 |    90.9 | 19-20             
  ...ryMessage.tsx |   12.82 |      100 |       0 |   12.82 | 22-59             
  ...onMessage.tsx |   37.55 |     62.5 |      20 |   37.55 | ...65-200,244-272 
  ...upMessage.tsx |      10 |      100 |       0 |      10 | 27-127            
  ToolMessage.tsx  |   87.33 |    81.39 |   88.88 |   87.33 | ...00,223,311-313 
  UserMessage.tsx  |     100 |      100 |     100 |     100 |                   
  ...llMessage.tsx |   36.36 |      100 |       0 |   36.36 | 17-25             
 ...ponents/shared |    76.6 |     76.6 |   93.33 |    76.6 |                   
  MaxSizedBox.tsx  |   81.14 |     82.2 |   88.88 |   81.14 | ...08-509,614-615 
  ...tonSelect.tsx |   75.65 |    71.05 |     100 |   75.65 | ...98,121-157,226 
  TextInput.tsx    |    7.94 |      100 |       0 |    7.94 | 32-194            
  text-buffer.ts   |   78.02 |    78.08 |   96.77 |   78.02 | ...1841,1868,1918 
  ...er-actions.ts |   86.71 |    67.79 |     100 |   86.71 | ...08-609,810-812 
 ...ents/subagents |   31.87 |      100 |       0 |   31.87 |                   
  constants.ts     |     100 |      100 |     100 |     100 |                   
  index.ts         |     100 |      100 |     100 |     100 |                   
  reducers.tsx     |   11.53 |      100 |       0 |   11.53 | 33-190            
  types.ts         |     100 |      100 |     100 |     100 |                   
  utils.ts         |   10.95 |      100 |       0 |   10.95 | ...1,56-57,60-102 
 ...bagents/create |    8.52 |      100 |       0 |    8.52 |                   
  ...ionWizard.tsx |    6.25 |      100 |       0 |    6.25 | 33-313            
  ...rSelector.tsx |   13.55 |      100 |       0 |   13.55 | 26-84             
  ...onSummary.tsx |    3.03 |      100 |       0 |    3.03 | 19-303            
  ...tionInput.tsx |    9.09 |      100 |       0 |    9.09 | 23-173            
  ...dSelector.tsx |   35.89 |      100 |       0 |   35.89 | 31-57             
  ...nSelector.tsx |   41.17 |      100 |       0 |   41.17 | 31-52             
  ...EntryStep.tsx |   12.76 |      100 |       0 |   12.76 | 34-78             
  ToolSelector.tsx |    3.74 |      100 |       0 |    3.74 | 30-249            
 ...bagents/manage |    8.34 |      100 |       0 |    8.34 |                   
  ...ctionStep.tsx |      12 |      100 |       0 |      12 | 20-74             
  ...eleteStep.tsx |   13.51 |      100 |       0 |   13.51 | 19-57             
  ...tEditStep.tsx |   27.84 |      100 |       0 |   27.84 | 44-111            
  ...ctionStep.tsx |    2.84 |      100 |       0 |    2.84 | 27-329            
  ...iewerStep.tsx |   11.36 |      100 |       0 |   11.36 | 17-65             
  ...gerDialog.tsx |     5.7 |      100 |       0 |     5.7 | 31-337            
 ...agents/runtime |    9.74 |      100 |       0 |    9.74 |                   
  ...onDisplay.tsx |    9.74 |      100 |       0 |    9.74 | ...82-412,421-459 
 src/ui/contexts   |   82.24 |    82.48 |     100 |   82.24 |                   
  ...ssContext.tsx |      80 |    84.11 |     100 |      80 | ...73-475,478-480 
  ...owContext.tsx |   91.07 |    81.81 |     100 |   91.07 | 46-47,59-61       
  ...onContext.tsx |    94.2 |      100 |     100 |    94.2 | 106-109           
  ...gsContext.tsx |   83.33 |       50 |     100 |   83.33 | 17-18             
  ...ngContext.tsx |   71.42 |       50 |     100 |   71.42 | 17-20             
  ...deContext.tsx |   76.08 |       50 |     100 |   76.08 | 46-47,51-58,76-77 
 src/ui/editors    |   93.18 |    85.71 |   66.66 |   93.18 |                   
  ...ngsManager.ts |   93.18 |    85.71 |   66.66 |   93.18 | 48,62-63          
 src/ui/hooks      |   79.74 |    81.68 |   86.58 |   79.74 |                   
  ...dProcessor.ts |   78.28 |       79 |     100 |   78.28 | ...52-455,466-484 
  ...dProcessor.ts |   96.32 |    76.31 |     100 |   96.32 | ...13-214,219-220 
  ...dProcessor.ts |   71.87 |    68.81 |    62.5 |   71.87 | ...30-499,555-583 
  ...agerDialog.ts |   88.23 |      100 |     100 |   88.23 | 20,24             
  ...Completion.ts |   92.69 |    89.09 |     100 |   92.69 | ...89-190,223-226 
  ...uthCommand.ts |    7.46 |      100 |       0 |    7.46 | 18-92             
  ...tIndicator.ts |     100 |      100 |     100 |     100 |                   
  ...ketedPaste.ts |     100 |      100 |     100 |     100 |                   
  ...ompletion.tsx |   94.73 |    81.81 |     100 |   94.73 | ...98-199,201-202 
  useCompletion.ts |    92.4 |     87.5 |     100 |    92.4 | ...,95-96,100-101 
  ...leMessages.ts |   98.68 |       95 |     100 |   98.68 | 55                
  ...ialogClose.ts |   21.05 |      100 |     100 |   21.05 | 58-108            
  ...orSettings.ts |     100 |      100 |     100 |     100 |                   
  useFocus.ts      |     100 |      100 |     100 |     100 |                   
  ...olderTrust.ts |     100 |      100 |     100 |     100 |                   
  ...miniStream.ts |   74.55 |    72.54 |     100 |   74.55 | ...3-884,914-1004 
  ...BranchName.ts |   91.66 |    84.61 |     100 |   91.66 | 57-63             
  ...oryManager.ts |   98.41 |    93.33 |     100 |   98.41 | 43                
  ...putHistory.ts |    92.5 |    85.71 |     100 |    92.5 | 62-63,71,93-95    
  useKeypress.ts   |     100 |      100 |     100 |     100 |                   
  ...rdProtocol.ts |     100 |      100 |     100 |     100 |                   
  ...unchEditor.ts |   11.53 |      100 |       0 |   11.53 | 16-30,37-82       
  ...gIndicator.ts |     100 |      100 |     100 |     100 |                   
  useLogger.ts     |      25 |      100 |       0 |      25 | 14-32             
  ...ssageQueue.ts |     100 |      100 |     100 |     100 |                   
  ...raseCycler.ts |   95.45 |       75 |     100 |   95.45 | ...64-165,183-185 
  ...cySettings.ts |   85.08 |       75 |     100 |   85.08 | ...15-116,127-138 
  ...nfirmation.ts |   55.55 |      100 |     100 |   55.55 | 14,18-31          
  useQwenAuth.ts   |     100 |      100 |     100 |     100 |                   
  ...lScheduler.ts |   78.92 |    94.44 |     100 |   78.92 | ...01-204,290-300 
  ...oryCommand.ts |       0 |        0 |       0 |       0 | 1-7               
  ...ompletion.tsx |     100 |     92.3 |     100 |     100 | 77                
  ...ngsCommand.ts |    87.5 |      100 |     100 |    87.5 | 13,17             
  ...ellHistory.ts |   91.26 |       80 |     100 |   91.26 | ...67,112-113,123 
  ...oryCommand.ts |       0 |        0 |       0 |       0 | 1-75              
  ...Completion.ts |      94 |    92.53 |     100 |      94 | 58-61,69-72,93    
  ...tateAndRef.ts |   13.63 |      100 |       0 |   13.63 | 16-36             
  ...eateDialog.ts |   88.23 |      100 |     100 |   88.23 | 14,18             
  ...rminalSize.ts |   18.18 |      100 |       0 |   18.18 | 12-32             
  ...emeCommand.ts |   46.98 |       75 |     100 |   46.98 | ...4,70-71,77-100 
  useTimer.ts      |   88.09 |    85.71 |     100 |   88.09 | 44-45,51-53       
  ...elcomeBack.ts |   69.01 |    44.44 |     100 |   69.01 | ...85,89-90,96-98 
  vim.ts           |   83.57 |     79.5 |     100 |   83.57 | ...38,742-750,759 
 src/ui/privacy    |   14.52 |      100 |       0 |   14.52 |                   
  ...acyNotice.tsx |   10.38 |      100 |       0 |   10.38 | 21-117            
  ...acyNotice.tsx |   14.28 |      100 |       0 |   14.28 | 16-59             
  ...acyNotice.tsx |   12.19 |      100 |       0 |   12.19 | 16-62             
  ...acyNotice.tsx |   30.76 |      100 |       0 |   30.76 | 19-36,39-41       
 src/ui/themes     |   99.52 |    66.35 |     100 |   99.52 |                   
  ansi-light.ts    |     100 |      100 |     100 |     100 |                   
  ansi.ts          |     100 |      100 |     100 |     100 |                   
  atom-one-dark.ts |     100 |      100 |     100 |     100 |                   
  ayu-light.ts     |     100 |      100 |     100 |     100 |                   
  ayu.ts           |     100 |      100 |     100 |     100 |                   
  color-utils.ts   |     100 |      100 |     100 |     100 |                   
  default-light.ts |     100 |      100 |     100 |     100 |                   
  default.ts       |     100 |      100 |     100 |     100 |                   
  dracula.ts       |     100 |      100 |     100 |     100 |                   
  github-dark.ts   |     100 |      100 |     100 |     100 |                   
  github-light.ts  |     100 |      100 |     100 |     100 |                   
  googlecode.ts    |     100 |      100 |     100 |     100 |                   
  no-color.ts      |     100 |      100 |     100 |     100 |                   
  qwen-dark.ts     |     100 |      100 |     100 |     100 |                   
  qwen-light.ts    |     100 |      100 |     100 |     100 |                   
  ...tic-tokens.ts |     100 |      100 |     100 |     100 |                   
  ...-of-purple.ts |     100 |      100 |     100 |     100 |                   
  theme-manager.ts |   91.66 |    79.54 |     100 |   91.66 | ...03,207,234-235 
  theme.ts         |     100 |     41.3 |     100 |     100 | 225-240           
  xcode.ts         |     100 |      100 |     100 |     100 |                   
 src/ui/utils      |   65.14 |    79.59 |   81.96 |   65.14 |                   
  ...Colorizer.tsx |   79.31 |    83.87 |     100 |   79.31 | ...51-154,190-216 
  ...olePatcher.ts |      96 |       75 |     100 |      96 | 59-60             
  ...nRenderer.tsx |   52.85 |    27.27 |     100 |   52.85 | ...26-132,142-144 
  ...wnDisplay.tsx |   85.84 |    87.69 |     100 |   85.84 | ...72-280,313-336 
  ...eRenderer.tsx |   78.09 |    76.19 |     100 |   78.09 | 55-83             
  ...boardUtils.ts |   32.25 |     37.5 |     100 |   32.25 | ...55-114,129-145 
  commandUtils.ts  |   97.36 |     92.3 |     100 |   97.36 | 68,72             
  computeStats.ts  |     100 |      100 |     100 |     100 |                   
  displayUtils.ts  |     100 |      100 |     100 |     100 |                   
  formatters.ts    |   90.47 |    95.83 |     100 |   90.47 | 57-60             
  isNarrowWidth.ts |     100 |      100 |     100 |     100 |                   
  ...olDetector.ts |   13.88 |      100 |      50 |   13.88 | 16-97             
  ...nUtilities.ts |   69.84 |    85.71 |     100 |   69.84 | 75-91,100-101     
  ...mConstants.ts |     100 |      100 |     100 |     100 |                   
  terminalSetup.ts |       4 |      100 |       0 |       4 | 40-342            
  textUtils.ts     |   88.88 |    83.33 |     100 |   88.88 | 14-15             
  updateCheck.ts   |     100 |    80.95 |     100 |     100 | 26-38             
 src/utils         |   44.66 |    90.99 |   84.21 |   44.66 |                   
  checks.ts        |   33.33 |      100 |       0 |   33.33 | 23-28             
  cleanup.ts       |      96 |    85.71 |     100 |      96 | 35                
  ...ScopeUtils.ts |   97.67 |     87.5 |     100 |   97.67 | 62                
  events.ts        |     100 |      100 |     100 |     100 |                   
  gitUtils.ts      |   94.66 |    82.35 |     100 |   94.66 | 75-78             
  ...AutoUpdate.ts |   81.14 |    95.23 |   66.66 |   81.14 | 85-99,125-132     
  ...lationInfo.ts |     100 |      100 |     100 |     100 |                   
  package.ts       |   88.88 |       80 |     100 |   88.88 | 33-34             
  readStdin.ts     |    2.43 |      100 |       0 |    2.43 | 7-51              
  resolvePath.ts   |   66.66 |       25 |     100 |   66.66 | 12-13,16,18-19    
  sandbox.ts       |       0 |        0 |       0 |       0 | 1-962             
  settingsUtils.ts |   80.52 |     92.3 |   93.33 |   80.52 | ...74-416,455-456 
  spawnWrapper.ts  |     100 |      100 |     100 |     100 |                   
  ...upWarnings.ts |   23.07 |      100 |       0 |   23.07 | 14-40             
  ...entEmitter.ts |     100 |      100 |     100 |     100 |                   
  ...upWarnings.ts |     100 |      100 |     100 |     100 |                   
  version.ts       |     100 |       50 |     100 |     100 | 11                
 ...ed-integration |   24.81 |        0 |       0 |   24.81 |                   
  acp.ts           |    2.89 |        0 |       0 |    2.89 | ...52-288,291-338 
  ...temService.ts |   19.35 |      100 |       0 |   19.35 | 15-19,22-34,37-46 
  schema.ts        |     100 |      100 |     100 |     100 |                   
  ...ntegration.ts |    3.09 |        0 |       0 |    3.09 | ...07-879,894-944 
-------------------|---------|----------|---------|---------|-------------------
Core Package - Full Text Report
-------------------|---------|----------|---------|---------|-------------------
File               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------------|---------|----------|---------|---------|-------------------
All files          |   74.15 |    83.12 |   76.75 |   74.15 |                   
 src               |     100 |      100 |     100 |     100 |                   
  index.ts         |     100 |      100 |     100 |     100 |                   
 src/__mocks__/fs  |     100 |      100 |     100 |     100 |                   
  promises.ts      |     100 |      100 |     100 |     100 |                   
 src/code_assist   |   73.91 |    77.58 |    75.6 |   73.91 |                   
  codeAssist.ts    |   18.51 |      100 |       0 |   18.51 | 13-35             
  converter.ts     |   89.31 |    96.15 |   81.81 |   89.31 | 179-183,202-212   
  oauth2.ts        |   79.02 |    67.24 |    92.3 |   79.02 | ...46-452,459-460 
  server.ts        |   50.29 |       80 |   53.84 |   50.29 | ...73-214,217-220 
  setup.ts         |   86.66 |    78.94 |     100 |   86.66 | ...,92-94,118-124 
  types.ts         |     100 |      100 |     100 |     100 |                   
 src/config        |   74.79 |    84.69 |   45.36 |   74.79 |                   
  config.ts        |    74.5 |    84.69 |   45.36 |    74.5 | ...04-905,926-927 
  models.ts        |     100 |      100 |     100 |     100 |                   
 src/core          |   79.45 |    77.84 |      80 |   79.45 |                   
  client.ts        |    79.8 |    79.75 |      75 |    79.8 | ...5,948,955-1004 
  ...tGenerator.ts |   70.42 |    72.41 |     100 |   70.42 | ...51,185,205-244 
  ...lScheduler.ts |   77.36 |    81.88 |    91.3 |   77.36 | ...78-888,965-969 
  geminiChat.ts    |   70.32 |     82.6 |   61.29 |   70.32 | ...66-767,770-771 
  geminiRequest.ts |     100 |      100 |     100 |     100 |                   
  logger.ts        |   82.84 |    81.81 |     100 |   82.84 | ...41-345,385-396 
  ...tGenerator.ts |   16.32 |      100 |      20 |   16.32 | ...52-181,184-185 
  ...olExecutor.ts |      90 |    70.83 |     100 |      90 | ...,87-96,114,150 
  ...tGenerator.ts |   87.41 |    72.08 |     100 |   87.41 | ...1704,1707,1709 
  prompts.ts       |   90.55 |    82.81 |   66.66 |   90.55 | ...30-587,595-617 
  tokenLimits.ts   |     100 |    77.77 |     100 |     100 | 29-30             
  turn.ts          |   83.68 |    83.33 |     100 |   83.68 | ...68-271,284-285 
 ...ntentGenerator |   48.64 |    92.92 |   63.07 |   48.64 |                   
  constants.ts     |     100 |      100 |     100 |     100 |                   
  converter.ts     |    4.61 |      100 |   13.63 |    4.61 | ...0-985,991-1041 
  errorHandler.ts  |     100 |      100 |     100 |     100 |                   
  index.ts         |       0 |        0 |       0 |       0 | 1-83              
  ...tGenerator.ts |      47 |      100 |      50 |      47 | ...1,64-68,97-150 
  pipeline.ts      |   98.48 |    93.75 |     100 |   98.48 | 236-237,305-306   
  ...CallParser.ts |   90.14 |    86.66 |     100 |   90.14 | ...15-319,349-350 
  ...tryService.ts |   98.75 |    95.23 |     100 |   98.75 | 153-154           
 ...rator/provider |   98.79 |    96.29 |   95.83 |   98.79 |                   
  dashscope.ts     |     100 |    97.61 |     100 |     100 | 84                
  default.ts       |     100 |      100 |     100 |     100 |                   
  index.ts         |       0 |        0 |       0 |       0 | 1-3               
  openrouter.ts    |     100 |      100 |     100 |     100 |                   
  types.ts         |       0 |        0 |       0 |       0 |                   
 src/generated     |     100 |      100 |     100 |     100 |                   
  git-commit.ts    |     100 |      100 |     100 |     100 |                   
 src/ide           |   39.11 |    89.06 |   41.46 |   39.11 |                   
  constants.ts     |     100 |      100 |     100 |     100 |                   
  detect-ide.ts    |   49.35 |      100 |      50 |   49.35 | 23-62             
  ide-client.ts    |   26.84 |    92.85 |   20.83 |   26.84 | ...18-449,452-456 
  ide-installer.ts |   56.73 |     62.5 |     100 |   56.73 | ...,90-91,113-125 
  ideContext.ts    |   83.65 |      100 |     100 |   83.65 | 74-90             
  process-utils.ts |     7.6 |      100 |       0 |     7.6 | 22-157            
 src/mcp           |   73.99 |    67.08 |   81.57 |   73.99 |                   
  ...h-provider.ts |   86.36 |      100 |   33.33 |   86.36 | ...85,89,93,97-98 
  ...h-provider.ts |   74.19 |    51.64 |     100 |   74.19 | ...04-808,815-817 
  ...en-storage.ts |     100 |      100 |     100 |     100 |                   
  oauth-utils.ts   |   54.72 |    69.23 |      90 |   54.72 | ...16-240,265-314 
 src/mocks         |     100 |      100 |     100 |     100 |                   
  msw.ts           |     100 |      100 |     100 |     100 |                   
 src/prompts       |   26.41 |      100 |      25 |   26.41 |                   
  mcp-prompts.ts   |   18.18 |      100 |       0 |   18.18 | 11-19             
  ...t-registry.ts |   28.57 |      100 |   28.57 |   28.57 | ...42,48-55,68-73 
 src/qwen          |   86.62 |    80.33 |   97.05 |   86.62 |                   
  ...tGenerator.ts |   98.64 |    98.21 |     100 |   98.64 | 106-107           
  qwenOAuth2.ts    |   85.87 |    76.06 |    92.3 |   85.87 | ...69,799-810,849 
  ...kenManager.ts |   83.96 |    76.22 |     100 |   83.96 | ...40-745,766-771 
 src/services      |   89.12 |    86.95 |   91.52 |   89.12 |                   
  ...ingService.ts |   76.15 |     61.9 |     100 |   76.15 | ...03-405,429-431 
  ...eryService.ts |   93.33 |    88.46 |   85.71 |   93.33 | 31,39,84,109-110  
  ...temService.ts |     100 |      100 |     100 |     100 |                   
  gitService.ts    |   77.52 |      100 |      60 |   77.52 | ...08-112,115-119 
  ...ionService.ts |   99.23 |     97.1 |     100 |   99.23 | 288-289           
  ...ionService.ts |   92.19 |    88.15 |     100 |   92.19 | ...67-368,444-458 
 src/subagents     |   86.15 |    80.88 |   83.56 |   86.15 |                   
  ...tin-agents.ts |     100 |      100 |     100 |     100 |                   
  index.ts         |     100 |      100 |     100 |     100 |                   
  ...ent-events.ts |   83.33 |      100 |      50 |   83.33 | 124-125,128-129   
  ...gent-hooks.ts |       0 |        0 |       0 |       0 | 1                 
  ...nt-manager.ts |   85.65 |     82.4 |   94.73 |   85.65 | ...53,662,755-756 
  ...statistics.ts |   97.97 |    82.92 |     100 |   97.97 | 111,131,168,201   
  subagent.ts      |   79.03 |     64.1 |      68 |   79.03 | ...62-863,869-870 
  types.ts         |     100 |      100 |     100 |     100 |                   
  validation.ts    |    92.4 |    96.59 |     100 |    92.4 | 55-60,64-69,73-78 
 src/telemetry     |    65.7 |    85.47 |   72.52 |    65.7 |                   
  constants.ts     |     100 |      100 |     100 |     100 |                   
  ...-exporters.ts |   26.47 |      100 |       0 |   26.47 | ...80,83-84,87-88 
  index.ts         |     100 |      100 |     100 |     100 |                   
  ...t.circular.ts |       0 |        0 |       0 |       0 | 1-111             
  ...t.circular.ts |       0 |        0 |       0 |       0 | 1-125             
  loggers.ts       |   55.68 |       75 |   57.89 |   55.68 | ...90-509,518-537 
  metrics.ts       |   62.29 |    96.66 |   46.15 |   62.29 | ...87-289,295-313 
  sdk.ts           |   78.08 |    47.05 |     100 |   78.08 | ...82,186-187,189 
  ...l-decision.ts |     100 |      100 |     100 |     100 |                   
  types.ts         |   91.21 |    91.04 |   94.28 |   91.21 | ...14-325,352-361 
  uiTelemetry.ts   |    99.3 |       96 |     100 |    99.3 | 126               
 ...learcut-logger |   42.77 |    63.82 |    37.5 |   42.77 |                   
  ...cut-logger.ts |   35.58 |    63.04 |    37.5 |   35.58 | ...46-847,850-853 
  ...tadata-key.ts |     100 |      100 |     100 |     100 |                   
 ...ry/qwen-logger |   71.91 |    82.81 |   73.68 |   71.91 |                   
  event-types.ts   |       0 |        0 |       0 |       0 |                   
  qwen-logger.ts   |   71.91 |    82.53 |   72.97 |   71.91 | ...71-676,718-719 
 src/test-utils    |   88.75 |    95.45 |   80.95 |   88.75 |                   
  config.ts        |     100 |      100 |     100 |     100 |                   
  ...aceContext.ts |     100 |      100 |     100 |     100 |                   
  tools.ts         |   85.12 |    94.44 |   78.94 |   85.12 | ...59,127,131-132 
 src/tools         |   70.14 |    82.27 |   79.26 |   70.14 |                   
  diffOptions.ts   |     100 |      100 |     100 |     100 |                   
  edit.ts          |   81.18 |    84.81 |   85.71 |   81.18 | ...13-414,504-547 
  glob.ts          |   85.77 |    78.26 |    87.5 |   85.77 | ...34-241,312-313 
  grep.ts          |    61.4 |    80.64 |   78.57 |    61.4 | ...45-649,659-660 
  ls.ts            |   97.66 |    91.66 |     100 |   97.66 | 135-139           
  ...nt-manager.ts |   79.74 |    83.33 |      80 |   79.74 | ...98-105,113-114 
  mcp-client.ts    |   30.93 |    77.77 |   48.38 |   30.93 | ...1341,1345-1348 
  mcp-tool.ts      |   93.82 |    92.75 |   88.23 |   93.82 | ...85-195,257-258 
  memoryTool.ts    |   75.59 |    84.37 |   90.47 |   75.59 | ...38-349,483-567 
  ...iable-tool.ts |     100 |    84.61 |     100 |     100 | 94,101            
  read-file.ts     |      97 |       95 |    87.5 |      97 | 69-70,110-112     
  ...many-files.ts |   79.61 |    72.13 |   83.33 |   79.61 | ...19-520,527-528 
  shell.ts         |   87.78 |     78.4 |     100 |   87.78 | ...55-456,467-468 
  task.ts          |   65.85 |    86.27 |     100 |   65.85 | ...95-496,517-524 
  todoWrite.ts     |   78.21 |    79.48 |   71.42 |   78.21 | ...74-399,420-421 
  tool-error.ts    |     100 |      100 |     100 |     100 |                   
  tool-registry.ts |   49.24 |    66.66 |   57.14 |   49.24 | ...02-404,427-435 
  tools.ts         |   87.81 |    88.09 |      80 |   87.81 | ...58-359,375-381 
  web-fetch.ts     |    49.4 |    69.23 |      70 |    49.4 | ...23-224,226-227 
  web-search.ts    |   90.16 |    82.14 |     100 |   90.16 | 68-74,93-97       
  write-file.ts    |   82.27 |    79.68 |      75 |   82.27 | ...48-451,463-499 
 src/utils         |   83.33 |    88.21 |    88.5 |   83.33 |                   
  LruCache.ts      |   70.96 |     62.5 |     100 |   70.96 | 20-22,28,30-34    
  bfsFileSearch.ts |   89.02 |    90.47 |     100 |   89.02 | 86-94             
  browser.ts       |    7.69 |      100 |       0 |    7.69 | 17-56             
  editCorrector.ts |    77.3 |    61.11 |   91.66 |    77.3 | ...65-677,711,725 
  editor.ts        |   97.63 |    94.54 |     100 |   97.63 | 154,224,227-228   
  ...entContext.ts |     100 |      100 |     100 |     100 |                   
  errorParsing.ts  |     100 |     92.3 |     100 |     100 | 76,80,86          
  ...rReporting.ts |   83.72 |    84.61 |     100 |   83.72 | 82-86,107-115     
  errors.ts        |   39.02 |       60 |      75 |   39.02 | 21-25,41-57,61-67 
  fetch.ts         |   34.04 |      100 |       0 |   34.04 | 22-27,31-57       
  fileUtils.ts     |   95.27 |       90 |     100 |   95.27 | ...06-111,359-365 
  formatters.ts    |   54.54 |       50 |     100 |   54.54 | 12-16             
  ...eUtilities.ts |   96.03 |    95.83 |     100 |   96.03 | 28-29,57-58       
  ...rStructure.ts |   95.96 |    94.93 |     100 |   95.96 | ...14-117,345-347 
  getPty.ts        |    12.5 |      100 |       0 |    12.5 | 21-34             
  ...noreParser.ts |     100 |    89.47 |     100 |     100 | 27,47             
  gitUtils.ts      |   51.21 |     90.9 |      50 |   51.21 | 40-41,50-73       
  ...yDiscovery.ts |   83.56 |    74.07 |   77.77 |   83.56 | ...53-354,357-358 
  ...tProcessor.ts |   93.63 |    88.75 |   84.61 |   93.63 | ...81-282,385-386 
  ...Inspectors.ts |     100 |      100 |     100 |     100 |                   
  ...kerChecker.ts |   83.33 |    83.33 |     100 |   83.33 | 64-65,75-80,88-94 
  openaiLogger.ts  |    19.1 |      100 |   33.33 |    19.1 | ...96-116,124-131 
  partUtils.ts     |     100 |      100 |     100 |     100 |                   
  paths.ts         |   85.84 |    91.42 |      80 |   85.84 | ...92-193,201-202 
  ...ectSummary.ts |    3.75 |      100 |       0 |    3.75 | 27-119            
  ...rDetection.ts |   76.85 |    84.31 |     100 |   76.85 | ...25-126,166-167 
  retry.ts         |   63.98 |    76.19 |     100 |   63.98 | ...74-294,339-354 
  safeJsonParse.ts |     100 |      100 |     100 |     100 |                   
  ...nStringify.ts |     100 |      100 |     100 |     100 |                   
  ...aValidator.ts |      80 |    57.14 |     100 |      80 | 23-24,26-27       
  ...r-launcher.ts |   76.52 |     87.5 |   66.66 |   76.52 | ...33,135,153-191 
  session.ts       |     100 |      100 |     100 |     100 |                   
  shell-utils.ts   |   98.52 |     97.7 |     100 |   98.52 | 172-173,190-191   
  ...tGenerator.ts |     100 |      100 |     100 |     100 |                   
  summarizer.ts    |     100 |    88.88 |     100 |     100 | 91                
  ...emEncoding.ts |      98 |    94.11 |     100 |      98 | 106-107           
  testUtils.ts     |   84.44 |    72.72 |   83.33 |   84.44 | 27-28,34-35,70-72 
  textUtils.ts     |    12.5 |      100 |       0 |    12.5 | 15-34             
  user_account.ts  |   96.87 |    94.73 |     100 |   96.87 | 36-38             
  user_id.ts       |     100 |    91.66 |     100 |     100 | 26                
  ...aceContext.ts |   96.63 |     97.5 |    92.3 |   96.63 | 88-89,103-104     
  yaml-parser.ts   |      92 |       84 |     100 |      92 | 49-53,65-69       
 ...ils/filesearch |    96.1 |     91.2 |     100 |    96.1 |                   
  crawlCache.ts    |     100 |      100 |     100 |     100 |                   
  crawler.ts       |   96.22 |     92.3 |     100 |   96.22 | 66-67             
  fileSearch.ts    |   92.94 |    86.56 |     100 |   92.94 | ...17-218,220-221 
  ignore.ts        |     100 |      100 |     100 |     100 |                   
  result-cache.ts  |     100 |     92.3 |     100 |     100 | 46                
-------------------|---------|----------|---------|---------|-------------------

For detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run.

@github-actions github-actions Bot added the bug label Sep 16, 2025

@pomelo-nwu pomelo-nwu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pomelo-nwu pomelo-nwu merged commit da78a9f into main Sep 16, 2025
18 checks passed
@tanzhenxin tanzhenxin deleted the fix/win-paste-multi-line branch October 29, 2025 07:16
xaelistic pushed a commit to xaelistic/qwen-code that referenced this pull request Jun 7, 2026
xaelistic pushed a commit to xaelistic/qwen-code that referenced this pull request Jun 7, 2026
Fix: Windows Multi-line Paste Handling with Debounced Data Processing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

粘贴错误信息时,没有粘贴上去,直接将编辑的消息发出去了。

2 participants