microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.63k stars 29.04k forks source link

Search and replace with regular expression truncates group capture #58611

Closed benhongh closed 6 years ago

benhongh commented 6 years ago

Issue Type: Bug

  1. Create a file temp.txt with the following content:
    line with less than seventy five characters seems to be just fine, but...
    line with more than seventy five characters seems to be truncated after this point...
  2. Open in VS Code the containing directory of temp.txt
  3. Bring up the Search panel from the activity bar (or CTRL+SHIFT+H)
  4. Select "Use Regular Expression" button (the one that looks like .*, or by ALT+R)
  5. In the search box enter the following pattern: line.*
  6. Check that both lines in temp.txt is highlighted.
  7. In the replace text enter the following replacer: $0
  8. Click "Replace All" button

Expected result: Since the replacer is just group-0, the file should not change.

Actual result: The second line of temp.txt is truncated from character 75.

Note that this issue does not occur for the in-file search & replace tool (CTRL+H).

VS Code version: Code 1.27.1 (5944e81f3c46a3938a82c701f96d7a59b074cfdc, 2018-09-06T09:21:47.222Z) OS version: Linux x64 3.10.0-693.el7.x86_64

System Info |Item|Value| |---|---| |CPUs|Intel(R) Xeon(R) CPU E5-1630 v3 @ 3.70GHz (8 x 3393)| |GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: unavailable_software
video_encode: unavailable_software
webgl: enabled
webgl2: enabled| |Load (avg)|0, 1, 2| |Memory (System)|62.81GB (4.85GB free)| |Process Argv|/usr/share/code/code .| |Screen Reader|no| |VM|0%|
Extensions (16) Extension|Author (truncated)|Version ---|---|--- usd|ani|0.0.2 EditorConfig|Edi|0.12.4 overtype|ada|0.2.0 toggle-excluded-files|eam|1.6.0 vscode-cudacpp|kri|0.1.1 git-indicators|lam|2.1.1 restructuredtext|lex|77.0.0 python|ms-|2018.8.0 cpptools|ms-|0.18.1 hide-gitignored|npx|1.0.1 material-icon-theme|PKi|3.6.0 mel|sat|0.1.2 jenkinsfile-support|sec|0.1.0 trailing-spaces|sha|0.2.11 vscode-input-sequence|tom|0.2.0 cmake|twx|0.0.17 (2 theme extensions excluded)
roblourens commented 6 years ago

This will be fixed in 1.27.2 (today) https://github.com/Microsoft/vscode/issues/58374